From 15df1d16c3449eb4a4c9fe3256ab5619fdf99cf8 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 22 May 2012 09:32:09 -0700 Subject: [PATCH] Fix compiler warnings Warnings in all src/main/java folders have been reviewed and fixed with the following exceptions: - changes that might break binary compatibility - changes due to reliance on external deprecated code - changes that seem contentious or may require additional review In addition src/test/java folders have been reviewed and fixed up-to spring-jdbc. The use of deprecated EasyMock calls have not yet been updated. Issues: SPR-9431 --- .../java/org/springframework/aop/Advisor.java | 6 +- .../aop/DynamicIntroductionAdvice.java | 4 +- .../aop/IntroductionAdvisor.java | 4 +- .../aop/IntroductionAwareMethodMatcher.java | 4 +- .../springframework/aop/IntroductionInfo.java | 6 +- .../aop/MethodBeforeAdvice.java | 8 +- .../springframework/aop/PointcutAdvisor.java | 6 +- .../springframework/aop/TrueClassFilter.java | 10 +- .../aop/TrueMethodMatcher.java | 14 +- .../org/springframework/aop/TruePointcut.java | 6 +- .../aop/aspectj/AbstractAspectJAdvice.java | 56 +- .../AspectJAdviceParameterNameDiscoverer.java | 18 +- .../aop/aspectj/AspectJAfterAdvice.java | 4 +- .../aspectj/AspectJAfterReturningAdvice.java | 4 +- .../aspectj/AspectJAfterThrowingAdvice.java | 4 +- .../aop/aspectj/AspectJAopUtils.java | 2 +- .../aop/aspectj/AspectJAroundAdvice.java | 2 +- .../aspectj/AspectJExpressionPointcut.java | 34 +- .../AspectJExpressionPointcutAdvisor.java | 6 +- .../aop/aspectj/AspectJPointcutAdvisor.java | 2 +- .../aop/aspectj/AspectJProxyUtils.java | 8 +- .../aspectj/AspectJWeaverMessageHandler.java | 22 +- .../aop/aspectj/DeclareParentsAdvisor.java | 18 +- .../MethodInvocationProceedingJoinPoint.java | 16 +- .../aop/aspectj/RuntimeTestWalker.java | 24 +- .../aspectj/SimpleAspectInstanceFactory.java | 8 +- .../SingletonAspectInstanceFactory.java | 2 +- .../aop/aspectj/TypePatternClassFilter.java | 10 +- .../AbstractAspectJAdvisorFactory.java | 34 +- ...nnotationAwareAspectJAutoProxyCreator.java | 4 +- .../annotation/AspectJAdvisorFactory.java | 2 +- .../annotation/AspectJProxyFactory.java | 14 +- .../aspectj/annotation/AspectMetadata.java | 16 +- .../BeanFactoryAspectInstanceFactory.java | 8 +- .../BeanFactoryAspectJAdvisorsBuilder.java | 6 +- ...ntiationModelAwarePointcutAdvisorImpl.java | 36 +- .../ReflectiveAspectJAdvisorFactory.java | 2 +- ...pleMetadataAwareAspectInstanceFactory.java | 4 +- .../aop/aspectj/annotation/package-info.java | 2 +- .../AspectJAwareAdvisorAutoProxyCreator.java | 21 +- .../AspectJPrecedenceComparator.java | 10 +- .../aop/aspectj/package-info.java | 2 +- ...erceptorDrivenBeanDefinitionDecorator.java | 4 +- .../aop/config/AdviceEntry.java | 2 +- .../aop/config/AdvisorEntry.java | 2 +- .../aop/config/AopConfigUtils.java | 14 +- .../aop/config/AopNamespaceUtils.java | 2 +- .../AspectJAutoProxyBeanDefinitionParser.java | 2 +- .../config/ConfigBeanDefinitionParser.java | 14 +- .../aop/config/MethodLocatingFactoryBean.java | 4 +- .../aop/config/PointcutEntry.java | 2 +- .../ScopedProxyBeanDefinitionDecorator.java | 4 +- .../SpringConfiguredBeanDefinitionParser.java | 2 +- .../aop/framework/Advised.java | 8 +- .../aop/framework/AdvisedSupport.java | 33 +- .../aop/framework/AdvisorChainFactory.java | 4 +- .../aop/framework/AopProxyFactory.java | 2 +- .../aop/framework/AopProxyUtils.java | 16 +- .../aop/framework/CglibAopProxy.java | 2 +- .../framework/DefaultAdvisorChainFactory.java | 6 +- .../aop/framework/DefaultAopProxyFactory.java | 4 +- .../InterceptorAndDynamicMethodMatcher.java | 2 +- .../aop/framework/JdkDynamicAopProxy.java | 8 +- .../aop/framework/ProxyFactory.java | 6 +- .../aop/framework/ProxyFactoryBean.java | 28 +- .../framework/ReflectiveMethodInvocation.java | 10 +- .../aop/framework/adapter/AdvisorAdapter.java | 2 +- .../adapter/AdvisorAdapterRegistry.java | 2 +- .../adapter/AfterReturningAdviceAdapter.java | 2 +- .../AfterReturningAdviceInterceptor.java | 2 +- .../DefaultAdvisorAdapterRegistry.java | 2 +- .../adapter/GlobalAdvisorAdapterRegistry.java | 4 +- .../adapter/MethodBeforeAdviceAdapter.java | 2 +- .../MethodBeforeAdviceInterceptor.java | 2 +- .../adapter/ThrowsAdviceAdapter.java | 2 +- .../adapter/ThrowsAdviceInterceptor.java | 12 +- .../adapter/UnknownAdviceTypeException.java | 6 +- .../aop/framework/adapter/package-info.java | 2 +- .../AbstractAdvisorAutoProxyCreator.java | 10 +- .../autoproxy/AbstractAutoProxyCreator.java | 4 +- .../BeanFactoryAdvisorRetrievalHelper.java | 2 +- .../autoproxy/BeanNameAutoProxyCreator.java | 4 +- .../DefaultAdvisorAutoProxyCreator.java | 4 +- .../autoproxy/TargetSourceCreator.java | 8 +- .../aop/framework/autoproxy/package-info.java | 4 +- ...ctBeanFactoryBasedTargetSourceCreator.java | 2 +- .../target/LazyInitTargetSourceCreator.java | 4 +- .../target/QuickTargetSourceCreator.java | 8 +- .../aop/framework/package-info.java | 6 +- .../AbstractMonitoringInterceptor.java | 6 +- .../interceptor/AbstractTraceInterceptor.java | 4 +- .../ConcurrencyThrottleInterceptor.java | 8 +- .../CustomizableTraceInterceptor.java | 6 +- .../interceptor/ExposeBeanNameAdvisors.java | 4 +- .../ExposeInvocationInterceptor.java | 2 +- .../JamonPerformanceMonitorInterceptor.java | 4 +- .../PerformanceMonitorInterceptor.java | 2 +- .../org/springframework/aop/package-info.java | 6 +- .../aop/scope/DefaultScopedObject.java | 2 +- .../aop/scope/ScopedObject.java | 2 +- .../aop/scope/ScopedProxyFactoryBean.java | 8 +- .../aop/scope/ScopedProxyUtils.java | 4 +- .../AbstractBeanFactoryPointcutAdvisor.java | 2 +- .../aop/support/AbstractPointcutAdvisor.java | 2 +- .../support/AbstractRegexpMethodPointcut.java | 2 +- .../springframework/aop/support/AopUtils.java | 2 +- .../aop/support/ClassFilters.java | 6 +- .../aop/support/ControlFlowPointcut.java | 14 +- .../support/DefaultIntroductionAdvisor.java | 22 +- .../aop/support/DefaultPointcutAdvisor.java | 6 +- ...erTargetObjectIntroductionInterceptor.java | 16 +- .../DelegatingIntroductionInterceptor.java | 16 +- .../aop/support/DynamicMethodMatcher.java | 6 +- .../support/DynamicMethodMatcherPointcut.java | 6 +- .../aop/support/IntroductionInfoSupport.java | 12 +- .../aop/support/JdkRegexpMethodPointcut.java | 6 +- .../aop/support/MethodMatchers.java | 24 +- .../aop/support/NameMatchMethodPointcut.java | 4 +- .../NameMatchMethodPointcutAdvisor.java | 2 +- .../aop/support/Pointcuts.java | 8 +- .../support/RegexpMethodPointcutAdvisor.java | 2 +- .../aop/support/RootClassFilter.java | 20 +- .../aop/support/StaticMethodMatcher.java | 8 +- .../StaticMethodMatcherPointcutAdvisor.java | 2 +- .../annotation/AnnotationClassFilter.java | 4 +- .../annotation/AnnotationMethodMatcher.java | 2 +- .../AbstractBeanFactoryBasedTargetSource.java | 4 +- .../AbstractLazyCreationTargetSource.java | 2 +- .../target/AbstractPoolingTargetSource.java | 4 +- .../aop/target/CommonsPoolTargetSource.java | 4 +- .../aop/target/EmptyTargetSource.java | 10 +- .../aop/target/PoolingConfig.java | 6 +- .../aop/target/SingletonTargetSource.java | 4 +- .../aop/target/ThreadLocalTargetSource.java | 12 +- .../target/ThreadLocalTargetSourceStats.java | 8 +- .../AbstractRefreshableTargetSource.java | 2 +- .../aop/target/dynamic/Refreshable.java | 6 +- ...eParameterNameDiscoverAnnotationTests.java | 2 +- ...ctJAdviceParameterNameDiscovererTests.java | 4 +- .../AspectJExpressionPointcutTests.java | 71 ++- .../BeanNamePointcutMatchingTests.java | 10 +- ...hodInvocationProceedingJoinPointTests.java | 28 +- ...ctJAdviceParameterNameDiscovererTests.java | 14 +- .../TigerAspectJExpressionPointcutTests.java | 79 +-- .../TrickyAspectJPointcutExpressionTests.java | 34 +- .../aspectj/TypePatternClassFilterTests.java | 8 +- .../AbstractAspectJAdvisorFactoryTests.java | 202 +++---- .../annotation/ArgumentBindingTests.java | 6 +- .../AspectJPointcutAdvisorTests.java | 28 +- .../annotation/AspectMetadataTests.java | 14 +- .../annotation/AspectProxyFactoryTests.java | 2 +- .../ReflectiveAspectJAdvisorFactoryTests.java | 2 +- .../AspectJNamespaceHandlerTests.java | 2 +- .../AspectJPrecedenceComparatorTests.java | 6 +- .../config/AopNamespaceHandlerEventTests.java | 8 +- ...AopNamespaceHandlerPointcutErrorTests.java | 14 +- .../aop/config/TopLevelAopTagTests.java | 4 +- .../aop/framework/AopProxyUtilsTests.java | 20 +- .../framework/IntroductionBenchmarkTests.java | 10 +- .../aop/framework/MethodInvocationTests.java | 14 +- .../aop/framework/PrototypeTargetTests.java | 35 +- .../aop/framework/ProxyFactoryTests.java | 26 +- .../adapter/ThrowsAdviceInterceptorTests.java | 4 +- .../ConcurrencyThrottleInterceptorTests.java | 2 +- .../CustomizableTraceInterceptorTests.java | 2 +- .../interceptor/DebugInterceptorTests.java | 6 +- .../ExposeBeanNameAdvisorsTests.java | 24 +- .../ExposeInvocationInterceptorTests.java | 31 +- .../PerformanceMonitorInterceptorTests.java | 2 +- .../SimpleTraceInterceptorTests.java | 2 +- .../aop/scope/DefaultScopedObjectTests.java | 2 +- .../aop/scope/ScopedProxyAutowireTests.java | 16 +- .../AbstractRegexpMethodPointcutTests.java | 2 +- .../aop/support/AopUtilsTests.java | 6 +- .../aop/support/ClassFiltersTests.java | 16 +- .../aop/support/ClassUtilsTests.java | 2 +- .../aop/support/ComposablePointcutTests.java | 28 +- .../aop/support/ControlFlowPointcutTests.java | 28 +- ...elegatingIntroductionInterceptorTests.java | 11 +- .../aop/support/MethodMatchersTests.java | 20 +- .../support/NameMatchMethodPointcutTests.java | 26 +- .../aop/support/PointcutsTests.java | 62 +-- ...MethodPointcutAdvisorIntegrationTests.java | 37 +- .../CommonsPoolTargetSourceProxyTests.java | 2 +- .../target/HotSwappableTargetSourceTests.java | 61 +-- .../target/LazyCreationTargetSourceTests.java | 2 +- .../aop/target/LazyInitTargetSourceTests.java | 21 +- .../PrototypeBasedTargetSourceTests.java | 15 +- .../target/PrototypeTargetSourceTests.java | 24 +- .../target/ThreadLocalTargetSourceTests.java | 45 +- .../dynamic/RefreshableTargetSourceTests.java | 2 +- .../annotation/EmptySpringAnnotation.java | 2 +- .../test/java/test/aop/DefaultLockable.java | 8 +- .../src/test/java/test/aop/Lockable.java | 16 +- .../src/test/java/test/aop/MethodCounter.java | 2 +- .../test/java/test/aop/NopInterceptor.java | 12 +- .../test/java/test/aop/PerTargetAspect.java | 4 +- .../test/aop/SerializableNopInterceptor.java | 18 +- .../test/java/test/aop/TwoAdviceAspect.java | 2 +- .../src/test/java/test/beans/Colour.java | 6 +- .../test/java/test/beans/INestedTestBean.java | 8 +- .../src/test/java/test/beans/IOther.java | 8 +- .../src/test/java/test/beans/ITestBean.java | 2 +- .../test/java/test/beans/NestedTestBean.java | 8 +- .../src/test/java/test/beans/Person.java | 18 +- .../java/test/beans/SerializablePerson.java | 16 +- .../test/java/test/beans/SideEffectBean.java | 14 +- .../src/test/java/test/beans/TestBean.java | 2 +- .../test/java/test/beans/subpkg/DeepBean.java | 4 +- .../CollectingReaderEventListener.java | 11 +- .../test/util/SerializationTestUtils.java | 12 +- .../java/test/util/TestResourceUtils.java | 64 ++- .../src/test/java/test/util/TimeStamped.java | 8 +- .../factory/aspectj/ConfigurableObject.java | 2 +- .../SpringConfiguredConfiguration.java | 2 +- .../AbstractMethodMockingControl.aj | 2 +- .../AutoProxyWithCodeStyleAspectsTests.java | 6 +- .../org/springframework/beans/Colour.java | 2 +- .../beans/DerivedTestBean.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- ...SpringConfiguredWithAutoProxyingTests.java | 4 +- .../cache/aspectj/AbstractAnnotationTest.java | 4 +- .../AnnotatedClassCacheableService.java | 2 +- .../cache/config/CacheableService.java | 4 +- .../cache/config/DefaultCacheableService.java | 4 +- ...nDrivenStaticEntityMockingControlTest.java | 16 +- .../mock/staticmock/Delegate.java | 8 +- .../CallCountingTransactionManager.java | 2 +- .../ClassWithPrivateAnnotatedMember.java | 8 +- .../ClassWithProtectedAnnotatedMember.java | 8 +- .../transaction/aspectj/ITransactional.java | 2 +- ...ethodAnnotationOnClassWithNoInterface.java | 6 +- .../aspectj/TransactionAspectTests.java | 62 +-- ...lAnnotationOnlyOnClassWithNoInterface.java | 4 +- .../beans/AbstractPropertyAccessor.java | 2 +- .../beans/BeanInstantiationException.java | 10 +- .../springframework/beans/BeanWrapper.java | 4 +- .../beans/BeanWrapperImpl.java | 47 +- .../beans/CachedIntrospectionResults.java | 21 +- .../ConversionNotSupportedException.java | 6 +- .../GenericTypeAwarePropertyDescriptor.java | 18 +- .../beans/InvalidPropertyException.java | 10 +- .../beans/MethodInvocationException.java | 2 +- .../beans/MutablePropertyValues.java | 4 +- .../beans/NotReadablePropertyException.java | 6 +- .../beans/NotWritablePropertyException.java | 10 +- .../beans/NullValueInNestedPathException.java | 6 +- .../beans/PropertyAccessException.java | 2 +- .../beans/PropertyAccessor.java | 9 +- .../beans/PropertyBatchUpdateException.java | 4 +- .../beans/PropertyEditorRegistrar.java | 2 +- .../beans/PropertyEditorRegistrySupport.java | 2 +- .../beans/PropertyMatches.java | 8 +- .../springframework/beans/PropertyValues.java | 10 +- .../beans/TypeConverterDelegate.java | 20 +- .../beans/TypeMismatchException.java | 14 +- .../beans/annotation/AnnotationBeanUtils.java | 16 +- .../springframework/beans/factory/Aware.java | 4 +- .../beans/factory/BeanCreationException.java | 4 +- .../factory/BeanExpressionException.java | 2 +- .../beans/factory/BeanFactoryUtils.java | 6 +- .../factory/BeanIsNotAFactoryException.java | 10 +- .../BeanNotOfRequiredTypeException.java | 12 +- .../beans/factory/DisposableBean.java | 6 +- .../factory/HierarchicalBeanFactory.java | 2 +- .../beans/factory/InitializingBean.java | 10 +- .../beans/factory/ListableBeanFactory.java | 2 +- .../NoSuchBeanDefinitionException.java | 4 +- .../UnsatisfiedDependencyException.java | 6 +- .../factory/access/BootstrapException.java | 6 +- .../access/SingletonBeanFactoryLocator.java | 52 +- .../access/el/SpringBeanELResolver.java | 2 +- .../beans/factory/access/package-info.java | 2 +- .../AutowiredAnnotationBeanPostProcessor.java | 22 +- .../factory/annotation/Configurable.java | 4 +- .../annotation/CustomAutowireConfigurer.java | 12 +- ...nitDestroyAnnotationBeanPostProcessor.java | 5 +- .../factory/annotation/InjectionMetadata.java | 24 +- .../beans/factory/annotation/Required.java | 2 +- .../RequiredAnnotationBeanPostProcessor.java | 4 +- .../factory/config/AbstractFactoryBean.java | 10 +- .../config/AutowireCapableBeanFactory.java | 6 +- .../config/BeanFactoryPostProcessor.java | 6 +- .../config/BeanReferenceFactoryBean.java | 12 +- .../factory/config/CommonsLogFactoryBean.java | 8 +- .../config/ConstructorArgumentValues.java | 18 +- .../config/CustomEditorConfigurer.java | 31 +- .../factory/config/CustomScopeConfigurer.java | 8 +- .../factory/config/DependencyDescriptor.java | 8 +- .../config/FieldRetrievingFactoryBean.java | 17 +- .../beans/factory/config/ListFactoryBean.java | 26 +- .../beans/factory/config/MapFactoryBean.java | 27 +- .../config/MethodInvokingFactoryBean.java | 10 +- .../ObjectFactoryCreatingFactoryBean.java | 8 +- .../PreferencesPlaceholderConfigurer.java | 6 +- .../config/PropertyOverrideConfigurer.java | 2 +- .../config/PropertyPathFactoryBean.java | 18 +- .../config/ProviderCreatingFactoryBean.java | 15 +- .../config/RuntimeBeanNameReference.java | 8 +- .../factory/config/RuntimeBeanReference.java | 8 +- .../config/ServiceLocatorFactoryBean.java | 36 +- .../beans/factory/config/SetFactoryBean.java | 28 +- .../factory/config/TypedStringValue.java | 16 +- .../beans/factory/package-info.java | 2 +- .../parsing/FailFastProblemReporter.java | 2 +- .../beans/factory/parsing/ParseState.java | 13 +- .../beans/factory/parsing/PropertyEntry.java | 2 +- .../beans/factory/parsing/QualifierEntry.java | 2 +- ...AbstractServiceLoaderBasedFactoryBean.java | 14 +- .../serviceloader/ServiceFactoryBean.java | 10 +- .../serviceloader/ServiceListFactoryBean.java | 12 +- .../ServiceLoaderFactoryBean.java | 8 +- .../AbstractAutowireCapableBeanFactory.java | 90 +-- .../support/AbstractBeanDefinition.java | 12 +- .../support/AbstractBeanDefinitionReader.java | 2 +- .../support/AutowireCandidateQualifier.java | 6 +- .../beans/factory/support/AutowireUtils.java | 24 +- .../support/BeanDefinitionBuilder.java | 10 +- .../support/BeanDefinitionDefaults.java | 2 +- .../support/BeanDefinitionResource.java | 4 +- .../support/BeanDefinitionValueResolver.java | 20 +- ...CglibSubclassingInstantiationStrategy.java | 16 +- .../factory/support/ChildBeanDefinition.java | 4 +- .../factory/support/ConstructorResolver.java | 46 +- .../support/DefaultListableBeanFactory.java | 58 +- .../support/DefaultSingletonBeanRegistry.java | 8 +- .../support/FactoryBeanRegistrySupport.java | 18 +- .../beans/factory/support/LookupOverride.java | 2 +- .../beans/factory/support/ManagedArray.java | 4 +- .../beans/factory/support/ManagedList.java | 4 +- .../beans/factory/support/ManagedMap.java | 4 +- .../beans/factory/support/ManagedSet.java | 4 +- .../beans/factory/support/MethodOverride.java | 2 +- .../factory/support/MethodOverrides.java | 2 +- .../beans/factory/support/MethodReplacer.java | 2 +- .../PropertiesBeanDefinitionReader.java | 18 +- .../factory/support/ReplaceOverride.java | 6 +- .../factory/support/RootBeanDefinition.java | 16 +- .../support/SecurityContextProvider.java | 6 +- .../support/SimpleInstantiationStrategy.java | 8 +- .../SimpleSecurityContextProvider.java | 8 +- .../support/StaticListableBeanFactory.java | 26 +- .../beans/factory/support/package-info.java | 2 +- .../factory/wiring/BeanConfigurerSupport.java | 4 +- .../xml/AbstractBeanDefinitionParser.java | 4 +- .../AbstractSimpleBeanDefinitionParser.java | 10 +- .../AbstractSingleBeanDefinitionParser.java | 2 +- .../factory/xml/BeanDefinitionDecorator.java | 2 +- .../xml/BeanDefinitionDocumentReader.java | 2 +- .../factory/xml/BeanDefinitionParser.java | 2 +- .../xml/BeanDefinitionParserDelegate.java | 12 +- .../beans/factory/xml/BeansDtdResolver.java | 4 +- .../DefaultBeanDefinitionDocumentReader.java | 4 +- .../factory/xml/DefaultDocumentLoader.java | 2 +- .../factory/xml/DelegatingEntityResolver.java | 4 +- .../beans/factory/xml/NamespaceHandler.java | 6 +- .../factory/xml/NamespaceHandlerSupport.java | 2 +- .../factory/xml/ResourceEntityResolver.java | 2 +- .../SimpleConstructorNamespaceHandler.java | 26 +- .../xml/SimplePropertyNamespaceHandler.java | 2 +- .../factory/xml/UtilNamespaceHandler.java | 20 +- .../factory/xml/XmlBeanDefinitionReader.java | 2 +- .../xml/XmlBeanDefinitionStoreException.java | 2 +- .../springframework/beans/package-info.java | 4 +- .../propertyeditors/CharacterEditor.java | 2 +- .../propertyeditors/ClassArrayEditor.java | 6 +- .../beans/propertyeditors/ClassEditor.java | 4 +- .../CustomCollectionEditor.java | 28 +- .../propertyeditors/CustomMapEditor.java | 25 +- .../propertyeditors/CustomNumberEditor.java | 6 +- .../propertyeditors/InputSourceEditor.java | 2 +- .../beans/propertyeditors/LocaleEditor.java | 6 +- .../propertyeditors/PropertiesEditor.java | 4 +- .../propertyeditors/ResourceBundleEditor.java | 20 +- .../StringArrayPropertyEditor.java | 6 +- .../beans/propertyeditors/package-info.java | 2 +- .../ArgumentConvertingMethodInvoker.java | 6 +- .../beans/support/MutableSortDefinition.java | 4 +- .../beans/support/PropertyComparator.java | 9 +- .../beans/support/SortDefinition.java | 6 +- .../ComponentBeanDefinitionParserTest.java | 20 +- .../beans/AbstractPropertyValuesTests.java | 10 +- .../springframework/beans/BeanUtilsTests.java | 38 +- .../beans/BeanWrapperAutoGrowingTests.java | 43 +- .../beans/BeanWrapperGenericsTests.java | 30 +- .../beans/BeanWrapperTests.java | 69 ++- .../beans/ConcurrentBeanWrapperTests.java | 12 +- .../beans/MutablePropertyValuesTests.java | 4 +- .../beans/PropertyAccessorUtilsTests.java | 2 +- ...AnnotationBeanWiringInfoResolverTests.java | 2 +- ...uiredAnnotationBeanPostProcessorTests.java | 2 +- .../beans/factory/BeanFactoryUtilsTests.java | 22 +- .../factory/ConcurrentBeanFactoryTests.java | 12 +- .../DefaultListableBeanFactoryTests.java | 172 +++--- .../beans/factory/FactoryBeanLookupTests.java | 25 +- .../beans/factory/FactoryBeanTests.java | 31 +- .../factory/SharedBeanRegistryTests.java | 2 +- .../SingletonBeanFactoryLocatorTests.java | 14 +- ...wiredAnnotationBeanPostProcessorTests.java | 7 +- .../CustomAutowireConfigurerTests.java | 2 +- ...njectAnnotationBeanPostProcessorTests.java | 3 + .../config/CommonsLogFactoryBeanTests.java | 2 +- .../config/CustomEditorConfigurerTests.java | 34 +- .../config/CustomScopeConfigurerTests.java | 4 +- .../config/DeprecatedBeanWarnerTests.java | 2 +- .../FieldRetrievingFactoryBeanTests.java | 4 +- .../MethodInvokingFactoryBeanTests.java | 4 +- ...ObjectFactoryCreatingFactoryBeanTests.java | 25 +- .../config/PropertiesFactoryBeanTests.java | 22 +- .../config/PropertyPathFactoryBeanTests.java | 53 +- .../PropertyResourceConfigurerTests.java | 21 +- .../ServiceLocatorFactoryBeanTests.java | 43 +- .../factory/config/SimpleScopeTests.java | 8 +- .../beans/factory/config/TestTypes.java | 2 +- .../parsing/CustomProblemReporterTests.java | 6 +- .../parsing/FailFastProblemReporterTests.java | 2 +- .../parsing/NullSourceExtractorTests.java | 2 +- .../factory/parsing/ParseStateTests.java | 2 +- .../PassThroughSourceExtractorTests.java | 6 +- .../support/BeanDefinitionBuilderTests.java | 6 +- .../factory/support/BeanDefinitionTests.java | 5 +- .../support/BeanFactoryGenericsTests.java | 41 +- .../factory/support/ManagedListTests.java | 26 +- .../factory/support/ManagedMapTests.java | 29 +- .../support/ManagedPropertiesTests.java | 11 +- .../factory/support/ManagedSetTests.java | 26 +- .../PropertiesBeanDefinitionReaderTests.java | 2 +- ...ierAnnotationAutowireBeanFactoryTests.java | 28 +- .../security/CallbacksSecurityTests.java | 413 +++++++------- .../security/support/ConstructorBean.java | 6 +- .../security/support/CustomCallbackBean.java | 8 +- .../security/support/CustomFactoryBean.java | 10 +- .../support/security/support/DestroyBean.java | 6 +- .../support/security/support/FactoryBean.java | 10 +- .../support/security/support/InitBean.java | 6 +- .../security/support/PropertyBean.java | 8 +- .../wiring/BeanConfigurerSupportTests.java | 6 +- .../factory/xml/AbstractBeanFactoryTests.java | 15 +- .../xml/AbstractListableBeanFactoryTests.java | 4 +- .../xml/AutowireWithExclusionTests.java | 41 +- .../factory/xml/BeanNameGenerationTests.java | 2 +- .../xml/CollectingReaderEventListener.java | 37 +- .../factory/xml/CollectionMergingTests.java | 30 +- .../xml/CollectionsWithDefaultTypesTests.java | 16 +- .../xml/ConstructorDependenciesBean.java | 12 +- .../beans/factory/xml/CountingFactory.java | 10 +- .../xml/DefaultLifecycleMethodsTests.java | 13 +- .../xml/DelegatingEntityResolverTests.java | 4 +- .../beans/factory/xml/DependenciesBean.java | 12 +- .../beans/factory/xml/DummyReferencer.java | 8 +- .../factory/xml/DuplicateBeanIdTests.java | 4 +- .../factory/xml/EventPublicationTests.java | 15 +- .../beans/factory/xml/FactoryMethodTests.java | 2 +- .../beans/factory/xml/FactoryMethods.java | 32 +- .../beans/factory/xml/InstanceFactory.java | 16 +- .../factory/xml/MetadataAttachmentTests.java | 9 +- .../factory/xml/MixedCollectionBean.java | 10 +- ...edBeansElementAttributeRecursionTests.java | 4 +- .../factory/xml/ProtectedLifecycleBean.java | 2 +- .../factory/xml/SchemaValidationTests.java | 2 +- ...impleConstructorNamespaceHandlerTests.java | 31 +- .../SimplePropertyNamespaceHandlerTests.java | 20 +- .../beans/factory/xml/TestBeanCreator.java | 12 +- .../xml/UtilNamespaceHandlerTests.java | 80 +-- .../factory/xml/XmlBeanCollectionTests.java | 97 ++-- .../xml/XmlBeanDefinitionReaderTests.java | 4 +- .../xml/XmlListableBeanFactoryTests.java | 31 +- .../DefaultNamespaceHandlerResolverTests.java | 4 +- .../ByteArrayPropertyEditorTests.java | 4 +- .../CharArrayPropertyEditorTests.java | 2 +- .../CustomCollectionEditorTests.java | 7 +- .../propertyeditors/CustomEditorTests.java | 14 +- .../propertyeditors/FileEditorTests.java | 2 +- .../InputStreamEditorTests.java | 2 +- .../PropertiesEditorTests.java | 18 +- .../ResourceBundleEditorTests.java | 2 +- .../beans/propertyeditors/URIEditorTests.java | 2 +- .../beans/propertyeditors/URLEditorTests.java | 2 +- .../support/DerivedFromProtectedBaseBean.java | 2 +- .../beans/support/PagedListHolderTests.java | 20 +- .../support/PropertyComparatorTests.java | 8 +- .../beans/support/ProtectedBaseBean.java | 2 +- .../test/java/test/beans/BooleanTestBean.java | 8 +- .../src/test/java/test/beans/Colour.java | 5 +- .../src/test/java/test/beans/CustomEnum.java | 2 +- .../src/test/java/test/beans/DummyBean.java | 8 +- .../test/java/test/beans/DummyFactory.java | 2 +- .../src/test/java/test/beans/GenericBean.java | 50 +- .../java/test/beans/GenericIntegerBean.java | 2 +- .../test/beans/GenericSetOfIntegerBean.java | 2 +- .../test/java/test/beans/INestedTestBean.java | 8 +- .../src/test/java/test/beans/IOther.java | 8 +- .../src/test/java/test/beans/ITestBean.java | 2 +- .../test/java/test/beans/IndexedTestBean.java | 2 +- .../test/java/test/beans/LifecycleBean.java | 2 +- .../test/java/test/beans/NestedTestBean.java | 8 +- .../test/java/test/beans/NumberTestBean.java | 8 +- .../test/beans/PackageLevelVisibleBean.java | 2 +- .../src/test/java/test/beans/TestBean.java | 6 +- .../java/test/util/TestResourceUtils.java | 74 ++- .../cache/ehcache/EhCacheCacheManager.java | 1 - .../ehcache/EhCacheManagerFactoryBean.java | 2 +- .../org/springframework/mail/MailSender.java | 8 +- .../mail/SimpleMailMessage.java | 6 +- .../javamail/ConfigurableMimeFileTypeMap.java | 2 +- .../mail/javamail/JavaMailSenderImpl.java | 2 +- .../mail/javamail/MimeMessageHelper.java | 2 +- .../commonj/DelegatingTimerListener.java | 2 +- .../scheduling/commonj/DelegatingWork.java | 2 +- .../commonj/TimerManagerAccessor.java | 2 +- .../commonj/TimerManagerFactoryBean.java | 2 +- .../commonj/WorkManagerTaskExecutor.java | 2 + .../quartz/AdaptableJobFactory.java | 4 +- .../scheduling/quartz/CronTriggerBean.java | 2 +- .../quartz/CronTriggerFactoryBean.java | 2 +- .../scheduling/quartz/DelegatingJob.java | 2 +- .../scheduling/quartz/JobDetailBean.java | 8 +- .../quartz/JobDetailFactoryBean.java | 3 +- .../quartz/LocalDataSourceJobStore.java | 8 +- .../quartz/LocalTaskExecutorThreadPool.java | 6 +- .../MethodInvokingJobDetailFactoryBean.java | 10 +- .../scheduling/quartz/QuartzJobBean.java | 6 +- .../quartz/ResourceLoaderClassLoadHelper.java | 10 +- .../scheduling/quartz/SchedulerAccessor.java | 8 +- .../quartz/SchedulerFactoryBean.java | 10 +- .../quartz/SimpleThreadPoolTaskExecutor.java | 2 +- .../scheduling/quartz/SimpleTriggerBean.java | 2 +- .../quartz/SimpleTriggerFactoryBean.java | 2 +- .../quartz/SpringBeanJobFactory.java | 2 +- .../FreeMarkerConfigurationFactory.java | 2 +- .../FreeMarkerConfigurationFactoryBean.java | 2 +- .../freemarker/FreeMarkerTemplateUtils.java | 6 +- .../ui/freemarker/SpringTemplateLoader.java | 2 +- .../ui/jasperreports/JasperReportsUtils.java | 42 +- .../ui/velocity/CommonsLoggingLogSystem.java | 2 +- .../ui/velocity/VelocityEngineFactory.java | 2 +- .../velocity/VelocityEngineFactoryBean.java | 2 +- .../ui/velocity/VelocityEngineUtils.java | 16 +- .../org/springframework/beans/Colour.java | 5 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 48 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 6 +- .../cache/ehcache/EhCacheCacheTests.java | 18 +- .../mail/SimpleMailMessageTests.java | 2 +- .../mail/javamail/JavaMailSenderTests.java | 37 +- .../scheduling/TestMethodInvokingTask.java | 2 +- .../quartz/CronTriggerBeanTests.java | 2 +- .../quartz/QuartzSchedulerLifecycleTests.java | 2 +- .../scheduling/quartz/QuartzSupportTests.java | 24 +- .../JasperReportsUtilsTests.java | 14 +- .../cache/annotation/CacheEvict.java | 4 +- .../cache/annotation/Cacheable.java | 2 +- .../SpringCacheAnnotationParser.java | 11 - .../cache/concurrent/ConcurrentMapCache.java | 2 +- ...tationDrivenCacheBeanDefinitionParser.java | 2 +- .../cache/interceptor/CacheAspectSupport.java | 6 +- .../interceptor/DefaultKeyGenerator.java | 2 +- .../interceptor/ExpressionEvaluator.java | 2 +- .../LazyParamAwareEvaluationContext.java | 2 +- .../cache/support/NoOpCacheManager.java | 26 + .../context/ApplicationContext.java | 2 +- .../context/ApplicationContextAware.java | 4 +- .../context/HierarchicalMessageSource.java | 10 +- .../context/MessageSourceResolvable.java | 2 +- .../context/NoSuchMessageException.java | 6 +- .../org/springframework/context/Phased.java | 2 +- .../context/ResourceLoaderAware.java | 2 +- .../access/ContextBeanFactoryReference.java | 8 +- .../context/access/DefaultLocatorFactory.java | 6 +- .../context/access/package-info.java | 2 +- .../context/annotation/AdviceMode.java | 2 +- .../AnnotationBeanNameGenerator.java | 2 +- .../AnnotationConfigBeanDefinitionParser.java | 2 +- .../annotation/AutoProxyRegistrar.java | 3 +- .../context/annotation/Bean.java | 2 +- .../ClassPathBeanDefinitionScanner.java | 2 +- .../CommonAnnotationBeanPostProcessor.java | 4 +- .../ComponentScanBeanDefinitionParser.java | 7 +- .../annotation/ConfigurationClass.java | 4 +- ...onfigurationClassBeanDefinitionReader.java | 4 +- .../ConfigurationClassEnhancer.java | 23 +- .../ConfigurationClassPostProcessor.java | 2 +- .../annotation/EnableAspectJAutoProxy.java | 2 +- .../ImportBeanDefinitionRegistrar.java | 2 +- .../Jsr330ScopeMetadataResolver.java | 4 +- .../LoadTimeWeavingConfiguration.java | 2 +- .../context/annotation/Scope.java | 2 +- .../context/annotation/ScopeMetadata.java | 2 +- .../annotation/ScopeMetadataResolver.java | 4 +- ...ctPropertyLoadingBeanDefinitionParser.java | 2 +- .../LoadTimeWeaverBeanDefinitionParser.java | 2 +- .../MBeanServerBeanDefinitionParser.java | 2 +- .../PropertyOverrideBeanDefinitionParser.java | 8 +- ...opertyPlaceholderBeanDefinitionParser.java | 2 +- .../SpringConfiguredBeanDefinitionParser.java | 2 +- .../AbstractApplicationEventMulticaster.java | 66 +-- .../event/ApplicationEventMulticaster.java | 6 +- .../event/EventPublicationInterceptor.java | 6 +- .../GenericApplicationListenerAdapter.java | 13 +- .../SimpleApplicationEventMulticaster.java | 5 +- .../event/SourceFilteringListener.java | 2 +- .../BeanExpressionContextAccessor.java | 4 +- .../expression/BeanFactoryAccessor.java | 4 +- .../context/expression/MapAccessor.java | 16 +- .../StandardBeanExpressionResolver.java | 2 +- .../springframework/context/package-info.java | 2 +- .../support/AbstractApplicationContext.java | 2 +- ...AbstractRefreshableApplicationContext.java | 3 +- ...ctRefreshableConfigApplicationContext.java | 2 +- .../ApplicationContextAwareProcessor.java | 4 +- .../support/ApplicationObjectSupport.java | 8 +- .../ClassPathXmlApplicationContext.java | 8 +- .../support/ContextTypeMatchClassLoader.java | 8 +- .../support/ConversionServiceFactoryBean.java | 2 +- .../support/DefaultLifecycleProcessor.java | 2 +- .../support/GenericApplicationContext.java | 3 +- .../support/MessageSourceAccessor.java | 6 +- ...ReloadableResourceBundleMessageSource.java | 4 +- .../support/ResourceBundleMessageSource.java | 2 +- .../context/support/SimpleThreadScope.java | 4 +- .../support/StaticApplicationContext.java | 10 +- .../weaving/DefaultContextLoadTimeWeaver.java | 2 +- .../AbstractRemoteSlsbInvokerInterceptor.java | 8 +- .../AbstractSlsbInvokerInterceptor.java | 2 +- .../access/LocalSlsbInvokerInterceptor.java | 6 +- ...LocalStatelessSessionProxyFactoryBean.java | 12 +- .../SimpleRemoteSlsbInvokerInterceptor.java | 6 +- ...emoteStatelessSessionProxyFactoryBean.java | 12 +- .../ejb/access/package-info.java | 4 +- ...tractJndiLocatingBeanDefinitionParser.java | 2 +- .../JndiLookupBeanDefinitionParser.java | 4 +- ...lStatelessSessionBeanDefinitionParser.java | 2 +- ...eStatelessSessionBeanDefinitionParser.java | 2 +- .../SpringBeanAutowiringInterceptor.java | 2 +- .../support/AbstractJmsMessageDrivenBean.java | 4 +- .../support/AbstractMessageDrivenBean.java | 2 +- .../support/AbstractStatefulSessionBean.java | 2 +- .../support/AbstractStatelessSessionBean.java | 10 +- .../ejb/support/package-info.java | 8 +- .../format/AnnotationFormatterFactory.java | 4 +- .../org/springframework/format/Formatter.java | 2 +- .../format/FormatterRegistrar.java | 4 +- .../org/springframework/format/Parser.java | 2 +- .../org/springframework/format/Printer.java | 2 +- .../format/annotation/DateTimeFormat.java | 4 +- .../format/annotation/NumberFormat.java | 6 +- .../format/datetime/joda/DateTimeParser.java | 2 +- ...eTimeFormatAnnotationFormatterFactory.java | 70 ++- .../datetime/joda/JodaTimeContextHolder.java | 2 +- .../datetime/joda/JodaTimeConverters.java | 11 + .../joda/MillisecondInstantPrinter.java | 2 +- .../datetime/joda/ReadablePartialPrinter.java | 2 +- ...umberFormatAnnotationFormatterFactory.java | 2 +- .../support/FormattingConversionService.java | 9 +- ...ormattingConversionServiceFactoryBean.java | 18 +- .../ReflectiveLoadTimeWeaver.java | 4 +- ...esourceOverridingShadowingClassLoader.java | 10 +- .../classloading/ShadowingClassLoader.java | 8 +- .../SimpleInstrumentableClassLoader.java | 4 +- .../GlassFishClassLoaderAdapter.java | 10 +- .../classloading/jboss/JBossMCAdapter.java | 4 +- .../jboss/JBossMCTranslatorAdapter.java | 6 +- .../jboss/JBossModulesAdapter.java | 2 +- .../oc4j/OC4JClassLoaderAdapter.java | 10 +- .../oc4j/OC4JClassPreprocessorAdapter.java | 10 +- .../classloading/oc4j/OC4JLoadTimeWeaver.java | 3 +- .../weblogic/WebLogicClassLoaderAdapter.java | 18 +- .../WebLogicClassPreProcessorAdapter.java | 8 +- .../weblogic/WebLogicLoadTimeWeaver.java | 8 +- .../WebSphereClassLoaderAdapter.java | 6 +- .../WebSphereClassPreDefinePlugin.java | 10 +- .../jmx/access/ConnectorDelegate.java | 2 +- .../jmx/access/MBeanClientInterceptor.java | 29 +- .../jmx/access/MBeanProxyFactoryBean.java | 6 +- .../access/NotificationListenerRegistrar.java | 2 +- .../jmx/export/MBeanExporter.java | 22 +- .../jmx/export/SpringModelMBean.java | 4 +- .../jmx/export/annotation/ManagedMetric.java | 2 +- ...bstractConfigurableMBeanInfoAssembler.java | 4 +- .../assembler/AbstractMBeanInfoAssembler.java | 4 +- .../AbstractReflectiveMBeanInfoAssembler.java | 12 +- .../InterfaceBasedMBeanInfoAssembler.java | 26 +- .../assembler/MetadataMBeanInfoAssembler.java | 4 +- .../MethodExclusionMBeanInfoAssembler.java | 6 +- .../MethodNameBasedMBeanInfoAssembler.java | 4 +- .../export/metadata/JmxAttributeSource.java | 8 +- .../export/naming/IdentityNamingStrategy.java | 4 +- .../jmx/export/naming/KeyNamingStrategy.java | 6 +- .../export/naming/MetadataNamingStrategy.java | 4 +- .../ModelMBeanNotificationPublisher.java | 2 +- .../support/ConnectorServerFactoryBean.java | 2 +- .../springframework/jmx/support/JmxUtils.java | 14 +- .../MBeanServerConnectionFactoryBean.java | 2 +- .../jmx/support/MBeanServerFactoryBean.java | 2 +- .../support/NotificationListenerHolder.java | 2 +- .../jmx/support/ObjectNameManager.java | 2 +- .../WebSphereMBeanServerFactoryBean.java | 4 +- .../jndi/JndiObjectFactoryBean.java | 16 +- .../jndi/JndiObjectTargetSource.java | 4 +- .../springframework/jndi/JndiTemplate.java | 12 +- .../jndi/JndiTemplateEditor.java | 6 +- .../jndi/TypeMismatchNamingException.java | 12 +- .../springframework/jndi/package-info.java | 2 +- .../jndi/support/SimpleJndiBeanFactory.java | 12 +- .../rmi/CodebaseAwareObjectInputStream.java | 4 +- .../rmi/JndiRmiClientInterceptor.java | 14 +- .../remoting/rmi/JndiRmiProxyFactoryBean.java | 2 +- .../remoting/rmi/RmiClientInterceptor.java | 10 +- .../rmi/RmiClientInterceptorUtils.java | 2 +- .../remoting/rmi/RmiInvocationHandler.java | 4 +- .../remoting/rmi/RmiInvocationWrapper.java | 6 +- .../remoting/rmi/RmiRegistryFactoryBean.java | 2 +- .../remoting/rmi/RmiServiceExporter.java | 2 +- .../remoting/support/RemoteAccessor.java | 9 +- .../remoting/support/RemoteExporter.java | 10 +- .../remoting/support/RemoteInvocation.java | 10 +- .../RemoteInvocationTraceInterceptor.java | 2 +- .../support/RemoteInvocationUtils.java | 6 +- .../remoting/support/RemotingSupport.java | 2 +- .../support/SimpleHttpServerFactoryBean.java | 2 +- .../scheduling/annotation/Scheduled.java | 4 +- .../ConcurrentTaskExecutor.java | 2 +- .../CustomizableThreadFactory.java | 2 +- .../ThreadPoolTaskExecutor.java | 2 +- .../concurrent/ConcurrentTaskExecutor.java | 7 +- .../ExecutorConfigurationSupport.java | 2 +- .../concurrent/ReschedulingRunnable.java | 4 +- .../AnnotationDrivenBeanDefinitionParser.java | 4 +- .../config/ExecutorBeanDefinitionParser.java | 2 +- .../ScheduledTasksBeanDefinitionParser.java | 5 +- .../config/SchedulerBeanDefinitionParser.java | 4 +- .../config/TaskNamespaceHandler.java | 4 +- .../support/CronSequenceGenerator.java | 2 +- .../scheduling/support/CronTrigger.java | 2 +- .../support/MethodInvokingRunnable.java | 4 +- .../scheduling/support/PeriodicTrigger.java | 6 +- .../scheduling/support/TaskUtils.java | 4 +- .../scheduling/timer/DelegatingTimerTask.java | 2 +- .../scheduling/timer/TimerFactoryBean.java | 2 +- .../scheduling/timer/TimerTaskExecutor.java | 2 +- .../scripting/ScriptFactory.java | 8 +- .../scripting/bsh/BshScriptFactory.java | 18 +- .../scripting/bsh/BshScriptUtils.java | 14 +- .../config/LangNamespaceHandler.java | 4 +- .../config/ScriptBeanDefinitionParser.java | 11 +- .../config/ScriptingDefaultsParser.java | 4 +- .../scripting/groovy/GroovyScriptFactory.java | 18 +- .../scripting/jruby/JRubyScriptFactory.java | 13 +- .../scripting/jruby/JRubyScriptUtils.java | 15 +- .../support/ResourceScriptSource.java | 4 +- .../support/ScriptFactoryPostProcessor.java | 24 +- .../stereotype/package-info.java | 2 +- .../java/org/springframework/ui/ModelMap.java | 8 +- .../ui/context/HierarchicalThemeSource.java | 6 +- .../ui/context/package-info.java | 4 +- .../support/ResourceBundleThemeSource.java | 2 +- .../support/UiApplicationContextUtils.java | 2 +- .../validation/BeanPropertyBindingResult.java | 2 +- .../springframework/validation/Errors.java | 8 +- .../validation/ObjectError.java | 2 +- .../validation/ValidationUtils.java | 12 +- .../springframework/validation/Validator.java | 14 +- .../BeanValidationPostProcessor.java | 2 +- .../LocaleContextMessageInterpolator.java | 2 +- .../MessageSourceResourceBundleLocator.java | 2 +- .../MethodValidationInterceptor.java | 4 +- .../SpringValidatorAdapter.java | 4 +- .../support/BindingAwareModelMap.java | 4 +- .../example/profilescan/DevComponent.java | 2 +- .../ProfileMetaAnnotatedComponent.java | 2 +- .../AutowiredQualifierFooService.java | 5 +- .../example/scannable/FooServiceImpl.java | 2 +- .../java/example/scannable/MessageBean.java | 4 +- .../example/scannable/NamedComponent.java | 2 +- .../scannable/ServiceInvocationCounter.java | 6 +- .../example/scannable_scoped/MyScope.java | 2 +- .../aop/aspectj/AfterAdviceBindingTests.java | 24 +- .../AfterReturningAdviceBindingTests.java | 44 +- .../AfterThrowingAdviceBindingTests.java | 30 +- .../aop/aspectj/AroundAdviceBindingTests.java | 28 +- .../AspectAndAdvicePrecedenceTests.java | 16 +- ...AspectJExpressionPointcutAdvisorTests.java | 2 +- .../BeanNamePointcutAtAspectTests.java | 5 +- .../aop/aspectj/BeanNamePointcutTests.java | 10 +- .../aop/aspectj/BeforeAdviceBindingTests.java | 26 +- .../DeclarationOrderIndependenceTests.java | 47 +- .../DeclareParentsDelegateRefTests.java | 8 +- .../aop/aspectj/DeclareParentsTests.java | 15 +- ...licitJPArgumentMatchingAtAspectJTests.java | 8 +- .../ImplicitJPArgumentMatchingTests.java | 8 +- .../aop/aspectj/OverloadedAdviceTests.java | 4 +- .../aop/aspectj/ProceedTests.java | 28 +- .../aspectj/PropertyDependentAspectTests.java | 8 +- .../SharedPointcutWithArgsMismatchTests.java | 4 +- .../SubtypeSensitiveMatchingTests.java | 20 +- .../aspectj/TargetPointcutSelectionTests.java | 14 +- ...tSelectionOnlyPointcutsAtAspectJTests.java | 32 +- ...sAndTargetSelectionOnlyPointcutsTests.java | 18 +- .../aop/aspectj/_TestTypes.java | 26 +- .../autoproxy/AnnotationBindingTests.java | 2 +- .../autoproxy/AnnotationPointcutTests.java | 2 +- .../AspectImplementingInterfaceTests.java | 6 +- ...xyCreatorAndLazyInitTargetSourceTests.java | 4 +- .../AspectJAutoProxyCreatorTests.java | 6 +- .../AtAspectJAfterThrowingTests.java | 2 +- .../AtAspectJAnnotationBindingTests.java | 6 +- .../aop/aspectj/autoproxy/_TestTypes.java | 10 +- .../autoproxy/benchmark/BenchmarkTests.java | 82 +-- .../autoproxy/spr3064/SPR3064Tests.java | 14 +- ...fterReturningGenericTypeMatchingTests.java | 4 +- .../GenericBridgeMethodMatchingTests.java | 6 +- .../GenericParameterMatchingTests.java | 20 +- .../AopNamespaceHandlerAdviceTypeTests.java | 4 +- .../AopNamespaceHandlerArgNamesTests.java | 4 +- ...NamespaceHandlerProxyTargetClassTests.java | 2 +- .../AopNamespaceHandlerReturningTests.java | 4 +- .../aop/config/AopNamespaceHandlerTests.java | 12 +- .../AopNamespaceHandlerThrowingTests.java | 4 +- .../MethodLocatingFactoryBeanTests.java | 28 +- .../aop/framework/AbstractAopProxyTests.java | 74 +-- .../aop/framework/CglibProxyTests.java | 13 +- .../aop/framework/JdkDynamicProxyTests.java | 16 +- .../aop/framework/ProxyFactoryBeanTests.java | 79 +-- .../aop/framework/_TestTypes.java | 12 +- .../AdvisorAdapterRegistrationTests.java | 1 + .../AdvisorAutoProxyCreatorTests.java | 21 +- .../autoproxy/AutoProxyCreatorTests.java | 3 +- .../BeanNameAutoProxyCreatorTests.java | 16 +- .../aop/scope/ScopedProxyTests.java | 23 +- .../target/CommonsPoolTargetSourceTests.java | 16 +- .../beans/BeanWithObjectProperty.java | 2 +- .../org/springframework/beans/Colour.java | 5 +- .../beans/DerivedTestBean.java | 2 +- .../beans/FieldAccessBean.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 49 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/Person.java | 8 +- .../beans/SerializablePerson.java | 8 +- .../org/springframework/beans/TestBean.java | 48 +- .../factory/AbstractBeanFactoryTests.java | 14 +- .../AbstractListableBeanFactoryTests.java | 2 +- .../beans/factory/DummyFactory.java | 13 +- .../springframework/beans/factory/HasMap.java | 34 +- .../beans/factory/LifecycleBean.java | 2 +- .../beans/factory/MustBeInitialized.java | 12 +- .../SingletonBeanFactoryLocatorTests.java | 12 +- .../beans/factory/access/TestBean.java | 16 +- .../beans/factory/config/SimpleMapScope.java | 14 +- .../CollectingReaderEventListener.java | 31 +- .../InjectAnnotationAutowireContextTests.java | 90 +-- ...alifierAnnotationAutowireContextTests.java | 106 ++-- .../beans/factory/xml/DependenciesBean.java | 14 +- .../LookupMethodWrappedByCglibProxyTests.java | 4 +- .../factory/xml/QualifierAnnotationTests.java | 28 +- ...aceHandlerWithExpressionLanguageTests.java | 2 +- .../factory/xml/XmlBeanFactoryTestTypes.java | 6 +- .../factory/xml/XmlBeanFactoryTests.java | 7 +- .../support/CustomNamespaceHandlerTests.java | 10 +- .../AnnotationCacheOperationSourceTests.java | 4 +- .../ConcurrentMapCacheManagerTests.java | 2 +- .../cache/config/AbstractAnnotationTests.java | 4 +- .../AnnotatedClassCacheableService.java | 6 +- .../cache/config/AnnotationTests.java | 2 +- .../cache/config/CacheableService.java | 8 +- .../cache/config/DefaultCacheableService.java | 4 +- .../interceptor/ExpressionEvalutatorTest.java | 9 +- .../springframework/context/ACATester.java | 8 +- .../AbstractApplicationContextTests.java | 10 +- .../context/BeanThatListens.java | 6 +- .../context/LifecycleContextBean.java | 18 +- .../springframework/context/TestListener.java | 4 +- .../ContextBeanFactoryReferenceTests.java | 12 +- .../ContextJndiBeanFactoryLocatorTests.java | 20 +- ...ntextSingletonBeanFactoryLocatorTests.java | 21 +- .../access/DefaultLocatorFactoryTests.java | 6 +- .../AbstractCircularImportDetectionTests.java | 6 +- ...notationConfigApplicationContextTests.java | 4 +- .../AnnotationProcessorPerformanceTests.java | 2 +- .../AnnotationScopeMetadataResolverTests.java | 3 +- .../AsmCircularImportDetectionTests.java | 4 +- .../BeanMethodPolymorphismTests.java | 6 +- .../ClassPathBeanDefinitionScannerTests.java | 2 +- ...PathFactoryBeanDefinitionScannerTests.java | 4 +- ...ommonAnnotationBeanPostProcessorTests.java | 16 +- .../ComponentScanAnnotationTests.java | 2 +- ...ScanParserBeanDefinitionDefaultsTests.java | 8 +- .../ComponentScanParserScopedProxyTests.java | 2 +- .../annotation/ComponentScanParserTests.java | 4 +- ...nParserWithUserDefinedStrategiesTests.java | 6 +- .../ConfigurationClassPostProcessorTests.java | 2 +- ...tionWithFactoryBeanAndAutowiringTests.java | 2 +- .../context/annotation/DoubleScanTests.java | 2 +- .../EnableAspectJAutoProxyTests.java | 2 +- .../FooServiceDependentConverter.java | 6 +- ...alidConfigurationClassDefinitionTests.java | 2 +- .../NestedConfigurationClassTests.java | 2 +- .../context/annotation/SimpleConfigTests.java | 6 +- .../context/annotation/SimpleScanTests.java | 8 +- .../context/annotation/Spr6602Tests.java | 2 +- .../componentscan/level1/Level1Config.java | 2 +- .../AutowiredConfigurationTests.java | 20 +- ...anAnnotationAttributePropagationTests.java | 4 +- .../BeanMethodQualificationTests.java | 14 +- ...figurationClassAspectIntegrationTests.java | 14 +- .../ConfigurationClassProcessingTests.java | 3 + ...assWithPlaceholderConfigurerBeanTests.java | 8 +- .../configuration/ImportResourceTests.java | 290 +++++----- .../annotation/configuration/ImportTests.java | 6 +- ...tedConfigurationClassEnhancementTests.java | 14 +- .../configuration/ScopingTests.java | 24 +- .../configuration/a/BaseConfig.java | 2 +- .../annotation/jsr330/SpringAtInjectTck.java | 5 +- .../annotation/role/ComponentWithRole.java | 2 +- .../annotation/role/ComponentWithoutRole.java | 2 +- .../annotation/spr8761/Spr8761Tests.java | 2 +- .../annotation4/FactoryMethodComponent.java | 5 +- .../context/annotation5/OtherFooDao.java | 6 +- .../context/conversionservice/Bar.java | 6 +- .../ConversionServiceContextConfigTests.java | 4 +- .../event/ApplicationContextEventTests.java | 14 +- .../EventPublicationInterceptorTests.java | 14 +- .../context/event/LifecycleEventTests.java | 6 +- .../ApplicationContextExpressionTests.java | 4 +- .../ApplicationContextLifecycleTests.java | 2 +- .../context/support/Assembler.java | 17 +- .../context/support/AutowiredService.java | 6 +- .../BeanFactoryPostProcessorTests.java | 20 +- .../ClassPathXmlApplicationContextTests.java | 7 +- .../ConversionServiceFactoryBeanTests.java | 16 +- .../DefaultLifecycleProcessorTests.java | 12 +- .../FactoryBeanAndApplicationListener.java | 6 +- .../GenericApplicationContextTests.java | 2 +- .../context/support/LifecycleTestBean.java | 2 +- .../context/support/Logic.java | 22 +- .../context/support/NoOpAdvice.java | 4 +- ...rtyResourceConfigurerIntegrationTests.java | 12 +- ...ertySourcesPlaceholderConfigurerTests.java | 4 +- .../ResourceBundleMessageSourceTests.java | 3 +- .../support/SimpleThreadScopeTest.java | 2 +- .../context/support/Spr7283Tests.java | 28 +- .../context/support/Spr7816Tests.java | 18 +- ...ticApplicationContextMulticasterTests.java | 14 +- .../StaticApplicationContextTests.java | 14 +- .../support/StaticMessageSourceTests.java | 14 +- .../context/support/TestIF.java | 6 +- .../LocalSlsbInvokerInterceptorTests.java | 4 +- ...StatelessSessionProxyFactoryBeanTests.java | 40 +- ...mpleRemoteSlsbInvokerInterceptorTests.java | 2 +- ...StatelessSessionProxyFactoryBeanTests.java | 64 +-- .../ejb/config/JeeNamespaceHandlerTests.java | 2 +- .../format/datetime/DateFormatterTests.java | 5 +- .../format/number/CurrencyFormatterTests.java | 4 +- .../format/number/NumberFormatterTests.java | 2 +- .../format/number/PercentFormatterTests.java | 2 +- ...tingConversionServiceFactoryBeanTests.java | 6 +- .../FormattingConversionServiceTests.java | 13 +- .../ReflectiveLoadTimeWeaverTests.java | 2 +- ...ceOverridingShadowingClassLoaderTests.java | 28 +- .../GlassFishLoadTimeWeaverTests.java | 6 +- .../org/springframework/jmx/IJmxTestBean.java | 2 +- .../org/springframework/jmx/JmxTestBean.java | 8 +- .../springframework/jmx/export/DateRange.java | 2 +- .../jmx/export/ExceptionOnInitBean.java | 2 +- .../export/MBeanExporterOperationsTests.java | 2 +- .../jmx/export/NotificationListenerTests.java | 2 +- .../AnnotationMetadataAssemblerTests.java | 2 +- .../export/annotation/AnnotationTestBean.java | 10 +- .../assembler/AbstractJmxAssemblerTests.java | 31 +- .../AbstractMetadataAssemblerTests.java | 16 +- .../assembler/IAdditionalTestMethods.java | 2 +- .../jmx/export/assembler/ICustomJmxBean.java | 2 +- ...aceBasedMBeanInfoAssemblerCustomTests.java | 6 +- ...aceBasedMBeanInfoAssemblerMappedTests.java | 8 +- ...ethodExclusionMBeanInfoAssemblerTests.java | 6 +- ...ameBasedMBeanInfoAssemblerMappedTests.java | 2 +- .../export/naming/KeyNamingStrategyTests.java | 2 +- .../ModelMBeanNotificationPublisherTests.java | 2 +- ...MBeanServerConnectionFactoryBeanTests.java | 8 +- .../support/MBeanServerFactoryBeanTests.java | 2 +- .../jndi/JndiObjectFactoryBeanTests.java | 2 +- .../jndi/JndiTemplateEditorTests.java | 8 +- .../jndi/JndiTemplateTests.java | 2 +- .../jndi/SimpleNamingContextTests.java | 2 +- .../mock/env/MockEnvironment.java | 2 +- .../mock/jndi/ExpectedLookupTemplate.java | 3 +- .../mock/jndi/SimpleNamingContext.java | 2 +- .../mock/jndi/SimpleNamingContextBuilder.java | 4 +- .../remoting/rmi/RmiSupportTests.java | 18 +- .../scheduling/TestMethodInvokingTask.java | 2 +- ...AsyncAnnotationBeanPostProcessorTests.java | 2 +- ...duledAnnotationBeanPostProcessorTests.java | 49 +- .../ThreadPoolTaskSchedulerTests.java | 6 +- ...tationDrivenBeanDefinitionParserTests.java | 2 +- .../ExecutorBeanDefinitionParserTests.java | 2 +- ...heduledTasksBeanDefinitionParserTests.java | 13 +- .../SchedulerBeanDefinitionParserTests.java | 2 +- .../scheduling/support/CronTriggerTests.java | 2 +- .../support/PeriodicTriggerTests.java | 2 +- .../scheduling/timer/TimerSupportTests.java | 8 +- .../timer/TimerTaskExecutorTests.java | 3 +- .../springframework/scripting/ScriptBean.java | 2 +- .../scripting/bsh/BshScriptFactoryTests.java | 6 +- .../config/ScriptingDefaultsTests.java | 2 +- .../groovy/GroovyAspectIntegrationTests.java | 2 +- .../groovy/GroovyClassLoadingTests.java | 6 +- .../groovy/GroovyScriptFactoryTests.java | 6 +- .../scripting/groovy/LogUserAdvice.java | 24 +- .../scripting/groovy/TestServiceImpl.java | 10 +- .../jruby/AdvisedJRubyScriptFactoryTests.java | 2 +- .../jruby/JRubyScriptFactoryTests.java | 6 +- .../scripting/jruby/WrapperAdder.java | 4 +- .../RefreshableScriptTargetSourceTests.java | 2 +- .../support/ResourceScriptSourceTests.java | 3 +- .../ScriptFactoryPostProcessorTests.java | 4 +- .../org/springframework/ui/ModelMapTests.java | 2 +- .../util/SerializationTestUtils.java | 8 +- .../DataBinderFieldAccessTests.java | 6 +- .../validation/DataBinderTests.java | 29 +- .../validation/ValidationUtilsTests.java | 8 +- .../BeanValidationPostProcessorTests.java | 2 +- .../beanvalidation/MethodValidationTests.java | 2 +- .../beanvalidation/ValidatorFactoryTests.java | 2 +- .../advice/CountingAfterReturningAdvice.java | 8 +- .../test/advice/CountingBeforeAdvice.java | 6 +- .../test/java/test/advice/MethodCounter.java | 2 +- .../java/test/advice/MyThrowsHandler.java | 6 +- .../advice/TimestampIntroductionAdvisor.java | 10 +- .../java/test/aspect/PerTargetAspect.java | 4 +- .../java/test/aspect/TwoAdviceAspect.java | 2 +- .../src/test/java/test/beans/CustomScope.java | 6 +- .../src/test/java/test/beans/Employee.java | 12 +- .../test/java/test/beans/FactoryMethods.java | 2 +- .../src/test/java/test/beans/ITestBean.java | 4 +- .../test/java/test/beans/NestedTestBean.java | 2 +- .../test/java/test/beans/SideEffectBean.java | 18 +- .../src/test/java/test/beans/TestBean.java | 4 +- .../java/test/interceptor/NopInterceptor.java | 12 +- .../SerializableNopInterceptor.java | 18 +- .../TimestampIntroductionInterceptor.java | 8 +- .../test/java/test/mixin/DefaultLockable.java | 8 +- .../src/test/java/test/mixin/LockMixin.java | 16 +- .../java/test/mixin/LockMixinAdvisor.java | 8 +- .../src/test/java/test/mixin/Lockable.java | 16 +- .../test/java/test/mixin/LockedException.java | 8 +- .../src/test/java/test/util/TimeStamped.java | 8 +- .../core/BridgeMethodResolver.java | 22 +- .../core/CollectionFactory.java | 48 +- .../springframework/core/ConcurrentMap.java | 3 +- .../core/ConfigurableObjectInputStream.java | 12 +- .../core/ConstantException.java | 2 +- .../org/springframework/core/Constants.java | 2 +- .../org/springframework/core/ControlFlow.java | 12 +- .../core/ControlFlowFactory.java | 6 +- .../org/springframework/core/Conventions.java | 30 +- .../org/springframework/core/ErrorCoded.java | 10 +- .../core/ExceptionDepthComparator.java | 4 +- .../core/GenericCollectionTypeResolver.java | 32 +- .../core/GenericTypeResolver.java | 209 ++----- .../springframework/core/MethodParameter.java | 73 ++- .../core/NamedInheritableThreadLocal.java | 2 +- .../core/NestedCheckedException.java | 4 +- .../core/NestedRuntimeException.java | 4 +- .../core/OverridingClassLoader.java | 10 +- .../core/ParameterNameDiscoverer.java | 4 +- .../PrioritizedParameterNameDiscoverer.java | 7 +- .../core/SmartClassLoader.java | 4 +- .../core/annotation/AnnotationAttributes.java | 26 +- .../core/convert/Property.java | 32 +- .../ConditionalGenericConverter.java | 9 + .../convert/converter/ConverterFactory.java | 1 - .../support/ArrayToArrayConverter.java | 16 +- .../support/ArrayToCollectionConverter.java | 3 +- .../CollectionToCollectionConverter.java | 3 +- .../support/DefaultConversionService.java | 2 +- .../support/GenericConversionService.java | 272 ++++++++- .../support/ObjectToCollectionConverter.java | 3 +- .../support/StringToCollectionConverter.java | 3 +- .../AbstractCachingLabeledEnumResolver.java | 3 +- .../enums/AbstractGenericLabeledEnum.java | 2 +- .../core/enums/AbstractLabeledEnum.java | 3 +- .../core/enums/LabeledEnum.java | 3 +- .../core/enums/LabeledEnumResolver.java | 3 +- .../core/enums/LetterCodedLabeledEnum.java | 5 +- .../core/enums/ShortCodedLabeledEnum.java | 5 +- .../core/enums/StaticLabeledEnum.java | 13 +- .../core/enums/StaticLabeledEnumResolver.java | 3 +- .../core/enums/StringCodedLabeledEnum.java | 3 +- .../core/env/EnvironmentCapable.java | 2 +- .../core/env/MapPropertySource.java | 2 +- .../core/env/SimpleCommandLineArgsParser.java | 2 +- .../core/io/ClassRelativeResourceLoader.java | 10 +- .../core/io/InputStreamSource.java | 10 +- .../core/io/ResourceEditor.java | 2 +- .../org/springframework/core/io/VfsUtils.java | 2 +- .../PathMatchingResourcePatternResolver.java | 6 +- .../io/support/PropertiesLoaderUtils.java | 4 +- .../support/ResourceArrayPropertyEditor.java | 2 +- .../core/serializer/DefaultDeserializer.java | 4 +- .../core/serializer/DefaultSerializer.java | 2 +- .../core/serializer/Deserializer.java | 2 +- .../core/serializer/Serializer.java | 2 +- .../core/serializer/package-info.java | 2 +- .../core/style/DefaultValueStyler.java | 24 +- .../core/style/StylerUtils.java | 4 +- .../core/style/ToStringCreator.java | 2 +- .../core/task/SyncTaskExecutor.java | 2 +- .../core/task/TaskExecutor.java | 2 +- .../core/type/StandardClassMetadata.java | 14 +- .../core/type/StandardMethodMetadata.java | 4 +- .../AnnotationAttributesReadingVisitor.java | 2 +- .../MethodMetadataReadingVisitor.java | 2 +- .../classreading/SimpleMetadataReader.java | 3 +- .../core/type/classreading/package-info.java | 4 +- .../AbstractClassTestingTypeFilter.java | 2 +- ...AbstractTypeHierarchyTraversingFilter.java | 6 +- .../type/filter/AnnotationTypeFilter.java | 2 +- .../core/type/filter/AspectJTypeFilter.java | 2 +- .../type/filter/AssignableTypeFilter.java | 14 +- .../java/org/springframework/util/Assert.java | 16 +- .../util/AutoPopulatingList.java | 4 +- .../util/CachingMapDecorator.java | 14 +- .../org/springframework/util/ClassUtils.java | 28 +- .../springframework/util/CollectionUtils.java | 32 +- .../util/CompositeIterator.java | 2 +- .../util/ConcurrencyThrottleSupport.java | 4 +- .../util/DefaultPropertiesPersister.java | 4 +- .../org/springframework/util/DigestUtils.java | 2 +- .../springframework/util/MethodInvoker.java | 22 +- .../org/springframework/util/NumberUtils.java | 4 +- .../org/springframework/util/ObjectUtils.java | 6 +- .../util/PropertiesPersister.java | 6 +- .../util/SystemPropertyUtils.java | 2 +- .../org/springframework/util/TypeUtils.java | 4 +- .../util/WeakReferenceMonitor.java | 10 +- .../util/comparator/ComparableComparator.java | 2 +- .../util/comparator/CompoundComparator.java | 8 +- .../util/comparator/InvertibleComparator.java | 2 +- .../util/comparator/NullSafeComparator.java | 14 +- .../util/xml/AbstractStaxXMLReader.java | 2 +- .../util/xml/DomContentHandler.java | 2 +- .../springframework/util/xml/DomUtils.java | 6 +- .../util/xml/SimpleNamespaceContext.java | 8 +- .../util/xml/StaxEventContentHandler.java | 16 +- .../util/xml/StaxEventXMLReader.java | 12 +- .../util/xml/StaxStreamContentHandler.java | 2 +- .../util/xml/StaxStreamXMLReader.java | 2 +- .../util/xml/XMLEventStreamReader.java | 12 +- .../util/xml/XMLEventStreamWriter.java | 6 +- .../org/springframework/beans/Colour.java | 5 +- .../org/springframework/beans/CustomEnum.java | 2 +- .../beans/DerivedTestBean.java | 2 +- .../springframework/beans/GenericBean.java | 36 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 48 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 49 +- .../core/AbstractControlFlowTests.java | 10 +- .../core/AbstractGenericsTests.java | 2 +- .../core/AttributeAccessorSupportTests.java | 2 +- .../core/BridgeMethodResolverTests.java | 24 +- .../core/CollectionFactoryTests.java | 1 + .../springframework/core/ConstantsTests.java | 2 +- .../core/ConventionsTests.java | 10 +- .../core/DefaultControlFlowTests.java | 2 +- .../core/ExceptionDepthComparatorTests.java | 159 +++--- .../GenericCollectionTypeResolverTests.java | 4 +- .../core/Jdk14ControlFlowTests.java | 2 +- ...ableTableParameterNameDiscovererTests.java | 32 +- .../core/NestedExceptionTests.java | 14 +- .../core/OrderComparatorTests.java | 4 +- ...ioritizedParameterNameDiscovererTests.java | 38 +- .../core/annotation/AnnotationUtilsTests.java | 2 +- .../core/convert/TypeDescriptorTests.java | 4 +- .../CollectionToCollectionConverterTests.java | 8 +- .../support/DefaultConversionTests.java | 28 +- .../support/MapToMapConverterTests.java | 1 + .../core/enums/LabeledEnumTests.java | 9 +- .../enums/StandAloneStaticLabeledEnum.java | 3 +- .../core/env/PropertySourceTests.java | 2 +- .../core/io/ResourceEditorTests.java | 2 +- ...hMatchingResourcePatternResolverTests.java | 14 +- .../ResourceArrayPropertyEditorTests.java | 5 +- .../support/ResourcePropertySourceTests.java | 2 +- .../SerializationConverterTests.java | 2 +- .../core/style/ToStringCreatorTests.java | 17 +- .../core/type/AnnotationMetadataTests.java | 8 +- .../core/type/AnnotationTypeFilterTests.java | 20 +- .../core/type/AspectJTypeFilterTests.java | 2 +- .../core/type/AssignableTypeFilterTests.java | 22 +- .../type/CachingMetadataReaderLeakTest.java | 16 +- .../core/type/ClassloadingAssertions.java | 6 +- .../springframework/stereotype/Component.java | 2 +- .../util/AntPathMatcherTests.java | 2 +- .../org/springframework/util/AssertTests.java | 12 +- .../util/AutoPopulatingListTests.java | 18 +- .../springframework/util/ClassUtilsTests.java | 27 +- .../util/CollectionUtilsTests.java | 60 +- .../util/CompositeIteratorTests.java | 20 +- .../util/DigestUtilsTests.java | 4 +- .../util/FileSystemUtilsTests.java | 26 +- .../util/LinkedMultiValueMapTests.java | 2 +- .../util/Log4jConfigurerTests.java | 8 +- .../util/MethodInvokerTests.java | 19 +- .../util/MockLog4jAppender.java | 24 +- .../util/PropertyPlaceholderHelperTests.java | 2 +- .../util/SerializationTestUtils.java | 27 +- .../util/SerializationUtilsTests.java | 4 +- .../springframework/util/StopWatchTests.java | 42 +- .../util/SystemPropertyUtilsTests.java | 2 +- .../AbstractStaxContentHandlerTestCase.java | 2 +- .../xml/AbstractStaxXMLReaderTestCase.java | 3 +- .../util/xml/DomContentHandlerTest.java | 4 +- .../util/xml/SimpleNamespaceContextTests.java | 16 +- .../xml/StaxEventContentHandlerTests.java | 4 +- .../util/xml/StaxEventXMLReaderTests.java | 2 +- .../util/xml/StaxResultTests.java | 4 +- .../util/xml/StaxSourceTests.java | 4 +- .../xml/StaxStreamContentHandlerTests.java | 4 +- .../util/xml/StaxStreamXMLReaderTests.java | 2 +- .../util/xml/StaxUtilsTest.java | 2 +- .../util/xml/TransformerUtilsTests.java | 2 +- .../util/xml/XMLEventStreamReaderTests.java | 4 +- .../util/xml/XMLEventStreamWriterTests.java | 2 +- .../expression/AccessException.java | 2 +- .../expression/BeanResolver.java | 1 - .../expression/ConstructorExecutor.java | 4 +- .../expression/EvaluationException.java | 12 +- .../expression/Expression.java | 32 +- .../expression/ExpressionException.java | 10 +- .../ExpressionInvocationTargetException.java | 2 +- .../expression/MethodFilter.java | 22 +- .../springframework/expression/Operation.java | 2 +- .../expression/OperatorOverloader.java | 2 +- .../expression/ParseException.java | 8 +- .../expression/ParserContext.java | 8 +- .../expression/PropertyAccessor.java | 6 +- .../expression/TypeComparator.java | 2 +- .../expression/TypedValue.java | 6 +- .../common/CompositeStringExpression.java | 20 +- .../expression/common/LiteralExpression.java | 12 +- .../common/TemplateParserContext.java | 2 +- .../expression/spel/ExpressionState.java | 32 +- .../spel/InternalParseException.java | 9 +- .../spel/SpelEvaluationException.java | 6 +- .../expression/spel/SpelMessage.java | 24 +- .../expression/spel/SpelParseException.java | 4 +- .../expression/spel/ast/AstUtils.java | 4 +- .../expression/spel/ast/BeanReference.java | 6 +- .../spel/ast/CompoundExpression.java | 3 +- .../spel/ast/ConstructorReference.java | 4 +- .../expression/spel/ast/FormatHelper.java | 10 +- .../spel/ast/FunctionReference.java | 2 +- .../expression/spel/ast/Indexer.java | 333 +++++------- .../expression/spel/ast/InlineList.java | 2 +- .../expression/spel/ast/IntLiteral.java | 2 +- .../expression/spel/ast/Literal.java | 8 +- .../expression/spel/ast/LongLiteral.java | 2 +- .../expression/spel/ast/OpLT.java | 2 +- .../expression/spel/ast/OpMultiply.java | 3 +- .../expression/spel/ast/Operator.java | 4 +- .../expression/spel/ast/OperatorBetween.java | 2 +- .../expression/spel/ast/OperatorPower.java | 4 +- .../expression/spel/ast/Projection.java | 8 +- .../spel/ast/PropertyOrFieldReference.java | 53 +- .../expression/spel/ast/RealLiteral.java | 2 +- .../expression/spel/ast/Selection.java | 14 +- .../expression/spel/ast/SpelNodeImpl.java | 10 +- .../expression/spel/ast/TypeCode.java | 2 +- .../expression/spel/ast/TypeReference.java | 2 +- .../spel/ast/VariableReference.java | 4 +- .../spel/standard/SpelExpression.java | 43 +- .../spel/standard/SpelExpressionParser.java | 2 +- .../expression/spel/standard/Token.java | 16 +- .../expression/spel/standard/TokenKind.java | 6 +- .../expression/spel/standard/Tokenizer.java | 59 +- .../spel/support/BooleanTypedValue.java | 2 +- .../spel/support/ReflectionHelper.java | 44 +- .../ReflectiveConstructorExecutor.java | 4 +- .../ReflectiveConstructorResolver.java | 18 +- .../support/ReflectiveMethodExecutor.java | 4 +- .../support/ReflectivePropertyAccessor.java | 128 +++-- .../support/StandardEvaluationContext.java | 32 +- .../spel/support/StandardTypeComparator.java | 8 +- .../spel/support/StandardTypeConverter.java | 4 +- .../spel/support/StandardTypeLocator.java | 6 +- .../spel/ArrayConstructorTests.java | 2 +- .../spel/ConstructorInvocationTests.java | 50 +- .../spel/DefaultComparatorUnitTests.java | 10 +- .../expression/spel/EvaluationTests.java | 514 ++---------------- .../spel/ExpressionLanguageScenarioTests.java | 26 +- .../expression/spel/ExpressionStateTests.java | 72 +-- ...essionTestsUsingCoreConversionService.java | 22 +- .../expression/spel/InProgressTests.java | 129 +++++ .../expression/spel/IndexingTests.java | 64 ++- .../expression/spel/ListTests.java | 2 +- .../spel/LiteralExpressionTests.java | 2 +- .../expression/spel/LiteralTests.java | 4 +- .../expression/spel/MapAccessTests.java | 17 +- .../spel/OperatorOverloaderTests.java | 12 +- .../expression/spel/OperatorTests.java | 76 +-- .../expression/spel/ParsingTests.java | 22 +- .../expression/spel/PerformanceTests.java | 10 +- .../spel/ScenariosForSpringSecurity.java | 30 +- .../spel/SelectionAndProjectionTests.java | 10 +- .../expression/spel/SetValueTests.java | 40 +- .../spel/SpelDocumentationTests.java | 175 +++--- .../expression/spel/SpelUtilities.java | 2 +- .../spel/StandardTypeLocatorTests.java | 8 +- .../spel/TemplateExpressionParsingTests.java | 36 +- .../spel/VariableAndFunctionTests.java | 4 +- .../spel/ast/FormatHelperTests.java | 6 +- .../PropertiesConversionSpelTests.java | 2 +- .../spel/standard/SpelParserTests.java | 84 +-- .../spel/support/ReflectionHelperTests.java | 96 ++-- .../spel/support/StandardComponentsTests.java | 8 +- .../spel/testresources/ArrayContainer.java | 6 +- .../spel/testresources/Company.java | 6 +- .../expression/spel/testresources/Fruit.java | 12 +- .../spel/testresources/Inventor.java | 18 +- .../expression/spel/testresources/Person.java | 8 +- .../spel/testresources/PlaceOfBirth.java | 14 +- .../spel/testresources/TestAddress.java | 2 +- .../spel/testresources/TestPerson.java | 4 +- .../TomcatInstrumentableClassLoader.java | 12 +- .../jdbc/BadSqlGrammarException.java | 2 +- .../jdbc/UncategorizedSQLException.java | 2 +- .../EmbeddedDatabaseBeanDefinitionParser.java | 2 +- ...nitializeDatabaseBeanDefinitionParser.java | 2 +- .../config/SortedResourcesFactoryBean.java | 2 +- .../core/ArgTypePreparedStatementSetter.java | 6 +- .../core/BatchPreparedStatementSetter.java | 4 +- .../jdbc/core/BatchUpdateUtils.java | 2 +- .../jdbc/core/BeanPropertyRowMapper.java | 2 +- .../jdbc/core/CallableStatementCreator.java | 10 +- .../core/CallableStatementCreatorFactory.java | 2 +- .../jdbc/core/JdbcOperations.java | 6 +- .../jdbc/core/JdbcTemplate.java | 35 +- .../jdbc/core/ParameterMapper.java | 4 +- .../ParameterizedPreparedStatementSetter.java | 2 +- .../jdbc/core/PreparedStatementCreator.java | 8 +- .../core/PreparedStatementCreatorFactory.java | 10 +- .../jdbc/core/PreparedStatementSetter.java | 2 +- .../jdbc/core/ResultSetExtractor.java | 2 +- .../core/ResultSetSupportingSqlParameter.java | 14 +- .../jdbc/core/RowCountCallbackHandler.java | 22 +- .../springframework/jdbc/core/RowMapper.java | 5 +- .../core/RowMapperResultSetExtractor.java | 8 +- .../jdbc/core/SingleColumnRowMapper.java | 10 +- .../jdbc/core/SqlInOutParameter.java | 6 +- .../jdbc/core/SqlOutParameter.java | 6 +- .../jdbc/core/SqlProvider.java | 6 +- .../jdbc/core/SqlReturnResultSet.java | 6 +- .../core/SqlRowSetResultSetExtractor.java | 9 +- .../jdbc/core/StatementCreatorUtils.java | 12 +- .../core/metadata/CallMetaDataContext.java | 8 +- .../metadata/CallMetaDataProviderFactory.java | 4 +- .../core/metadata/CallParameterMetaData.java | 2 +- .../metadata/DerbyTableMetaDataProvider.java | 2 +- .../metadata/GenericCallMetaDataProvider.java | 4 +- .../GenericTableMetaDataProvider.java | 4 +- .../metadata/HsqlTableMetaDataProvider.java | 2 +- .../metadata/OracleCallMetaDataProvider.java | 2 +- .../metadata/OracleTableMetaDataProvider.java | 8 +- .../PostgresCallMetaDataProvider.java | 2 +- .../core/metadata/TableMetaDataContext.java | 6 +- .../core/metadata/TableMetaDataProvider.java | 2 +- .../TableMetaDataProviderFactory.java | 2 +- .../BeanPropertySqlParameterSource.java | 4 +- .../NamedParameterBatchUpdateUtils.java | 2 +- .../NamedParameterJdbcDaoSupport.java | 4 +- .../NamedParameterJdbcTemplate.java | 2 +- .../core/namedparam/NamedParameterUtils.java | 10 +- .../namedparam/SqlParameterSourceUtils.java | 10 +- .../jdbc/core/namedparam/package-info.java | 4 +- .../jdbc/core/simple/AbstractJdbcCall.java | 12 +- .../jdbc/core/simple/AbstractJdbcInsert.java | 19 +- .../ParameterizedBeanPropertyRowMapper.java | 4 +- .../jdbc/core/simple/SimpleJdbcCall.java | 8 +- .../core/simple/SimpleJdbcCallOperations.java | 6 +- .../core/simple/SimpleJdbcDaoSupport.java | 6 +- .../simple/SimpleJdbcInsertOperations.java | 6 +- .../core/simple/SimpleJdbcOperations.java | 2 +- .../jdbc/core/simple/SimpleJdbcTemplate.java | 8 +- .../jdbc/core/simple/package-info.java | 10 +- ...bstractLobStreamingResultSetExtractor.java | 4 +- .../jdbc/core/support/SqlLobValue.java | 2 +- .../DataSourceTransactionManager.java | 2 +- .../jdbc/datasource/DelegatingDataSource.java | 6 +- .../JdbcTransactionObjectSupport.java | 2 +- .../LazyConnectionDataSourceProxy.java | 6 +- .../SingleConnectionDataSource.java | 6 +- .../jdbc/datasource/SmartDataSource.java | 4 +- .../TransactionAwareDataSourceProxy.java | 6 +- .../WebSphereDataSourceAdapter.java | 8 +- .../AbstractEmbeddedDatabaseConfigurer.java | 2 +- .../DerbyEmbeddedDatabaseConfigurer.java | 4 +- .../embedded/EmbeddedDatabaseBuilder.java | 2 +- .../embedded/EmbeddedDatabaseConfigurer.java | 4 +- .../embedded/EmbeddedDatabaseFactory.java | 2 +- .../embedded/EmbeddedDatabaseType.java | 4 +- .../HsqlEmbeddedDatabaseConfigurer.java | 2 +- .../SimpleDriverDataSourceFactory.java | 10 +- .../datasource/init/DatabasePopulator.java | 2 +- .../init/ResourceDatabasePopulator.java | 2 +- .../lookup/AbstractRoutingDataSource.java | 2 +- .../lookup/BeanFactoryDataSourceLookup.java | 8 +- .../lookup/JndiDataSourceLookup.java | 2 +- .../lookup/MapDataSourceLookup.java | 6 +- .../jdbc/object/BatchSqlUpdate.java | 4 +- .../jdbc/object/GenericSqlQuery.java | 23 +- .../jdbc/object/GenericStoredProcedure.java | 6 +- .../jdbc/object/MappingSqlQuery.java | 4 +- .../object/MappingSqlQueryWithParameters.java | 10 +- .../jdbc/object/RdbmsOperation.java | 16 +- .../springframework/jdbc/object/SqlCall.java | 2 +- .../jdbc/object/SqlFunction.java | 6 +- .../jdbc/object/SqlOperation.java | 2 +- .../springframework/jdbc/object/SqlQuery.java | 30 +- .../jdbc/object/SqlUpdate.java | 4 +- .../jdbc/object/StoredProcedure.java | 8 +- .../jdbc/object/UpdatableSqlQuery.java | 18 +- .../jdbc/object/package-info.java | 4 +- .../springframework/jdbc/package-info.java | 2 +- ...bstractFallbackSQLExceptionTranslator.java | 2 +- .../CustomSQLErrorCodesTranslation.java | 8 +- .../support/DatabaseMetaDataCallback.java | 12 +- .../support/DatabaseStartupValidator.java | 2 +- .../jdbc/support/JdbcAccessor.java | 2 +- .../jdbc/support/JdbcUtils.java | 8 +- .../jdbc/support/KeyHolder.java | 12 +- .../SQLErrorCodeSQLExceptionTranslator.java | 20 +- .../jdbc/support/SQLErrorCodes.java | 2 +- .../jdbc/support/SQLErrorCodesFactory.java | 6 +- .../SqlServerMaxValueIncrementer.java | 2 +- .../SybaseAnywhereMaxValueIncrementer.java | 2 +- .../SybaseMaxValueIncrementer.java | 4 +- .../support/incrementer/package-info.java | 2 +- .../jdbc/support/lob/LobCreatorUtils.java | 2 +- .../jdbc/support/lob/OracleLobHandler.java | 16 +- .../jdbc/support/lob/package-info.java | 2 +- .../nativejdbc/C3P0NativeJdbcExtractor.java | 2 +- .../CommonsDbcpNativeJdbcExtractor.java | 4 +- .../nativejdbc/JBossNativeJdbcExtractor.java | 8 +- .../WebLogicNativeJdbcExtractor.java | 4 +- .../WebSphereNativeJdbcExtractor.java | 4 +- .../jdbc/support/nativejdbc/package-info.java | 2 +- .../jdbc/support/package-info.java | 2 +- .../rowset/ResultSetWrappingSqlRowSet.java | 74 +-- .../ResultSetWrappingSqlRowSetMetaData.java | 4 +- .../jdbc/support/xml/Jdbc4SqlXmlHandler.java | 18 +- .../jdbc/support/xml/SqlXmlHandler.java | 8 +- .../support/xml/XmlBinaryStreamProvider.java | 2 +- .../xml/XmlCharacterStreamProvider.java | 2 +- .../jdbc/support/xml/XmlResultProvider.java | 2 +- .../org/springframework/beans/Colour.java | 5 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 6 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 48 +- .../jdbc/AbstractJdbcTests.java | 10 +- .../InitializeDatabaseIntegrationTests.java | 10 +- .../config/JdbcNamespaceIntegrationTests.java | 7 +- .../jdbc/core/AbstractRowMapperTests.java | 2 +- .../jdbc/core/BeanPropertyRowMapperTests.java | 49 +- .../jdbc/core/JdbcTemplateQueryTests.java | 4 +- .../jdbc/core/JdbcTemplateTests.java | 47 +- .../jdbc/core/RowMapperTests.java | 12 +- .../jdbc/core/StatementCreatorUtilsTests.java | 2 +- .../BeanPropertySqlParameterSourceTests.java | 4 +- .../MapSqlParameterSourceTests.java | 2 +- .../NamedParameterJdbcTemplateTests.java | 41 +- .../namedparam/NamedParameterQueryTests.java | 32 +- .../namedparam/NamedParameterUtilsTests.java | 6 +- ...rameterizedBeanPropertyRowMapperTests.java | 6 +- .../jdbc/core/simple/SimpleJdbcCallTests.java | 2 +- .../core/simple/SimpleJdbcInsertTests.java | 6 +- .../core/simple/SimpleJdbcTemplateTests.java | 26 +- .../simple/TableMetaDataContextTests.java | 4 +- .../JdbcBeanDefinitionReaderTests.java | 2 +- .../core/support/JdbcDaoSupportTests.java | 12 +- .../jdbc/core/support/LobSupportTests.java | 52 +- .../jdbc/core/support/SqlLobValueTests.java | 112 ++-- .../jdbc/core/test/AbstractPerson.java | 2 +- .../jdbc/core/test/ConcretePerson.java | 2 +- .../jdbc/core/test/ExtendedPerson.java | 2 +- .../jdbc/core/test/Person.java | 2 +- .../jdbc/core/test/SpacePerson.java | 2 +- .../DataSourceJtaTransactionTests.java | 6 +- .../DataSourceTransactionManagerTests.java | 12 +- .../DriverManagerDataSourceTests.java | 2 +- ...UserCredentialsDataSourceAdapterTests.java | 2 +- .../EmbeddedDatabaseBuilderTests.java | 4 +- .../EmbeddedDatabaseFactoryTests.java | 10 +- .../BeanFactoryDataSourceLookupTests.java | 4 +- .../lookup/JndiDataSourceLookupTests.java | 9 +- .../lookup/MapDataSourceLookupTests.java | 6 +- .../datasource/lookup/StubDataSource.java | 4 +- .../jdbc/object/BatchSqlUpdateTests.java | 2 +- .../jdbc/object/CustomerMapper.java | 2 +- .../jdbc/object/GenericSqlQueryTests.java | 27 +- .../object/GenericStoredProcedureTests.java | 15 +- .../jdbc/object/RdbmsOperationTests.java | 12 +- .../jdbc/object/SqlQueryTests.java | 33 +- .../jdbc/object/SqlUpdateTests.java | 10 +- .../jdbc/object/StoredProcedureTests.java | 144 ++--- .../support/CustomErrorCodeException.java | 6 +- ...mSQLExceptionTranslatorRegistrarTests.java | 3 - .../support/CustomSqlExceptionTranslator.java | 2 +- .../DataFieldMaxValueIncrementerTests.java | 8 +- .../jdbc/support/DefaultLobHandlerTests.java | 8 +- .../jdbc/support/KeyHolderTests.java | 34 +- .../support/NativeJdbcExtractorTests.java | 2 +- ...LErrorCodeSQLExceptionTranslatorTests.java | 20 +- .../support/SQLErrorCodesFactoryTests.java | 41 +- .../SQLExceptionCustomTranslatorTests.java | 4 +- .../SQLStateExceptionTranslatorTests.java | 29 +- .../SQLStateSQLExceptionTranslatorTests.java | 2 +- .../rowset/ResultSetWrappingRowSetTests.java | 2 +- .../AbstractListenerContainerParser.java | 8 +- .../config/JcaListenerContainerParser.java | 4 +- .../config/JmsListenerContainerParser.java | 10 +- .../jms/config/JmsNamespaceHandler.java | 6 +- .../connection/CachingConnectionFactory.java | 2 +- .../connection/ChainedExceptionListener.java | 2 +- .../connection/ConnectionFactoryUtils.java | 2 +- .../jms/connection/JmsResourceHolder.java | 2 +- .../connection/SingleConnectionFactory.java | 4 +- ...ransactionAwareConnectionFactoryProxy.java | 6 +- .../jms/core/JmsOperations.java | 2 +- .../jms/core/JmsTemplate102.java | 6 +- .../jms/core/MessageCreator.java | 4 +- .../jms/core/ProducerCallback.java | 2 +- .../jms/core/SessionCallback.java | 4 +- .../jms/core/support/JmsGatewaySupport.java | 18 +- ...stractPollingMessageListenerContainer.java | 1 - .../DefaultMessageListenerContainer.java | 4 +- .../adapter/MessageListenerAdapter.java | 4 +- .../DefaultJmsActivationSpecFactory.java | 4 +- .../StandardJmsActivationSpecFactory.java | 10 +- .../remoting/JmsInvokerClientInterceptor.java | 2 +- .../remoting/JmsInvokerProxyFactoryBean.java | 6 +- .../jms/remoting/package-info.java | 2 +- .../jms/support/JmsAccessor.java | 2 +- .../springframework/jms/support/JmsUtils.java | 2 +- .../MappingJacksonMessageConverter.java | 2 +- .../MarshallingMessageConverter.java | 2 +- .../converter/SimpleMessageConverter.java | 10 +- .../BeanFactoryDestinationResolver.java | 4 +- .../destination/DestinationResolver.java | 2 +- .../destination/JndiDestinationResolver.java | 2 +- .../org/springframework/beans/Colour.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- .../jms/StubConnectionFactory.java | 8 +- .../jms/config/JmsNamespaceHandlerTests.java | 28 +- .../JmsTransactionManagerTests.java | 2 +- .../SingleConnectionFactoryTests.java | 2 +- .../jms/core/JmsTemplate102Tests.java | 2 +- .../jms/core/JmsTemplateTests.java | 2 +- .../core/support/JmsGatewaySupportTests.java | 6 +- ...AbstractMessageListenerContainerTests.java | 2 +- .../SimpleMessageListenerContainerTests.java | 2 +- .../MessageListenerAdapter102Tests.java | 4 +- .../adapter/MessageListenerAdapterTests.java | 3 +- ...msTextMessageReturningMessageDelegate.java | 8 +- .../DefaultJmsActivationSpecFactoryTests.java | 2 +- .../jms/remoting/JmsInvokerTests.java | 2 +- .../jms/support/JmsAccessorTests.java | 2 +- .../SimpleMessageConverter102Tests.java | 2 +- .../support/SimpleMessageConverterTests.java | 2 +- .../MappingJacksonMessageConverterTests.java | 2 +- .../MarshallingMessageConverterTests.java | 2 +- .../DynamicDestinationResolverTests.java | 2 +- .../JmsDestinationAccessorTests.java | 2 +- .../JndiDestinationResolverTests.java | 2 +- .../CallCountingTransactionManager.java | 2 +- .../LocalSessionFactoryBuilder.java | 1 - .../support/OpenSessionInViewInterceptor.java | 5 +- .../web/DelegatingServletInputStream.java | 2 +- .../web/DelegatingServletOutputStream.java | 2 +- .../mock/web/MockFilterConfig.java | 2 +- .../mock/web/MockHttpServletRequest.java | 1 + .../mock/web/MockHttpServletResponse.java | 6 +- .../mock/web/MockHttpSession.java | 8 +- .../mock/web/MockServletConfig.java | 2 +- .../mock/web/PassThroughFilterChain.java | 2 +- ...jectOptimisticLockingFailureException.java | 14 +- .../orm/ObjectRetrievalFailureException.java | 12 +- .../AbstractSessionFactoryBean.java | 2 +- .../orm/hibernate3/HibernateAccessor.java | 2 +- .../HibernateExceptionTranslator.java | 2 +- .../orm/hibernate3/HibernateInterceptor.java | 2 +- .../hibernate3/HibernateJdbcException.java | 2 +- ...ernateObjectRetrievalFailureException.java | 2 +- .../orm/hibernate3/HibernateOperations.java | 54 +- ...nateOptimisticLockingFailureException.java | 2 +- .../hibernate3/HibernateQueryException.java | 8 +- .../hibernate3/HibernateSystemException.java | 8 +- .../orm/hibernate3/HibernateTemplate.java | 106 ++-- .../HibernateTransactionManager.java | 2 +- .../hibernate3/LocalRegionFactoryProxy.java | 2 +- .../SpringSessionSynchronization.java | 2 +- .../hibernate3/SpringTransactionFactory.java | 2 +- .../AnnotationSessionFactoryBean.java | 8 +- .../hibernate3/support/AbstractLobType.java | 7 +- .../hibernate3/support/BlobByteArrayType.java | 4 +- .../support/BlobSerializableType.java | 4 +- .../hibernate3/support/BlobStringType.java | 4 +- .../hibernate3/support/ClobStringType.java | 10 +- .../support/HibernateDaoSupport.java | 2 +- .../IdTransferringMergeEventListener.java | 3 +- .../support/ScopedBeanInterceptor.java | 2 +- .../orm/ibatis/SqlMapClientFactoryBean.java | 4 +- .../orm/ibatis/SqlMapClientOperations.java | 11 +- .../orm/ibatis/SqlMapClientTemplate.java | 22 +- .../orm/ibatis/package-info.java | 2 +- .../support/AbstractLobTypeHandler.java | 2 +- .../support/SqlMapClientDaoSupport.java | 2 +- .../orm/jdo/DefaultJdoDialect.java | 2 +- .../springframework/orm/jdo/JdoAccessor.java | 2 +- .../springframework/orm/jdo/JdoDialect.java | 2 +- .../orm/jdo/JdoInterceptor.java | 2 +- .../orm/jdo/JdoOperations.java | 16 +- .../orm/jdo/JdoSystemException.java | 8 +- .../springframework/orm/jdo/JdoTemplate.java | 50 +- .../orm/jdo/JdoUsageException.java | 6 +- .../LocalPersistenceManagerFactoryBean.java | 4 +- .../jdo/PersistenceManagerFactoryUtils.java | 2 +- ...onAwarePersistenceManagerFactoryProxy.java | 6 +- ...enPersistenceManagerInViewInterceptor.java | 2 +- .../SpringPersistenceManagerProxyBean.java | 2 +- .../jpa/AbstractEntityManagerFactoryBean.java | 6 +- .../orm/jpa/EntityManagerFactoryAccessor.java | 2 +- .../orm/jpa/EntityManagerFactoryInfo.java | 4 +- .../orm/jpa/EntityManagerFactoryUtils.java | 8 +- .../orm/jpa/ExtendedEntityManagerCreator.java | 8 +- .../springframework/orm/jpa/JpaDialect.java | 2 +- .../orm/jpa/JpaInterceptor.java | 2 +- .../orm/jpa/JpaOperations.java | 16 +- .../orm/jpa/JpaSystemException.java | 2 +- .../springframework/orm/jpa/JpaTemplate.java | 43 +- .../orm/jpa/JpaTransactionManager.java | 2 +- .../orm/jpa/SharedEntityManagerCreator.java | 22 +- .../ClassFileTransformerAdapter.java | 6 +- .../DefaultPersistenceUnitManager.java | 7 +- .../MutablePersistenceUnitInfo.java | 2 +- .../PersistenceUnitReader.java | 20 +- .../jpa/support/SharedEntityManagerBean.java | 4 +- .../jpa/vendor/AbstractJpaVendorAdapter.java | 2 +- .../orm/jpa/vendor/Database.java | 2 +- .../vendor/EclipseLinkJpaVendorAdapter.java | 4 +- .../orm/jpa/vendor/HibernateJpaDialect.java | 2 +- .../HibernateJpaSessionFactoryBean.java | 2 +- .../jpa/vendor/HibernateJpaVendorAdapter.java | 6 +- .../orm/jpa/vendor/OpenJpaDialect.java | 2 +- .../orm/jpa/vendor/OpenJpaVendorAdapter.java | 2 +- .../orm/jpa/vendor/TopLinkJpaDialect.java | 2 +- .../jpa/vendor/TopLinkJpaVendorAdapter.java | 2 +- .../org/springframework/beans/Colour.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- .../mock/jndi/ExpectedLookupTemplate.java | 3 +- .../mock/jndi/SimpleNamingContext.java | 2 +- .../mock/jndi/SimpleNamingContextBuilder.java | 4 +- .../hibernate3/HibernateInterceptorTests.java | 2 +- .../HibernateJtaTransactionTests.java | 3 +- .../hibernate3/HibernateTemplateTests.java | 2 +- .../HibernateTransactionManagerTests.java | 4 +- .../LocalSessionFactoryBeanTests.java | 2 +- .../support/HibernateDaoSupportTests.java | 8 +- .../orm/hibernate3/support/LobTypeTests.java | 2 +- .../support/ScopedBeanInterceptorTests.java | 2 +- .../orm/ibatis/SqlMapClientTests.java | 2 +- .../ibatis/support/LobTypeHandlerTests.java | 2 +- .../orm/jdo/JdoInterceptorTests.java | 6 +- .../orm/jdo/JdoTemplateTests.java | 2 +- .../orm/jdo/JdoTransactionManagerTests.java | 2 +- .../LocalPersistenceManagerFactoryTests.java | 2 +- .../orm/jdo/support/JdoDaoSupportTests.java | 8 +- .../OpenPersistenceManagerInViewTests.java | 2 +- ...rEntityManagerFactoryIntegrationTests.java | 36 +- ...AbstractEntityManagerFactoryBeanTests.java | 4 +- ...nManagedEntityManagerIntegrationTests.java | 49 +- ...rManagedEntityManagerIntegrationTests.java | 45 +- .../orm/jpa/DefaultJpaDialectTests.java | 10 +- .../EntityManagerFactoryBeanSupportTests.java | 12 +- .../jpa/EntityManagerFactoryUtilsTests.java | 10 +- .../orm/jpa/JpaInterceptorTests.java | 14 +- .../orm/jpa/JpaTemplateTests.java | 2 +- .../orm/jpa/JpaTransactionManagerTests.java | 2 +- ...ontainerEntityManagerFactoryBeanTests.java | 2 +- .../LocalEntityManagerFactoryBeanTests.java | 26 +- .../orm/jpa/domain/DriversLicense.java | 8 +- .../orm/jpa/domain/Person.java | 6 +- ...kEntityManagerFactoryIntegrationTests.java | 2 +- ...eEntityManagerFactoryIntegrationTests.java | 2 +- ...aEntityManagerFactoryIntegrationTests.java | 2 +- ...oryWithAspectJWeavingIntegrationTests.java | 4 +- .../PersistenceXmlParsingTests.java | 4 +- .../orm/jpa/support/JpaDaoSupportTests.java | 8 +- .../support/OpenEntityManagerInViewTests.java | 2 + .../support/PersistenceInjectionTests.java | 24 +- .../SharedEntityManagerFactoryTests.java | 4 +- ...kEntityManagerFactoryIntegrationTests.java | 2 +- ...sactionalDataSourceSpringContextTests.java | 3 +- .../test/ConditionalTestCase.java | 2 +- .../test/annotation/ProfileValueUtils.java | 2 +- .../test/jdbc/JdbcTestUtils.java | 2 +- .../test/jpa/AbstractJpaTests.java | 36 +- .../OrmXmlOverridingShadowingClassLoader.java | 2 +- .../util/SerializationTestUtils.java | 2 +- .../oxm/GenericUnmarshaller.java | 2 +- .../org/springframework/oxm/Marshaller.java | 2 +- .../org/springframework/oxm/Unmarshaller.java | 2 +- .../oxm/castor/CastorMarshaller.java | 10 +- .../CastorMarshallerBeanDefinitionParser.java | 4 +- .../Jaxb2MarshallerBeanDefinitionParser.java | 10 +- .../JibxMarshallerBeanDefinitionParser.java | 4 +- ...mlBeansMarshallerBeanDefinitionParser.java | 2 +- .../oxm/jaxb/Jaxb2Marshaller.java | 2 +- .../oxm/mime/MimeMarshaller.java | 2 +- .../oxm/mime/MimeUnmarshaller.java | 2 +- .../oxm/support/AbstractMarshaller.java | 2 +- .../oxm/support/MarshallingSource.java | 2 +- .../oxm/support/SaxResourceUtils.java | 2 +- .../oxm/xmlbeans/XmlBeansMarshaller.java | 9 +- .../oxm/xmlbeans/XmlOptionsFactoryBean.java | 2 +- .../oxm/xstream/XStreamMarshaller.java | 22 +- .../oxm/xstream/XStreamUtils.java | 2 +- .../oxm/AbstractMarshallerTests.java | 2 +- .../oxm/AbstractUnmarshallerTests.java | 2 +- .../oxm/castor/CastorMarshallerTests.java | 3 +- .../oxm/castor/CastorObject.java | 2 +- .../oxm/castor/CastorUnmarshallerTests.java | 8 +- .../oxm/config/OxmNamespaceHandlerTests.java | 6 +- .../oxm/jaxb/Jaxb2MarshallerTests.java | 7 +- .../oxm/jaxb/Jaxb2UnmarshallerTests.java | 2 +- .../springframework/oxm/jaxb/Primitives.java | 2 +- .../oxm/jaxb/StandardClasses.java | 4 +- .../oxm/jibx/JibxMarshallerTests.java | 2 +- .../oxm/xmlbeans/XmlBeansMarshallerTests.java | 2 +- .../xmlbeans/XmlBeansUnmarshallerTests.java | 2 +- .../xmlbeans/XmlOptionsFactoryBeanTests.java | 2 +- .../springframework/oxm/xstream/Flight.java | 2 +- .../oxm/xstream/XStreamMarshallerTests.java | 6 +- .../oxm/xstream/XStreamUnmarshallerTests.java | 2 +- .../tiles/ComponentControllerSupport.java | 2 +- .../servlet/view/tiles/TilesConfigurer.java | 6 +- .../web/servlet/view/tiles/TilesView.java | 2 +- .../struts/ActionServletAwareProcessor.java | 2 +- .../web/struts/ActionSupport.java | 2 +- .../struts/AutowiringRequestProcessor.java | 2 +- .../AutowiringTilesRequestProcessor.java | 2 +- .../web/struts/ContextLoaderPlugIn.java | 12 +- .../web/struts/DelegatingActionProxy.java | 4 +- .../web/struts/DelegatingActionUtils.java | 2 +- .../struts/DelegatingRequestProcessor.java | 6 +- .../DelegatingTilesRequestProcessor.java | 6 +- .../web/struts/DispatchActionSupport.java | 2 +- .../struts/LookupDispatchActionSupport.java | 2 +- .../struts/MappingDispatchActionSupport.java | 2 +- .../web/struts/SpringBindingActionForm.java | 9 +- .../web/struts/package-info.java | 2 +- .../view/tiles/TestComponentController.java | 6 +- .../servlet/view/tiles/TilesViewTests.java | 2 +- .../web/struts/StrutsSupportTests.java | 2 +- .../web/struts/TestAction.java | 2 +- .../mock/env/MockEnvironment.java | 2 +- .../mock/jndi/ExpectedLookupTemplate.java | 11 +- .../mock/jndi/SimpleNamingContext.java | 2 +- .../mock/jndi/SimpleNamingContextBuilder.java | 4 +- .../mock/jndi/package-info.java | 2 +- .../web/DelegatingServletInputStream.java | 2 +- .../web/DelegatingServletOutputStream.java | 2 +- .../mock/web/MockBodyContent.java | 2 +- .../mock/web/MockExpressionEvaluator.java | 4 +- .../mock/web/MockFilterConfig.java | 2 +- .../mock/web/MockHttpServletRequest.java | 2 + .../mock/web/MockHttpServletResponse.java | 10 +- .../mock/web/MockHttpSession.java | 10 +- .../mock/web/MockJspWriter.java | 2 +- .../mock/web/MockPageContext.java | 2 +- .../mock/web/MockServletConfig.java | 2 +- .../mock/web/PassThroughFilterChain.java | 2 +- .../mock/web/package-info.java | 2 +- .../mock/web/portlet/MockActionResponse.java | 2 +- .../mock/web/portlet/MockBaseURL.java | 2 +- .../web/portlet/MockClientDataRequest.java | 4 +- .../mock/web/portlet/MockEvent.java | 4 +- .../mock/web/portlet/MockEventRequest.java | 2 +- .../mock/web/portlet/MockMimeResponse.java | 2 +- .../mock/web/portlet/MockPortalContext.java | 2 +- .../mock/web/portlet/MockPortletConfig.java | 8 +- .../mock/web/portlet/MockPortletContext.java | 10 +- .../web/portlet/MockPortletPreferences.java | 2 +- .../mock/web/portlet/MockPortletRequest.java | 8 +- .../portlet/MockPortletRequestDispatcher.java | 2 +- .../mock/web/portlet/MockPortletResponse.java | 2 +- .../mock/web/portlet/MockPortletSession.java | 4 +- .../mock/web/portlet/MockPortletURL.java | 2 +- .../mock/web/portlet/MockRenderResponse.java | 2 +- .../mock/web/portlet/MockResourceRequest.java | 2 +- .../mock/web/portlet/MockResourceURL.java | 2 +- .../web/portlet/MockStateAwareResponse.java | 4 +- .../ServletWrappingPortletContext.java | 2 +- .../mock/web/portlet/package-info.java | 2 +- .../springframework/test/AssertThrows.java | 2 +- .../test/ConditionalTestCase.java | 2 +- .../test/annotation/DirtiesContext.java | 2 +- .../test/annotation/ExpectedException.java | 4 +- .../test/annotation/IfProfileValue.java | 6 +- .../test/annotation/NotTransactional.java | 2 +- .../ProfileValueSourceConfiguration.java | 4 +- .../test/annotation/ProfileValueUtils.java | 12 +- .../test/annotation/Repeat.java | 2 +- .../test/annotation/Rollback.java | 2 +- .../test/annotation/Timed.java | 2 +- .../test/context/ActiveProfiles.java | 8 +- .../test/context/ContextConfiguration.java | 30 +- .../test/context/ContextLoader.java | 2 +- .../test/context/ContextLoaderUtils.java | 6 +- .../context/MergedContextConfiguration.java | 8 +- .../test/context/SmartContextLoader.java | 2 +- .../test/context/TestContext.java | 2 +- .../test/context/TestContextManager.java | 4 +- .../test/context/TestExecutionListener.java | 12 +- .../test/context/TestExecutionListeners.java | 8 +- .../AbstractJUnit38SpringContextTests.java | 14 +- .../AbstractJUnit4SpringContextTests.java | 3 +- ...TransactionalJUnit4SpringContextTests.java | 3 +- .../junit4/SpringJUnit4ClassRunner.java | 2 +- .../RunAfterTestClassCallbacks.java | 4 +- .../RunBeforeTestClassCallbacks.java | 4 +- .../RunBeforeTestMethodCallbacks.java | 4 +- .../statements/SpringFailOnTimeout.java | 4 +- .../junit4/statements/SpringRepeat.java | 4 +- .../test/context/package-info.java | 2 +- .../AbstractTestExecutionListener.java | 2 +- .../AnnotationConfigContextLoader.java | 6 +- .../support/DelegatingSmartContextLoader.java | 206 ++++++- ...endencyInjectionTestExecutionListener.java | 2 +- .../DirtiesContextTestExecutionListener.java | 2 +- .../AbstractTestNGSpringContextTests.java | 16 +- .../context/transaction/AfterTransaction.java | 2 +- .../transaction/BeforeTransaction.java | 2 +- .../test/jdbc/JdbcTestUtils.java | 100 +--- .../test/jpa/AbstractAspectjJpaTests.java | 2 +- .../test/jpa/AbstractJpaTests.java | 32 +- .../OrmXmlOverridingShadowingClassLoader.java | 2 +- .../test/util/ReflectionTestUtils.java | 40 +- .../test/web/AbstractModelAndViewTests.java | 6 +- .../test/web/ModelAndViewAssert.java | 48 +- .../org/springframework/beans/Colour.java | 2 +- .../org/springframework/beans/Employee.java | 12 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 4 +- .../web/MockHttpServletResponseTests.java | 10 +- .../mock/web/MockPageContextTests.java | 2 +- ...stractSpr3350SingleSpringContextTests.java | 4 +- ...DependencyInjectionSpringContextTests.java | 2 +- .../test/Spr3264SingleSpringContextTests.java | 2 +- ...alueAnnotationAwareTransactionalTests.java | 2 +- .../annotation/ProfileValueUtilsTests.java | 2 +- .../ClassLevelDirtiesContextTests.java | 4 +- .../test/context/ContextLoaderUtilsTests.java | 2 +- .../MergedContextConfigurationTests.java | 5 +- .../SpringRunnerContextCacheTests.java | 6 +- .../context/TestContextCacheKeyTests.java | 4 +- .../test/context/TestContextManagerTests.java | 6 +- .../context/TestExecutionListenersTests.java | 4 +- ...dingPropertiesAndInheritedLoaderTests.java | 2 +- ...ithPropertiesExtendingPropertiesTests.java | 2 +- ...ransactionalJUnit38SpringContextTests.java | 2 +- .../FailingBeforeAndAfterMethodsTests.java | 2 +- ...ProfileValueJUnit38SpringContextTests.java | 2 +- .../RepeatedJUnit38SpringContextTests.java | 2 +- ...athSpringJUnit4ClassRunnerAppCtxTests.java | 2 +- ...bstractTransactionalSpringRunnerTests.java | 2 +- ...ssLevelTransactionalSpringRunnerTests.java | 2 +- ...rceSpringJUnit4ClassRunnerAppCtxTests.java | 2 +- ...TransactionalJUnit4SpringContextTests.java | 2 +- ...ltContextLoaderClassSpringRunnerTests.java | 2 +- .../EnabledAndIgnoredSpringRunnerTests.java | 2 +- .../ExpectedExceptionSpringRunnerTests.java | 2 +- .../FailingBeforeAndAfterMethodsTests.java | 2 +- ...edProfileValueSourceSpringRunnerTests.java | 2 +- ...odLevelTransactionalSpringRunnerTests.java | 2 +- ...cesSpringJUnit4ClassRunnerAppCtxTests.java | 2 +- ...sedSpringJUnit4ClassRunnerAppCtxTests.java | 2 +- ...athSpringJUnit4ClassRunnerAppCtxTests.java | 2 +- .../junit4/RepeatedSpringRunnerTests.java | 2 +- .../SpringJUnit47ClassRunnerRuleTests.java | 2 +- .../SpringJUnit4ClassRunnerAppCtxTests.java | 8 +- .../junit4/SpringJUnit4ClassRunnerTests.java | 2 +- .../junit4/SpringJUnit4SuiteTests.java | 6 +- ...andardJUnit4FeaturesSpringRunnerTests.java | 2 +- .../junit4/TimedSpringRunnerTests.java | 2 +- .../TimedTransactionalSpringRunnerTests.java | 2 +- .../context/junit4/TrackingRunListener.java | 2 +- ...figSpringJUnit4ClassRunnerAppCtxTests.java | 6 +- ...ingDefaultConfigClassesInheritedTests.java | 4 +- ...ngExplicitConfigClassesInheritedTests.java | 4 +- .../DefaultConfigClassesBaseTests.java | 4 +- .../DefaultConfigClassesInheritedTests.java | 4 +- ...ingDefaultConfigClassesInheritedTests.java | 2 +- ...ngExplicitConfigClassesInheritedTests.java | 2 +- ...ltLoaderDefaultConfigClassesBaseTests.java | 2 +- ...derDefaultConfigClassesInheritedTests.java | 2 +- ...tLoaderExplicitConfigClassesBaseTests.java | 2 +- ...erExplicitConfigClassesInheritedTests.java | 2 +- .../ExplicitConfigClassesBaseTests.java | 4 +- .../ExplicitConfigClassesInheritedTests.java | 4 +- .../annotation/PojoAndStringConfig.java | 4 +- .../orm/HibernateSessionFlushingTests.java | 2 +- .../junit4/orm/domain/DriversLicense.java | 2 +- .../context/junit4/orm/domain/Person.java | 2 +- .../orm/repository/PersonRepository.java | 2 +- .../hibernate/HibernatePersonRepository.java | 2 +- .../junit4/orm/service/PersonService.java | 2 +- .../service/impl/StandardPersonService.java | 2 +- .../junit4/spr4868/Jsr250LifecycleTests.java | 10 +- .../context/junit4/spr4868/LifecycleBean.java | 2 +- .../spr6128/AutowiredQualifierTests.java | 2 +- ...ransactionalAnnotatedConfigClassTests.java | 2 +- .../spr9051/AtBeanLiteModeScopeTests.java | 2 +- .../context/junit4/spr9051/LifecycleBean.java | 2 +- ...edConfigClassWithAtConfigurationTests.java | 4 +- ...figClassesWithoutAtConfigurationTests.java | 12 +- .../AnnotatedFooConfigInnerClassTestCase.java | 2 +- .../AnnotationConfigContextLoaderTests.java | 2 +- ...ontextConfigurationInnerClassTestCase.java | 2 +- ...ustomizedGenericXmlContextLoaderTests.java | 2 +- .../DelegatingSmartContextLoaderTests.java | 2 +- .../FinalConfigInnerClassTestCase.java | 2 +- ...pleStaticConfigurationClassesTestCase.java | 2 +- .../NonStaticConfigInnerClassesTestCase.java | 2 +- ...ainVanillaFooConfigInnerClassTestCase.java | 2 +- .../PrivateConfigInnerClassTestCase.java | 2 +- ...TransactionalTestNGSpringContextTests.java | 6 +- ...TransactionalTestNGSpringContextTests.java | 2 +- ...TransactionalTestNGSpringContextTests.java | 2 +- .../FailingBeforeAndAfterMethodsTests.java | 2 +- ...TransactionalTestNGSpringContextTests.java | 2 +- .../test/jdbc/JdbcTestUtilsTests.java | 2 +- .../test/util/ReflectionTestUtilsTests.java | 2 +- .../test/util/subpackage/Person.java | 2 +- .../dao/DataRetrievalFailureException.java | 2 +- .../dao/DuplicateKeyException.java | 2 +- ...ectUpdateSemanticsDataAccessException.java | 2 +- ...validDataAccessResourceUsageException.java | 4 +- ...ersistenceExceptionTranslationAdvisor.java | 2 +- .../org/springframework/dao/package-info.java | 4 +- ...ChainedPersistenceExceptionTranslator.java | 2 +- .../dao/support/DaoSupport.java | 2 +- .../dao/support/DataAccessUtils.java | 10 +- ...stenceExceptionTranslationInterceptor.java | 2 +- .../PersistenceExceptionTranslator.java | 2 +- .../cci/CannotGetCciConnectionException.java | 6 +- .../cci/InvalidResultSetAccessException.java | 8 +- .../CciLocalTransactionManager.java | 2 +- .../connection/ConnectionFactoryUtils.java | 2 +- .../jca/cci/connection/ConnectionHolder.java | 6 +- .../connection/SingleConnectionFactory.java | 2 +- .../jca/cci/core/CciTemplate.java | 2 +- .../jca/cci/core/ConnectionCallback.java | 4 +- .../jca/cci/core/InteractionCallback.java | 4 +- .../jca/cci/core/RecordCreator.java | 6 +- .../jca/cci/core/RecordExtractor.java | 6 +- .../jca/cci/core/support/CommAreaRecord.java | 6 +- .../cci/object/MappingCommAreaOperation.java | 6 +- .../cci/object/MappingRecordOperation.java | 10 +- .../context/SpringContextResourceAdapter.java | 2 +- .../AbstractMessageEndpointFactory.java | 2 +- .../GenericMessageEndpointFactory.java | 2 +- .../support/ResourceAdapterFactoryBean.java | 4 +- .../GlassFishWorkManagerTaskExecutor.java | 2 +- .../jca/work/jboss/JBossWorkManagerUtils.java | 2 +- .../transaction/TransactionDefinition.java | 4 +- .../TransactionSystemException.java | 4 +- .../TransactionUsageException.java | 2 +- .../transaction/annotation/Isolation.java | 6 +- .../transaction/annotation/Propagation.java | 8 +- .../SpringTransactionAnnotationParser.java | 8 +- .../AnnotationDrivenBeanDefinitionParser.java | 2 +- ...ransactionManagerBeanDefinitionParser.java | 2 +- .../config/TxAdviceBeanDefinitionParser.java | 2 +- .../config/TxNamespaceHandler.java | 2 +- ...actFallbackTransactionAttributeSource.java | 4 +- ...MatchAlwaysTransactionAttributeSource.java | 2 +- .../MethodMapTransactionAttributeSource.java | 6 +- .../NameMatchTransactionAttributeSource.java | 4 +- .../interceptor/NoRollbackRuleAttribute.java | 10 +- .../interceptor/RollbackRuleAttribute.java | 8 +- .../RuleBasedTransactionAttribute.java | 2 +- .../interceptor/TransactionAspectSupport.java | 4 +- .../interceptor/TransactionAttribute.java | 2 +- .../TransactionAttributeSourceAdvisor.java | 4 +- .../TransactionAttributeSourceEditor.java | 4 +- .../TransactionAttributeSourcePointcut.java | 4 +- .../interceptor/TransactionInterceptor.java | 2 +- .../transaction/interceptor/package-info.java | 4 +- .../JtaAfterCompletionSynchronization.java | 2 +- .../jta/JtaTransactionManager.java | 2 +- .../jta/OC4JJtaTransactionManager.java | 6 +- .../jta/SpringJtaSynchronizationAdapter.java | 2 +- .../jta/WebLogicJtaTransactionManager.java | 10 +- .../jta/WebSphereUowTransactionManager.java | 2 +- .../AbstractPlatformTransactionManager.java | 4 +- .../support/SimpleTransactionStatus.java | 2 +- .../support/TransactionSynchronization.java | 2 +- .../TransactionSynchronizationManager.java | 4 +- .../TransactionSynchronizationUtils.java | 2 +- .../support/TransactionTemplate.java | 2 +- .../org/springframework/beans/Colour.java | 2 +- .../beans/DerivedTestBean.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- .../CollectingReaderEventListener.java | 2 +- ...tenceExceptionTranslationAdvisorTests.java | 2 +- ...xceptionTranslationPostProcessorTests.java | 2 +- ...edPersistenceExceptionTranslatorTests.java | 16 +- .../jca/cci/CciLocalTransactionTests.java | 12 +- .../jca/cci/CciTemplateTests.java | 8 +- .../jca/cci/EisOperationTests.java | 10 +- .../LocalConnectionFactoryBeanTests.java | 2 +- .../mock/jndi/ExpectedLookupTemplate.java | 3 +- .../mock/jndi/SimpleNamingContext.java | 2 +- .../mock/jndi/SimpleNamingContextBuilder.java | 4 +- .../CallCountingTransactionManager.java | 2 +- .../JndiJtaTransactionManagerTests.java | 2 +- .../JtaTransactionManagerTests.java | 4 +- .../transaction/TestTransactionManager.java | 6 +- .../transaction/TxNamespaceHandlerTests.java | 4 +- ...tationTransactionAttributeSourceTests.java | 32 +- ...ationTransactionNamespaceHandlerTests.java | 6 +- .../config/AnnotationDrivenTests.java | 2 +- .../AbstractTransactionAspectTests.java | 48 +- .../BeanFactoryTransactionTests.java | 24 +- .../interceptor/ImplementsNoInterfaces.java | 14 +- .../interceptor/MyRuntimeException.java | 2 +- .../PlatformTransactionManagerFacade.java | 8 +- .../interceptor/RollbackRuleTests.java | 6 +- .../RuleBasedTransactionAttributeTests.java | 2 +- .../TransactionAttributeEditorTests.java | 8 +- ...ransactionAttributeSourceAdvisorTests.java | 14 +- ...TransactionAttributeSourceEditorTests.java | 10 +- .../TransactionAttributeSourceTests.java | 2 +- .../TransactionInterceptorTests.java | 16 +- .../WebSphereUowTransactionManagerTests.java | 2 +- ...aTransactionManagerSerializationTests.java | 6 +- .../util/SerializationTestUtils.java | 2 +- .../org/springframework/http/HttpEntity.java | 2 +- .../org/springframework/http/MediaType.java | 7 +- .../http/client/CommonsClientHttpRequest.java | 2 +- .../client/CommonsClientHttpResponse.java | 2 +- .../HttpComponentsClientHttpRequest.java | 2 +- .../client/InterceptingClientHttpRequest.java | 2 +- .../http/client/support/HttpAccessor.java | 2 +- .../AbstractHttpMessageConverter.java | 2 +- .../BufferedImageHttpMessageConverter.java | 2 +- .../ByteArrayHttpMessageConverter.java | 4 +- .../converter/FormHttpMessageConverter.java | 15 +- .../HttpMessageNotWritableException.java | 2 +- .../ResourceHttpMessageConverter.java | 2 +- .../feed/AtomFeedHttpMessageConverter.java | 2 +- .../feed/RssChannelHttpMessageConverter.java | 4 +- .../AbstractJaxb2HttpMessageConverter.java | 9 +- .../xml/AbstractXmlHttpMessageConverter.java | 2 +- .../Jaxb2RootElementHttpMessageConverter.java | 6 +- .../xml/MarshallingHttpMessageConverter.java | 2 +- .../xml/SourceHttpMessageConverter.java | 4 +- .../xml/XmlAwareFormHttpMessageConverter.java | 6 +- .../caucho/BurlapClientInterceptor.java | 2 +- .../remoting/caucho/BurlapExporter.java | 2 +- .../caucho/HessianClientInterceptor.java | 4 +- .../remoting/caucho/HessianExporter.java | 2 +- .../caucho/HessianServiceExporter.java | 2 +- .../caucho/SimpleBurlapServiceExporter.java | 2 +- .../caucho/SimpleHessianServiceExporter.java | 2 +- .../remoting/caucho/package-info.java | 4 +- .../AbstractHttpInvokerRequestExecutor.java | 2 +- .../CommonsHttpInvokerRequestExecutor.java | 2 +- .../HttpInvokerClientInterceptor.java | 2 +- .../HttpInvokerServiceExporter.java | 2 +- .../SimpleHttpInvokerServiceExporter.java | 2 +- .../remoting/httpinvoker/package-info.java | 2 +- .../jaxrpc/JaxRpcPortClientInterceptor.java | 18 +- .../jaxrpc/LocalJaxRpcServiceFactory.java | 14 +- .../jaxrpc/ServletEndpointSupport.java | 4 +- .../jaxws/AbstractJaxWsServiceExporter.java | 2 +- .../SimpleHttpServerJaxWsServiceExporter.java | 2 +- .../web/HttpMediaTypeException.java | 2 +- .../HttpMediaTypeNotSupportedException.java | 2 +- ...ttpRequestMethodNotSupportedException.java | 2 +- .../web/bind/EscapedErrors.java | 4 +- .../bind/MethodArgumentNotValidException.java | 4 +- .../web/bind/ServletRequestDataBinder.java | 2 +- ...sfiedServletRequestParameterException.java | 7 +- .../web/bind/WebDataBinder.java | 18 +- .../web/bind/annotation/RequestPart.java | 28 +- .../web/bind/annotation/ResponseBody.java | 2 +- .../bind/annotation/SessionAttributes.java | 4 +- .../support/HandlerMethodInvoker.java | 49 +- .../support/HandlerMethodResolver.java | 2 +- .../support/DefaultDataBinderFactory.java | 14 +- .../bind/support/WebDataBinderFactory.java | 14 +- .../client/HttpMessageConverterExtractor.java | 4 +- .../web/client/RestTemplate.java | 27 +- .../client/support/RestGatewaySupport.java | 2 +- .../web/context/ContextCleanupListener.java | 6 +- .../web/context/ServletContextAware.java | 2 +- .../web/context/WebApplicationContext.java | 4 +- .../AbstractRequestAttributesScope.java | 6 +- .../DestructionCallbackBindingListener.java | 2 +- .../request/FacesRequestAttributes.java | 2 +- .../web/context/request/FacesWebRequest.java | 4 +- .../context/request/RequestContextHolder.java | 2 +- .../context/request/ServletWebRequest.java | 2 +- .../web/context/request/SessionScope.java | 4 +- .../web/context/request/WebRequest.java | 4 +- .../support/HttpRequestHandlerServlet.java | 6 +- .../ServletContextAttributeExporter.java | 2 +- .../support/ServletContextPropertySource.java | 2 +- ...ServletContextResourcePatternResolver.java | 5 +- .../context/support/ServletContextScope.java | 2 +- .../support/SpringBeanAutowiringSupport.java | 2 +- .../support/WebApplicationObjectSupport.java | 2 +- .../web/filter/CharacterEncodingFilter.java | 2 +- .../web/filter/CompositeFilter.java | 12 +- .../web/filter/DelegatingFilterProxy.java | 2 +- .../web/filter/GenericFilterBean.java | 2 +- .../web/filter/HiddenHttpMethodFilter.java | 2 +- .../web/filter/HttpPutFormContentFilter.java | 10 +- .../DelegatingPhaseListenerMulticaster.java | 2 +- .../web/jsf/DelegatingVariableResolver.java | 2 +- .../WebApplicationContextFacesELResolver.java | 2 +- .../web/jsf/el/package-info.java | 2 +- .../springframework/web/jsf/package-info.java | 2 +- .../web/method/HandlerMethodSelector.java | 10 +- ...ractCookieValueMethodArgumentResolver.java | 20 +- .../ExceptionHandlerMethodResolver.java | 19 +- ...ExpressionValueMethodArgumentResolver.java | 18 +- .../InitBinderDataBinderFactory.java | 8 +- .../web/method/annotation/ModelFactory.java | 64 +-- .../RequestHeaderMethodArgumentResolver.java | 16 +- .../RequestParamMethodArgumentResolver.java | 2 +- .../HandlerMethodArgumentResolver.java | 28 +- .../HandlerMethodReturnValueHandler.java | 24 +- .../commons/CommonsFileUploadSupport.java | 2 +- .../commons/CommonsMultipartFile.java | 5 +- .../commons/CommonsMultipartResolver.java | 2 +- .../AbstractMultipartHttpServletRequest.java | 2 +- .../DefaultMultipartHttpServletRequest.java | 7 +- .../multipart/support/MultipartFilter.java | 4 +- .../RequestPartServletServerHttpRequest.java | 8 +- .../support/StringMultipartFileEditor.java | 2 +- .../web/util/ExpressionEvaluationUtils.java | 6 +- .../util/HtmlCharacterEntityReferences.java | 4 +- .../springframework/web/util/HtmlUtils.java | 4 +- .../springframework/web/util/TagUtils.java | 12 +- .../springframework/web/util/UriUtils.java | 8 +- .../springframework/web/util/WebUtils.java | 13 +- .../beans/BeanWithObjectProperty.java | 2 +- .../org/springframework/beans/Colour.java | 2 +- .../beans/DerivedTestBean.java | 2 +- .../beans/FieldAccessBean.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/Person.java | 8 +- .../beans/SerializablePerson.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- .../beans/factory/DummyFactory.java | 2 +- .../core/task/MockRunnable.java | 2 +- .../springframework/http/HttpEntityTests.java | 23 - .../http/HttpHeadersTests.java | 2 +- ...ufferingClientHttpRequestFactoryTests.java | 2 +- .../CommonsHttpRequestFactoryTests.java | 4 - ...treamingSimpleHttpRequestFactoryTests.java | 2 +- .../client/support/ProxyFactoryBeanTest.java | 2 +- ...ufferedImageHttpMessageConverterTests.java | 2 +- .../ByteArrayHttpMessageConverterTests.java | 2 +- .../FormHttpMessageConverterTests.java | 3 +- .../converter/HttpMessageConverterTests.java | 13 +- .../ResourceHttpMessageConverterTests.java | 2 +- .../StringHttpMessageConverterTests.java | 4 +- .../AtomFeedHttpMessageConverterTests.java | 2 +- .../RssChannelHttpMessageConverterTests.java | 4 +- ...b2RootElementHttpMessageConverterTest.java | 15 +- .../MarshallingHttpMessageConverterTests.java | 2 +- .../xml/SourceHttpMessageConverterTests.java | 5 +- .../server/ServletServerHttpRequestTests.java | 2 +- .../ServletServerHttpResponseTests.java | 2 +- .../mock/web/test/MockMultipartFile.java | 3 - .../mock/web/test/MockPageContext.java | 1 - .../remoting/caucho/CauchoRemotingTests.java | 2 +- .../util/SerializationTestUtils.java | 2 +- .../web/bind/EscapedErrorsTests.java | 2 +- .../client/RestTemplateIntegrationTests.java | 2 +- .../RequestAndSessionScopedBeanTests.java | 2 +- ...ationConfigWebApplicationContextTests.java | 2 +- .../StandardServletEnvironmentTests.java | 2 +- .../filter/HiddenHttpMethodFilterTest.java | 2 +- .../filter/HttpPutFormContentFilterTests.java | 9 - .../web/filter/RequestContextFilterTests.java | 8 +- .../filter/ShallowEtagHeaderFilterTests.java | 2 +- .../web/jsf/MockFacesContext.java | 2 +- .../web/jsf/MockLifecycle.java | 2 +- ...ookieValueMethodArgumentResolverTests.java | 10 +- ...orsMethodHandlerArgumentResolverTests.java | 10 +- .../ExceptionHandlerMethodResolverTests.java | 10 +- ...ssionValueMethodArgumentResolverTests.java | 14 +- .../InitBinderDataBinderFactoryTests.java | 36 +- .../annotation/MapMethodProcessorTests.java | 18 +- .../ModelAttributeMethodProcessorTests.java | 2 +- .../method/annotation/ModelFactoryTests.java | 38 +- .../annotation/ModelMethodProcessorTests.java | 22 +- ...tHeaderMapMethodArgumentResolverTests.java | 10 +- ...uestHeaderMethodArgumentResolverTests.java | 6 +- ...stParamMapMethodArgumentResolverTests.java | 10 +- ...questParamMethodArgumentResolverTests.java | 10 +- .../SessionAttributesHandlerTests.java | 2 +- .../WebArgumentResolverAdapterTests.java | 8 +- ...rMethodArgumentResolverCompositeTests.java | 16 +- ...ethodReturnValueHandlerCompositeTests.java | 24 +- .../support/InvocableHandlerMethodTests.java | 10 +- .../support/ModelAndViewContainerTests.java | 18 +- .../method/support/StubArgumentResolver.java | 6 +- .../support/StubReturnValueHandler.java | 8 +- .../ByteArrayMultipartFileEditorTests.java | 2 +- ...uestPartServletServerHttpRequestTests.java | 10 +- .../HtmlCharacterEntityReferencesTests.java | 2 +- .../web/util/HtmlUtilsTests.java | 2 +- .../web/util/Log4jWebConfigurerTests.java | 6 +- .../web/util/MockLog4jAppender.java | 8 +- .../web/util/TagUtilsTests.java | 8 +- .../web/util/UriComponentsTests.java | 4 +- .../web/util/UriTemplateTests.java | 4 +- .../web/util/UriUtilsTests.java | 4 +- .../web/util/UrlPathHelperTests.java | 2 +- .../web/util/WebUtilsTests.java | 2 +- .../web/portlet/DispatcherPortlet.java | 6 +- .../web/portlet/FrameworkPortlet.java | 14 +- .../web/portlet/GenericPortletBean.java | 14 +- .../web/portlet/HandlerAdapter.java | 4 +- .../web/portlet/HandlerInterceptor.java | 2 +- .../web/portlet/HandlerMapping.java | 2 +- .../ModelAndViewDefiningException.java | 6 +- .../PortletApplicationContextUtils.java | 14 +- .../PortletApplicationObjectSupport.java | 6 +- .../portlet/context/PortletConfigAware.java | 6 +- .../portlet/context/PortletContextAware.java | 6 +- .../context/PortletContextAwareProcessor.java | 2 +- ...PortletContextResourcePatternResolver.java | 8 +- .../portlet/context/PortletContextScope.java | 2 +- .../context/PortletRequestAttributes.java | 2 +- .../portlet/context/PortletWebRequest.java | 7 +- .../StaticPortletApplicationContext.java | 2 +- .../AbstractHandlerExceptionResolver.java | 12 +- .../handler/AbstractHandlerMapping.java | 2 +- .../AbstractMapBasedHandlerMapping.java | 2 +- .../handler/ParameterHandlerMapping.java | 2 +- .../handler/ParameterMappingInterceptor.java | 2 +- .../handler/PortletContentGenerator.java | 4 +- .../handler/PortletModeHandlerMapping.java | 2 +- .../PortletModeParameterHandlerMapping.java | 2 +- ...letRequestMethodNotSupportedException.java | 2 +- .../SimpleMappingExceptionResolver.java | 6 +- .../handler/SimplePortletHandlerAdapter.java | 2 +- .../handler/SimplePortletPostProcessor.java | 2 +- .../CommonsPortletMultipartResolver.java | 2 +- .../DefaultMultipartActionRequest.java | 9 +- .../multipart/PortletMultipartResolver.java | 6 +- .../mvc/AbstractCommandController.java | 6 +- .../web/portlet/mvc/AbstractController.java | 2 +- .../portlet/mvc/AbstractFormController.java | 16 +- .../mvc/AbstractWizardFormController.java | 16 +- .../portlet/mvc/BaseCommandController.java | 32 +- .../web/portlet/mvc/Controller.java | 6 +- .../mvc/ParameterizableViewController.java | 2 +- .../mvc/PortletWrappingController.java | 6 +- .../web/portlet/mvc/SimpleFormController.java | 8 +- .../AnnotationMethodHandlerAdapter.java | 12 +- ...otationMethodHandlerExceptionResolver.java | 2 +- .../DefaultAnnotationHandlerMapping.java | 3 + .../PortletAnnotationMappingUtils.java | 2 +- .../web/portlet/util/PortletUtils.java | 12 +- .../org/springframework/beans/Colour.java | 2 +- .../beans/DerivedTestBean.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- .../factory/AbstractBeanFactoryTests.java | 4 +- .../AbstractListableBeanFactoryTests.java | 2 +- .../beans/factory/DummyFactory.java | 2 +- .../beans/factory/LifecycleBean.java | 2 +- .../beans/factory/MustBeInitialized.java | 11 +- .../springframework/context/ACATester.java | 10 +- .../AbstractApplicationContextTests.java | 8 +- .../context/BeanThatBroadcasts.java | 4 +- .../context/LifecycleContextBean.java | 12 +- .../springframework/context/TestListener.java | 4 +- .../web/DelegatingServletOutputStream.java | 2 +- .../mock/web/MockHttpServletResponse.java | 6 +- .../mock/web/MockMultipartFile.java | 5 +- .../mock/web/portlet/MockActionResponse.java | 2 +- .../mock/web/portlet/MockBaseURL.java | 2 +- .../web/portlet/MockClientDataRequest.java | 4 +- .../mock/web/portlet/MockEvent.java | 4 +- .../mock/web/portlet/MockEventRequest.java | 2 +- .../mock/web/portlet/MockMimeResponse.java | 2 +- .../mock/web/portlet/MockPortalContext.java | 2 +- .../mock/web/portlet/MockPortletConfig.java | 8 +- .../mock/web/portlet/MockPortletContext.java | 10 +- .../web/portlet/MockPortletPreferences.java | 2 +- .../mock/web/portlet/MockPortletRequest.java | 2 +- .../portlet/MockPortletRequestDispatcher.java | 2 +- .../mock/web/portlet/MockPortletResponse.java | 2 +- .../mock/web/portlet/MockPortletSession.java | 2 +- .../mock/web/portlet/MockPortletURL.java | 2 +- .../mock/web/portlet/MockRenderResponse.java | 2 +- .../mock/web/portlet/MockResourceRequest.java | 2 +- .../mock/web/portlet/MockResourceURL.java | 2 +- .../web/portlet/MockStateAwareResponse.java | 4 +- .../ServletWrappingPortletContext.java | 2 +- .../ComplexPortletApplicationContext.java | 36 +- .../web/portlet/DispatcherPortletTests.java | 29 +- .../web/portlet/GenericPortletBeanTests.java | 16 +- .../SimplePortletApplicationContext.java | 4 +- ...etRequestParameterPropertyValuesTests.java | 8 +- .../bind/PortletRequestUtilsTests.java | 2 +- ...AbstractXmlWebApplicationContextTests.java | 11 +- .../PortletApplicationContextScopeTests.java | 4 +- .../context/PortletConfigAwareBean.java | 4 +- .../context/PortletContextAwareBean.java | 6 +- .../PortletContextAwareProcessorTests.java | 32 +- .../PortletRequestAttributesTests.java | 2 +- .../context/PortletWebRequestTests.java | 3 +- .../XmlPortletApplicationContextTests.java | 10 +- .../handler/ParameterHandlerMappingTests.java | 30 +- .../ParameterMappingInterceptorTests.java | 10 +- .../PortletModeHandlerMappingTests.java | 26 +- ...rtletModeParameterHandlerMappingTests.java | 28 +- .../SimpleMappingExceptionResolverTests.java | 42 +- ...UserRoleAuthorizationInterceptorTests.java | 2 +- .../portlet/mvc/CommandControllerTests.java | 54 +- .../ParameterizableViewControllerTests.java | 4 +- .../PortletModeNameViewControllerTests.java | 8 +- ...onMethodHandlerExceptionResolverTests.java | 2 +- .../PortletAnnotationControllerTests.java | 2 +- .../web/portlet/util/PortletUtilsTests.java | 5 +- .../web/servlet/HandlerAdapter.java | 6 +- .../web/servlet/HandlerMapping.java | 19 +- .../web/servlet/HttpServletBean.java | 8 +- .../ModelAndViewDefiningException.java | 6 +- .../web/servlet/ResourceServlet.java | 2 +- .../web/servlet/SmartView.java | 4 +- .../web/servlet/ThemeResolver.java | 6 +- .../web/servlet/ViewResolver.java | 4 +- .../AnnotationDrivenBeanDefinitionParser.java | 5 +- ...ultServletHandlerBeanDefinitionParser.java | 26 +- .../InterceptorsBeanDefinitionParser.java | 3 +- .../servlet/config/MvcNamespaceHandler.java | 2 +- .../web/servlet/config/MvcNamespaceUtils.java | 16 +- .../config/ResourcesBeanDefinitionParser.java | 5 +- .../ViewControllerBeanDefinitionParser.java | 13 +- .../DefaultServletHandlerConfigurer.java | 14 +- .../config/annotation/EnableWebMvc.java | 16 +- .../annotation/InterceptorRegistration.java | 15 +- .../annotation/InterceptorRegistry.java | 3 +- .../ResourceHandlerRegistration.java | 16 +- .../annotation/ResourceHandlerRegistry.java | 14 +- .../ViewControllerRegistration.java | 12 +- .../annotation/ViewControllerRegistry.java | 18 +- .../annotation/WebMvcConfigurerAdapter.java | 2 +- .../AbstractHandlerExceptionResolver.java | 12 +- ...bstractHandlerMethodExceptionResolver.java | 6 +- .../ConversionServiceExposingInterceptor.java | 4 +- .../handler/DispatcherServletWebRequest.java | 2 +- .../HandlerExceptionResolverComposite.java | 4 +- .../servlet/handler/MappedInterceptor.java | 4 +- .../handler/SimpleServletHandlerAdapter.java | 2 +- .../handler/SimpleServletPostProcessor.java | 2 +- .../handler/SimpleUrlHandlerMapping.java | 2 +- .../UserRoleAuthorizationInterceptor.java | 2 +- .../i18n/AcceptHeaderLocaleResolver.java | 2 +- .../servlet/i18n/SessionLocaleResolver.java | 2 +- .../mvc/AbstractCommandController.java | 6 +- .../web/servlet/mvc/AbstractController.java | 4 +- .../servlet/mvc/AbstractFormController.java | 12 +- .../mvc/AbstractWizardFormController.java | 10 +- .../servlet/mvc/BaseCommandController.java | 12 +- .../mvc/ParameterizableViewController.java | 2 +- .../mvc/ServletForwardingController.java | 2 +- .../mvc/ServletWrappingController.java | 7 +- .../web/servlet/mvc/SimpleFormController.java | 8 +- .../mvc/UrlFilenameViewController.java | 2 +- .../servlet/mvc/WebContentInterceptor.java | 4 +- .../AnnotationMethodHandlerAdapter.java | 23 +- ...otationMethodHandlerExceptionResolver.java | 11 +- .../mvc/annotation/ModelAndViewResolver.java | 4 +- .../ServletAnnotationMappingUtils.java | 2 +- .../AbstractMediaTypeExpression.java | 2 +- .../AbstractNameValueExpression.java | 6 +- .../condition/AbstractRequestCondition.java | 10 +- .../condition/HeadersRequestCondition.java | 40 +- .../mvc/condition/MediaTypeExpression.java | 8 +- .../mvc/condition/NameValueExpression.java | 6 +- .../mvc/condition/ParamsRequestCondition.java | 28 +- .../condition/PatternsRequestCondition.java | 32 +- .../condition/ProducesRequestCondition.java | 21 +- .../mvc/condition/RequestCondition.java | 2 +- .../RequestMethodsRequestCondition.java | 16 +- .../method/AbstractHandlerMethodAdapter.java | 8 +- .../mvc/method/RequestMappingInfo.java | 34 +- ...essageConverterMethodArgumentResolver.java | 57 +- ...stractMessageConverterMethodProcessor.java | 2 +- .../ExtendedServletRequestDataBinder.java | 13 +- ...dViewResolverMethodReturnValueHandler.java | 6 +- ...PathVariableMapMethodArgumentResolver.java | 2 +- .../PathVariableMethodArgumentResolver.java | 2 +- .../RequestMappingHandlerAdapter.java | 2 +- .../RequestPartMethodArgumentResolver.java | 2 +- .../RequestResponseBodyMethodProcessor.java | 2 +- ...vletCookieValueMethodArgumentResolver.java | 4 +- .../ServletModelAttributeMethodProcessor.java | 6 +- .../ServletRequestMethodArgumentResolver.java | 6 +- ...ServletResponseMethodArgumentResolver.java | 2 +- .../ServletWebArgumentResolverAdapter.java | 10 +- .../mvc/method/annotation/package-info.java | 1 - .../AbstractUrlMethodNameResolver.java | 2 +- .../mvc/multiaction/MethodNameResolver.java | 2 +- .../multiaction/MultiActionController.java | 14 +- .../NoSuchRequestHandlingMethodException.java | 6 +- .../ParameterMethodNameResolver.java | 16 +- .../PropertiesMethodNameResolver.java | 6 +- .../servlet/mvc/multiaction/package-info.java | 8 +- .../web/servlet/mvc/package-info.java | 6 +- .../AbstractControllerUrlHandlerMapping.java | 18 +- .../AnnotationControllerTypePredicate.java | 6 +- .../ControllerBeanNameHandlerMapping.java | 4 +- .../ControllerClassNameHandlerMapping.java | 8 +- .../mvc/support/ControllerTypePredicate.java | 6 +- .../DefaultHandlerExceptionResolver.java | 4 +- .../mvc/support/RedirectAttributes.java | 32 +- .../support/RedirectAttributesModelMap.java | 12 +- .../web/servlet/package-info.java | 2 +- .../DefaultServletHttpRequestHandler.java | 2 +- .../resource/ResourceHttpRequestHandler.java | 2 +- .../web/servlet/support/BindStatus.java | 6 +- .../support/JspAwareRequestContext.java | 2 +- .../web/servlet/support/RequestContext.java | 12 +- .../servlet/support/RequestContextUtils.java | 4 +- .../support/RequestDataValueProcessor.java | 12 +- .../servlet/support/WebContentGenerator.java | 2 +- .../web/servlet/support/package-info.java | 2 +- .../web/servlet/tags/EvalTag.java | 4 +- .../web/servlet/tags/HtmlEscapeTag.java | 6 +- .../web/servlet/tags/MessageTag.java | 12 +- .../web/servlet/tags/Param.java | 14 +- .../web/servlet/tags/ParamTag.java | 18 +- .../servlet/tags/RequestContextAwareTag.java | 6 +- .../web/servlet/tags/UrlTag.java | 34 +- .../tags/form/AbstractCheckedElementTag.java | 2 +- .../servlet/tags/form/AbstractFormTag.java | 2 +- .../tags/form/AbstractHtmlElementBodyTag.java | 2 +- .../tags/form/AbstractHtmlElementTag.java | 27 +- .../form/AbstractHtmlInputElementTag.java | 2 +- .../form/AbstractMultiCheckedElementTag.java | 21 +- .../web/servlet/tags/form/ButtonTag.java | 10 +- .../web/servlet/tags/form/CheckboxTag.java | 6 +- .../web/servlet/tags/form/ErrorsTag.java | 2 +- .../web/servlet/tags/form/HiddenInputTag.java | 2 +- .../web/servlet/tags/form/InputTag.java | 6 +- .../web/servlet/tags/form/LabelTag.java | 2 +- .../web/servlet/tags/form/OptionTag.java | 16 +- .../web/servlet/tags/form/OptionWriter.java | 30 +- .../web/servlet/tags/form/OptionsTag.java | 16 +- .../web/servlet/tags/form/RadioButtonTag.java | 2 +- .../web/servlet/tags/form/SelectTag.java | 8 +- .../tags/form/SelectedValueComparator.java | 20 +- .../web/servlet/tags/form/TagWriter.java | 6 +- .../servlet/theme/CookieThemeResolver.java | 6 +- .../servlet/theme/SessionThemeResolver.java | 6 +- .../web/servlet/theme/package-info.java | 8 +- .../view/AbstractCachingViewResolver.java | 6 +- .../servlet/view/AbstractTemplateView.java | 10 +- .../view/AbstractTemplateViewResolver.java | 4 +- .../servlet/view/BeanNameViewResolver.java | 4 +- .../servlet/view/InternalResourceView.java | 2 +- .../view/InternalResourceViewResolver.java | 6 +- .../web/servlet/view/RedirectView.java | 48 +- .../view/ResourceBundleViewResolver.java | 4 +- .../servlet/view/UrlBasedViewResolver.java | 16 +- .../web/servlet/view/XmlViewResolver.java | 4 +- .../view/document/AbstractExcelView.java | 2 +- .../view/document/AbstractJExcelView.java | 20 +- .../view/document/AbstractPdfStamperView.java | 2 +- .../view/document/AbstractPdfView.java | 2 +- .../view/feed/AbstractAtomFeedView.java | 2 +- .../servlet/view/feed/AbstractFeedView.java | 2 +- .../view/feed/AbstractRssFeedView.java | 2 +- .../view/freemarker/FreeMarkerConfig.java | 2 +- .../view/freemarker/FreeMarkerConfigurer.java | 2 +- .../view/freemarker/FreeMarkerView.java | 2 +- .../freemarker/FreeMarkerViewResolver.java | 4 +- .../AbstractJasperReportsView.java | 10 +- .../jasperreports/JasperReportsCsvView.java | 2 +- .../JasperReportsMultiFormatView.java | 2 +- .../JasperReportsViewResolver.java | 6 +- .../web/servlet/view/package-info.java | 2 +- .../tiles2/AbstractSpringPreparerFactory.java | 5 +- .../tiles2/SpringBeanPreparerFactory.java | 2 +- .../view/tiles2/SpringLocaleResolver.java | 2 +- .../SpringTilesApplicationContextFactory.java | 6 +- .../servlet/view/tiles2/TilesConfigurer.java | 10 +- .../web/servlet/view/tiles2/TilesView.java | 2 +- .../view/tiles2/TilesViewResolver.java | 4 +- .../servlet/view/velocity/VelocityConfig.java | 8 +- .../view/velocity/VelocityConfigurer.java | 2 +- .../view/velocity/VelocityLayoutView.java | 2 +- .../velocity/VelocityLayoutViewResolver.java | 4 +- .../view/velocity/VelocityToolboxView.java | 4 +- .../servlet/view/velocity/VelocityView.java | 10 +- .../view/velocity/VelocityViewResolver.java | 4 +- .../servlet/view/xslt/AbstractXsltView.java | 28 +- .../web/servlet/view/xslt/XsltView.java | 12 +- .../servlet/view/xslt/XsltViewResolver.java | 4 +- .../beans/BeanWithObjectProperty.java | 2 +- .../org/springframework/beans/Colour.java | 2 +- .../org/springframework/beans/CustomEnum.java | 2 +- .../beans/DerivedTestBean.java | 2 +- .../beans/FieldAccessBean.java | 2 +- .../springframework/beans/GenericBean.java | 2 +- .../beans/INestedTestBean.java | 8 +- .../org/springframework/beans/IOther.java | 8 +- .../org/springframework/beans/ITestBean.java | 2 +- .../beans/IndexedTestBean.java | 2 +- .../springframework/beans/NestedTestBean.java | 8 +- .../org/springframework/beans/Person.java | 8 +- .../java/org/springframework/beans/Pet.java | 2 +- .../beans/SerializablePerson.java | 8 +- .../org/springframework/beans/TestBean.java | 2 +- .../beans/factory/DummyFactory.java | 2 +- .../beans/factory/LifecycleBean.java | 2 +- .../beans/factory/MustBeInitialized.java | 11 +- .../beans/factory/access/TestBean.java | 8 +- .../springframework/context/ACATester.java | 10 +- .../context/BeanThatBroadcasts.java | 4 +- .../context/LifecycleContextBean.java | 12 +- .../springframework/context/TestListener.java | 4 +- .../ui/jasperreports/PersonBean.java | 2 +- .../ui/jasperreports/ProductBean.java | 2 +- .../AbstractApplicationContextTests.java | 2 +- .../web/context/AbstractBeanFactoryTests.java | 2 +- .../AbstractListableBeanFactoryTests.java | 2 +- .../web/context/ServletConfigAwareBean.java | 2 +- .../web/context/ServletContextAwareBean.java | 2 +- .../XmlWebApplicationContextTests.java | 10 +- .../WebApplicationObjectSupportTests.java | 6 +- .../servlet/ComplexWebApplicationContext.java | 2 +- .../web/servlet/FlashMapTests.java | 16 +- .../servlet/SimpleWebApplicationContext.java | 8 +- ...tationDrivenBeanDefinitionParserTests.java | 6 +- .../web/servlet/config/MvcNamespaceTests.java | 38 -- .../ResourceHandlerRegistryTests.java | 2 +- .../ViewControllerRegistryTests.java | 2 +- .../BeanNameUrlHandlerMappingTests.java | 6 +- .../handler/HandlerMethodMappingTests.java | 2 +- .../PathMatchingUrlHandlerMappingTests.java | 6 +- .../handler/SimpleUrlHandlerMappingTests.java | 2 - .../web/servlet/i18n/LocaleResolverTests.java | 8 +- .../servlet/mvc/CommandControllerTests.java | 14 +- .../ParameterizableViewControllerTests.java | 4 +- .../mvc/WebContentInterceptorTests.java | 12 +- .../mvc/annotation/AdminController.java | 2 +- .../web/servlet/mvc/annotation/BuyForm.java | 2 +- .../CgLibProxyServletAnnotationTests.java | 2 +- ...ontrollerClassNameHandlerMappingTests.java | 2 +- .../mvc/annotation/IndexController.java | 2 +- .../MethodNameDispatchingController.java | 2 +- .../ServletAnnotationControllerTests.java | 16 +- .../ServletAnnotationMappingUtilsTests.java | 10 +- .../servlet/mvc/annotation/Spr7766Tests.java | 2 +- .../servlet/mvc/annotation/Spr7839Tests.java | 24 +- .../mvc/annotation/WelcomeController.java | 2 +- .../HeadersRequestConditionTests.java | 2 +- ...ControllerBeanNameHandlerMappingTests.java | 2 +- ...RequestMappingInfoHandlerMappingTests.java | 2 +- .../mvc/method/RequestMappingInfoTests.java | 134 ++--- .../AbstractServletHandlerMethodTests.java | 4 +- ...xceptionHandlerExceptionResolverTests.java | 66 +-- .../HttpEntityMethodProcessorTests.java | 3 +- ...ResolverMethodReturnValueHandlerTests.java | 18 +- ...ariableMapMethodArgumentResolverTests.java | 2 +- ...thVariableMethodArgumentResolverTests.java | 22 +- ...MappingHandlerAdapterIntegrationTests.java | 20 +- .../RequestMappingHandlerAdapterTests.java | 13 +- ...equestPartMethodArgumentResolverTests.java | 36 +- ...questResponseBodyMethodProcessorTests.java | 2 +- ...vetModelAttributeMethodProcessorTests.java | 40 +- ...nnotationControllerHandlerMethodTests.java | 2 +- ...ookieValueMethodArgumentResolverTests.java | 6 +- .../ServletInvocableHandlerMethodTests.java | 2 +- ...letRequestMethodArgumentResolverTests.java | 10 +- ...etResponseMethodArgumentResolverTests.java | 4 +- ...ntsBuilderMethodArgumentResolverTests.java | 16 +- .../ViewMethodReturnValueHandlerTests.java | 12 +- ...ViewNameMethodReturnValueHandlerTests.java | 14 +- .../RedirectAttributesModelMapTests.java | 36 +- .../servlet/support/RequestContextTests.java | 6 +- .../RequestDataValueProcessorWrapper.java | 6 +- .../ServletUriComponentsBuilderTests.java | 18 +- .../web/servlet/tags/EvalTagTests.java | 9 +- ...ssageTagOutsideDispatcherServletTests.java | 6 +- .../web/servlet/tags/MessageTagTests.java | 12 +- .../web/servlet/tags/ParamTagTests.java | 8 +- .../web/servlet/tags/ParamTests.java | 8 +- .../web/servlet/tags/ThemeTagTests.java | 6 +- .../web/servlet/tags/UrlTagTests.java | 10 +- .../form/AbstractHtmlElementTagTests.java | 2 +- .../web/servlet/tags/form/ButtonTagTests.java | 12 +- .../servlet/tags/form/CheckboxTagTests.java | 12 +- .../servlet/tags/form/CheckboxesTagTests.java | 30 +- .../web/servlet/tags/form/ErrorsTagTests.java | 4 +- .../web/servlet/tags/form/FormTagTests.java | 47 +- .../tags/form/HiddenInputTagTests.java | 10 +- .../web/servlet/tags/form/InputTagTests.java | 6 +- .../web/servlet/tags/form/LabelTagTests.java | 6 +- .../servlet/tags/form/OptionTagEnumTests.java | 4 +- .../web/servlet/tags/form/OptionTagTests.java | 8 +- .../servlet/tags/form/OptionsTagTests.java | 24 +- .../tags/form/RadioButtonTagTests.java | 12 +- .../tags/form/RadioButtonsTagTests.java | 18 +- .../web/servlet/tags/form/SelectTagTests.java | 10 +- .../web/servlet/tags/form/TestTypes.java | 6 +- .../servlet/tags/form/TextareaTagTests.java | 6 +- .../web/servlet/theme/ThemeResolverTests.java | 8 +- .../web/servlet/view/BaseViewTests.java | 70 +-- .../view/DummyMacroRequestContext.java | 2 +- .../view/InternalResourceViewTests.java | 12 +- .../web/servlet/view/RedirectViewTests.java | 20 +- .../view/RedirectViewUriTemplateTests.java | 12 +- ...esourceBundleViewResolverNoCacheTests.java | 8 +- .../view/ResourceBundleViewResolverTests.java | 4 +- .../web/servlet/view/ViewResolverTests.java | 10 +- .../servlet/view/document/ExcelViewTests.java | 12 +- .../freemarker/FreeMarkerConfigurerTests.java | 6 +- .../AbstractJasperReportsViewTests.java | 0 ...rableJasperReportsViewWithStreamTests.java | 1 - ...rableJasperReportsViewWithWriterTests.java | 2 +- .../jasperreports/ExporterParameterTests.java | 0 .../JasperReportsMultiFormatViewTests.java | 2 +- .../velocity/VelocityConfigurerTests.java | 8 +- .../velocity/VelocityToolboxViewTests.java | 3 +- .../view/velocity/VelocityViewTests.java | 10 +- .../servlet/view/xslt/TestXsltViewTests.java | 4 +- .../view/xslt/XsltViewResolverTests.java | 2 +- ...NamespaceHandlerScopeIntegrationTests.java | 10 +- ...visorAutoProxyCreatorIntegrationTests.java | 32 +- ...ionScannerJsr330ScopeIntegrationTests.java | 3 +- .../ltw/ComponentScanningWithLTWTests.java | 7 +- ...efinitionScannerScopeIntegrationTests.java | 6 +- .../expression/spel/support/Spr7538Tests.java | 20 +- ...ansactionalAnnotationIntegrationTests.java | 1 - .../CallCountingTransactionManager.java | 2 +- .../advice/CountingAfterReturningAdvice.java | 8 +- .../test/advice/CountingBeforeAdvice.java | 6 +- src/test/java/test/advice/MethodCounter.java | 2 +- src/test/java/test/beans/Colour.java | 4 +- src/test/java/test/beans/INestedTestBean.java | 8 +- src/test/java/test/beans/IOther.java | 8 +- src/test/java/test/beans/ITestBean.java | 2 +- src/test/java/test/beans/NestedTestBean.java | 6 +- .../java/test/interceptor/NopInterceptor.java | 12 +- .../SerializableNopInterceptor.java | 18 +- .../test/util/SerializationTestUtils.java | 10 +- 2713 files changed, 13199 insertions(+), 13296 deletions(-) mode change 100755 => 100644 spring-context/src/test/java/org/springframework/context/annotation/ConfigurationWithFactoryBeanAndAutowiringTests.java mode change 100755 => 100644 spring-webmvc/src/test/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsViewTests.java mode change 100755 => 100644 spring-webmvc/src/test/java/org/springframework/web/servlet/view/jasperreports/ExporterParameterTests.java diff --git a/spring-aop/src/main/java/org/springframework/aop/Advisor.java b/spring-aop/src/main/java/org/springframework/aop/Advisor.java index 21c9c8301b6a..ff4e1745d8e2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/Advisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/Advisor.java @@ -18,14 +18,14 @@ import org.aopalliance.aop.Advice; -/** +/** * Base interface holding AOP advice (action to take at a joinpoint) - * and a filter determining the applicability of the advice (such as + * and a filter determining the applicability of the advice (such as * a pointcut). This interface is not for use by Spring users, but to * allow for commonality in support for different types of advice. * *

Spring AOP is based around around advice delivered via method - * interception, compliant with the AOP Alliance interception API. + * interception, compliant with the AOP Alliance interception API. * The Advisor interface allows support for different types of advice, * such as before and after advice, which need not be * implemented using interception. diff --git a/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java b/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java index 4fcd874cb098..37f9cb750067 100644 --- a/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java @@ -18,7 +18,7 @@ import org.aopalliance.aop.Advice; -/** +/** * Subinterface of AOP Alliance Advice that allows additional interfaces * to be implemented by an Advice, and available via a proxy using that * interceptor. This is a fundamental AOP concept called introduction. @@ -37,7 +37,7 @@ * @see IntroductionAdvisor */ public interface DynamicIntroductionAdvice extends Advice { - + /** * Does this introduction advice implement the given interface? * @param intf the interface to check diff --git a/spring-aop/src/main/java/org/springframework/aop/IntroductionAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/IntroductionAdvisor.java index 9e71253ef0bb..aa49595d51a2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/IntroductionAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/IntroductionAdvisor.java @@ -30,7 +30,7 @@ * @see IntroductionInterceptor */ public interface IntroductionAdvisor extends Advisor, IntroductionInfo { - + /** * Return the filter determining which target classes this introduction * should apply to. @@ -39,7 +39,7 @@ public interface IntroductionAdvisor extends Advisor, IntroductionInfo { * @return the class filter */ ClassFilter getClassFilter(); - + /** * Can the advised interfaces be implemented by the introduction advice? * Invoked before adding an IntroductionAdvisor. diff --git a/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java index 1363960890c7..24bcd80e5655 100644 --- a/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,6 @@ public interface IntroductionAwareMethodMatcher extends MethodMatcher { * asking is the subject on one or more introductions; false otherwise * @return whether or not this method matches statically */ - boolean matches(Method method, Class targetClass, boolean hasIntroductions); + boolean matches(Method method, Class targetClass, boolean hasIntroductions); } diff --git a/spring-aop/src/main/java/org/springframework/aop/IntroductionInfo.java b/spring-aop/src/main/java/org/springframework/aop/IntroductionInfo.java index c10e63c81d96..9f68b0742488 100644 --- a/spring-aop/src/main/java/org/springframework/aop/IntroductionInfo.java +++ b/spring-aop/src/main/java/org/springframework/aop/IntroductionInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,11 +29,11 @@ * @since 1.1.1 */ public interface IntroductionInfo { - + /** * Return the additional interfaces introduced by this Advisor or Advice. * @return the introduced interfaces */ - Class[] getInterfaces(); + Class[] getInterfaces(); } diff --git a/spring-aop/src/main/java/org/springframework/aop/MethodBeforeAdvice.java b/spring-aop/src/main/java/org/springframework/aop/MethodBeforeAdvice.java index 9383af683cf4..63ee9c9dff9f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/MethodBeforeAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/MethodBeforeAdvice.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ * @author Rod Johnson */ public interface MethodBeforeAdvice extends BeforeAdvice { - + /** * Callback before a given method is invoked. * @param method method being invoked diff --git a/spring-aop/src/main/java/org/springframework/aop/PointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/PointcutAdvisor.java index 02818d12e78d..6fb4d884974e 100644 --- a/spring-aop/src/main/java/org/springframework/aop/PointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/PointcutAdvisor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java index 0b8c228a4ac3..6d1ea1155bee 100644 --- a/spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java +++ b/spring-aop/src/main/java/org/springframework/aop/TrueClassFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,19 +24,19 @@ * @author Rod Johnson */ class TrueClassFilter implements ClassFilter, Serializable { - + public static final TrueClassFilter INSTANCE = new TrueClassFilter(); - + /** * Enforce Singleton pattern. */ private TrueClassFilter() { } - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { return true; } - + /** * Required to support serialization. Replaces with canonical * instance on deserialization, protecting Singleton pattern. diff --git a/spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java index 7be4d470a2c3..b39e3df44e81 100644 --- a/spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/TrueMethodMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,9 @@ * @author Rod Johnson */ class TrueMethodMatcher implements MethodMatcher, Serializable { - + public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher(); - + /** * Enforce Singleton pattern. */ @@ -38,15 +38,15 @@ public boolean isRuntime() { return false; } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return true; } - public boolean matches(Method method, Class targetClass, Object[] args) { + public boolean matches(Method method, Class targetClass, Object[] args) { // Should never be invoked as isRuntime returns false. throw new UnsupportedOperationException(); } - + /** * Required to support serialization. Replaces with canonical * instance on deserialization, protecting Singleton pattern. @@ -55,7 +55,7 @@ public boolean matches(Method method, Class targetClass, Object[] args) { private Object readResolve() { return INSTANCE; } - + @Override public String toString() { return "MethodMatcher.TRUE"; diff --git a/spring-aop/src/main/java/org/springframework/aop/TruePointcut.java b/spring-aop/src/main/java/org/springframework/aop/TruePointcut.java index 0c6efcb70e43..87365aa1eff7 100644 --- a/spring-aop/src/main/java/org/springframework/aop/TruePointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/TruePointcut.java @@ -24,9 +24,9 @@ * @author Rod Johnson */ class TruePointcut implements Pointcut, Serializable { - + public static final TruePointcut INSTANCE = new TruePointcut(); - + /** * Enforce Singleton pattern. */ @@ -40,7 +40,7 @@ public ClassFilter getClassFilter() { public MethodMatcher getMethodMatcher() { return MethodMatcher.TRUE; } - + /** * Required to support serialization. Replaces with canonical * instance on deserialization, protecting Singleton pattern. diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java index 9cc93f3d282d..010e540e1f1e 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java @@ -120,9 +120,9 @@ public static JoinPoint currentJoinPoint() { /** Non-null if after returning advice binds the return value */ private String returningName = null; - private Class discoveredReturningType = Object.class; + private Class discoveredReturningType = Object.class; - private Class discoveredThrowingType = Object.class; + private Class discoveredThrowingType = Object.class; /** * Index for thisJoinPoint argument (currently only @@ -211,7 +211,7 @@ public int getOrder() { public void setAspectName(String name) { this.aspectName = name; } - + public String getAspectName() { return this.aspectName; } @@ -251,7 +251,7 @@ public void setArgumentNamesFromStringArray(String[] args) { if (argumentNames != null) { if (aspectJAdviceMethod.getParameterTypes().length == argumentNames.length + 1) { // May need to add implicit join point arg name... - Class firstArgType = aspectJAdviceMethod.getParameterTypes()[0]; + Class firstArgType = aspectJAdviceMethod.getParameterTypes()[0]; if (firstArgType == JoinPoint.class || firstArgType == ProceedingJoinPoint.class || firstArgType == JoinPoint.StaticPart.class) { @@ -268,7 +268,7 @@ public void setReturningName(String name) { throw new UnsupportedOperationException("Only afterReturning advice can be used to bind a return value"); } - /** + /** * We need to hold the returning name at this level for argument binding calculations, * this method allows the afterReturning advice subclass to set the name. */ @@ -290,7 +290,7 @@ protected void setReturningNameNoCheck(String name) { } } - protected Class getDiscoveredReturningType() { + protected Class getDiscoveredReturningType() { return this.discoveredReturningType; } @@ -302,7 +302,7 @@ public void setThrowingName(String name) { throw new UnsupportedOperationException("Only afterThrowing advice can be used to bind a thrown exception"); } - /** + /** * We need to hold the throwing name at this level for argument binding calculations, * this method allows the afterThrowing advice subclass to set the name. */ @@ -324,7 +324,7 @@ protected void setThrowingNameNoCheck(String name) { } } - protected Class getDiscoveredThrowingType() { + protected Class getDiscoveredThrowingType() { return this.discoveredThrowingType; } @@ -362,14 +362,14 @@ public synchronized final void calculateArgumentBindings() { } int numUnboundArgs = this.adviceInvocationArgumentCount; - Class[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes(); + Class[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes(); if (maybeBindJoinPoint(parameterTypes[0]) || maybeBindProceedingJoinPoint(parameterTypes[0])) { numUnboundArgs--; - } + } else if (maybeBindJoinPointStaticPart(parameterTypes[0])) { numUnboundArgs--; } - + if (numUnboundArgs > 0) { // need to bind arguments by name as returned from the pointcut match bindArgumentsByName(numUnboundArgs); @@ -378,7 +378,7 @@ else if (maybeBindJoinPointStaticPart(parameterTypes[0])) { this.argumentsIntrospected = true; } - private boolean maybeBindJoinPoint(Class candidateParameterType) { + private boolean maybeBindJoinPoint(Class candidateParameterType) { if (candidateParameterType.equals(JoinPoint.class)) { this.joinPointArgumentIndex = 0; return true; @@ -388,7 +388,7 @@ private boolean maybeBindJoinPoint(Class candidateParameterType) { } } - private boolean maybeBindProceedingJoinPoint(Class candidateParameterType) { + private boolean maybeBindProceedingJoinPoint(Class candidateParameterType) { if (candidateParameterType.equals(ProceedingJoinPoint.class)) { if (!supportsProceedingJoinPoint()) { throw new IllegalArgumentException("ProceedingJoinPoint is only supported for around advice"); @@ -398,18 +398,18 @@ private boolean maybeBindProceedingJoinPoint(Class candidateParameterType) { } else { return false; - } + } } protected boolean supportsProceedingJoinPoint() { return false; } - private boolean maybeBindJoinPointStaticPart(Class candidateParameterType) { + private boolean maybeBindJoinPointStaticPart(Class candidateParameterType) { if (candidateParameterType.equals(JoinPoint.StaticPart.class)) { this.joinPointStaticPartArgumentIndex = 0; return true; - } + } else { return false; } @@ -422,7 +422,7 @@ private void bindArgumentsByName(int numArgumentsExpectingToBind) { if (this.argumentNames != null) { // We have been able to determine the arg names. bindExplicitArguments(numArgumentsExpectingToBind); - } + } else { throw new IllegalStateException("Advice method [" + this.aspectJAdviceMethod.getName() + "] " + "requires " + numArgumentsExpectingToBind + " arguments to be bound by name, but " + @@ -471,9 +471,9 @@ private void bindExplicitArguments(int numArgumentsLeftToBind) { // specified, and find the discovered argument types. if (this.returningName != null) { if (!this.argumentBindings.containsKey(this.returningName)) { - throw new IllegalStateException("Returning argument name '" + throw new IllegalStateException("Returning argument name '" + this.returningName + "' was not bound in advice arguments"); - } + } else { Integer index = this.argumentBindings.get(this.returningName); this.discoveredReturningType = this.aspectJAdviceMethod.getParameterTypes()[index]; @@ -482,9 +482,9 @@ private void bindExplicitArguments(int numArgumentsLeftToBind) { } if (this.throwingName != null) { if (!this.argumentBindings.containsKey(this.throwingName)) { - throw new IllegalStateException("Throwing argument name '" + throw new IllegalStateException("Throwing argument name '" + this.throwingName + "' was not bound in advice arguments"); - } + } else { Integer index = this.argumentBindings.get(this.throwingName); this.discoveredThrowingType = this.aspectJAdviceMethod.getParameterTypes()[index]; @@ -509,8 +509,8 @@ private void configurePointcutParameters(int argumentIndexOffset) { numParametersToRemove++; } String[] pointcutParameterNames = new String[this.argumentNames.length - numParametersToRemove]; - Class[] pointcutParameterTypes = new Class[pointcutParameterNames.length]; - Class[] methodParameterTypes = this.aspectJAdviceMethod.getParameterTypes(); + Class[] pointcutParameterTypes = new Class[pointcutParameterNames.length]; + Class[] methodParameterTypes = this.aspectJAdviceMethod.getParameterTypes(); int index = 0; for (int i = 0; i < this.argumentNames.length; i++) { @@ -525,7 +525,7 @@ private void configurePointcutParameters(int argumentIndexOffset) { pointcutParameterTypes[index] = methodParameterTypes[i]; index++; } - + this.pointcut.setParameterNames(pointcutParameterNames); this.pointcut.setParameterTypes(pointcutParameterTypes); } @@ -549,7 +549,7 @@ protected Object[] argBinding(JoinPoint jp, JoinPointMatch jpMatch, Object retur if (this.joinPointArgumentIndex != -1) { adviceInvocationArgs[this.joinPointArgumentIndex] = jp; numBound++; - } + } else if (this.joinPointStaticPartArgumentIndex != -1) { adviceInvocationArgs[this.joinPointStaticPartArgumentIndex] = jp.getStaticPart(); numBound++; @@ -582,8 +582,8 @@ else if (this.joinPointStaticPartArgumentIndex != -1) { if (numBound != this.adviceInvocationArgumentCount) { throw new IllegalStateException("Required to bind " + this.adviceInvocationArgumentCount - + " arguments, but only bound " + numBound + " (JoinPointMatch " + - (jpMatch == null ? "was NOT" : "WAS") + + + " arguments, but only bound " + numBound + " (JoinPointMatch " + + (jpMatch == null ? "was NOT" : "WAS") + " bound in invocation)"); } @@ -678,7 +678,7 @@ public AdviceExcludingMethodMatcher(Method adviceMethod) { this.adviceMethod = adviceMethod; } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return !this.adviceMethod.equals(method); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java index 7a9dba9612e3..d9938c6c4479 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; @@ -142,11 +141,10 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov singleValuedAnnotationPcds.add("@withincode"); singleValuedAnnotationPcds.add("@annotation"); - Set pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives(); - for (Iterator iterator = pointcutPrimitives.iterator(); iterator.hasNext();) { - PointcutPrimitive primitive = (PointcutPrimitive) iterator.next(); + for (PointcutPrimitive primitive : PointcutParser.getAllSupportedPointcutPrimitives()) { nonReferencePointcutTokens.add(primitive.getName()); } + nonReferencePointcutTokens.add("&&"); nonReferencePointcutTokens.add("!"); nonReferencePointcutTokens.add("||"); @@ -173,7 +171,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov */ private String pointcutExpression; - private Class[] argumentTypes; + private Class[] argumentTypes; private String[] parameterNameBindings; @@ -309,7 +307,7 @@ public String[] getParameterNames(Method method) { * @throws UnsupportedOperationException if * {@link #setRaiseExceptions(boolean) raiseExceptions} has been set to true */ - public String[] getParameterNames(Constructor ctor) { + public String[] getParameterNames(Constructor ctor) { if (this.raiseExceptions) { throw new UnsupportedOperationException("An advice method can never be a constructor"); } @@ -700,7 +698,7 @@ else if (varNames.size() == 1) { // 1 primitive arg, and one candidate... for (int i = 0; i < this.argumentTypes.length; i++) { if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) { - bindParameterName(i, (String) varNames.get(0)); + bindParameterName(i, varNames.get(0)); break; } } @@ -729,7 +727,7 @@ private boolean alreadyBound(String varName) { * Return true if the given argument type is a subclass * of the given supertype. */ - private boolean isSubtypeOf(Class supertype, int argumentNumber) { + private boolean isSubtypeOf(Class supertype, int argumentNumber) { return supertype.isAssignableFrom(this.argumentTypes[argumentNumber]); } @@ -757,7 +755,7 @@ private int countNumberOfUnboundPrimitiveArguments() { * Find the argument index with the given type, and bind the given * varName in that position. */ - private void findAndBind(Class argumentType, String varName) { + private void findAndBind(Class argumentType, String varName) { for (int i = 0; i < this.argumentTypes.length; i++) { if (isUnbound(i) && isSubtypeOf(argumentType, i)) { bindParameterName(i, varName); diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterAdvice.java index 148f71ce5d68..fd5b0d64c4aa 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public AspectJAfterAdvice( super(aspectJBeforeAdviceMethod, pointcut, aif); } - + public Object invoke(MethodInvocation mi) throws Throwable { try { return mi.proceed(); diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java index 2f9396c2304c..9acbf556f460 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterReturningAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ public void afterReturning(Object returnValue, Method method, Object[] args, Obj * @return whether to invoke the advice method for the given return value */ private boolean shouldInvokeOnReturnValueOf(Method method, Object returnValue) { - Class type = getDiscoveredReturningType(); + Class type = getDiscoveredReturningType(); Type genericType = getDiscoveredReturningGenericType(); // If we aren't dealing with a raw type, check if generic parameters are assignable. return (ClassUtils.isAssignableValue(type, returnValue) && diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterThrowingAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterThrowingAdvice.java index 6b9b611b9619..51654ad7830c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterThrowingAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAfterThrowingAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ public Object invoke(MethodInvocation mi) throws Throwable { * is only invoked if the thrown exception is a subtype of the given throwing type. */ private boolean shouldInvokeOnThrowing(Throwable t) { - Class throwingType = getDiscoveredThrowingType(); + Class throwingType = getDiscoveredThrowingType(); return throwingType.isAssignableFrom(t.getClass()); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAopUtils.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAopUtils.java index d8fe47d3e6a8..68ef022f38b8 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAopUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAopUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAroundAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAroundAdvice.java index 3048103a102d..64059d88a900 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAroundAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAroundAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java index 348b8449c37f..02486e92fa1d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,11 +97,11 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut private static final Log logger = LogFactory.getLog(AspectJExpressionPointcut.class); - private Class pointcutDeclarationScope; + private Class pointcutDeclarationScope; private String[] pointcutParameterNames = new String[0]; - private Class[] pointcutParameterTypes = new Class[0]; + private Class[] pointcutParameterTypes = new Class[0]; private BeanFactory beanFactory; @@ -122,7 +122,7 @@ public AspectJExpressionPointcut() { * @param paramNames the parameter names for the pointcut * @param paramTypes the parameter types for the pointcut */ - public AspectJExpressionPointcut(Class declarationScope, String[] paramNames, Class[] paramTypes) { + public AspectJExpressionPointcut(Class declarationScope, String[] paramNames, Class[] paramTypes) { this.pointcutDeclarationScope = declarationScope; if (paramNames.length != paramTypes.length) { throw new IllegalStateException( @@ -136,7 +136,7 @@ public AspectJExpressionPointcut(Class declarationScope, String[] paramNames, Cl /** * Set the declaration scope for the pointcut. */ - public void setPointcutDeclarationScope(Class pointcutDeclarationScope) { + public void setPointcutDeclarationScope(Class pointcutDeclarationScope) { this.pointcutDeclarationScope = pointcutDeclarationScope; } @@ -150,7 +150,7 @@ public void setParameterNames(String[] names) { /** * Set the parameter types for the pointcut. */ - public void setParameterTypes(Class[] types) { + public void setParameterTypes(Class[] types) { this.pointcutParameterTypes = types; } @@ -243,7 +243,7 @@ public PointcutExpression getPointcutExpression() { return this.pointcutExpression; } - public boolean matches(Class targetClass) { + public boolean matches(Class targetClass) { checkReadyToMatch(); try { return this.pointcutExpression.couldMatchJoinPointsInType(targetClass); @@ -259,14 +259,14 @@ public boolean matches(Class targetClass) { ex); return false; } - } + } catch (BCException ex) { logger.debug("PointcutExpression matching rejected target class", ex); return false; } } - public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) { + public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) { checkReadyToMatch(); Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass); ShadowMatch shadowMatch = getShadowMatch(targetMethod, method); @@ -281,12 +281,12 @@ else if (shadowMatch.neverMatches()) { return false; } else { - // the maybe case - return (beanHasIntroductions || matchesIgnoringSubtypes(shadowMatch) || matchesTarget(shadowMatch, targetClass)); + // the maybe case + return (beanHasIntroductions || matchesIgnoringSubtypes(shadowMatch) || matchesTarget(shadowMatch, targetClass)); } } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return matches(method, targetClass, false); } @@ -295,7 +295,7 @@ public boolean isRuntime() { return this.pointcutExpression.mayNeedDynamicTest(); } - public boolean matches(Method method, Class targetClass, Object[] args) { + public boolean matches(Method method, Class targetClass, Object[] args) { checkReadyToMatch(); ShadowMatch shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method); ShadowMatch originalShadowMatch = getShadowMatch(method, method); @@ -368,7 +368,7 @@ private boolean matchesIgnoringSubtypes(ShadowMatch shadowMatch) { return !(getRuntimeTestWalker(shadowMatch).testsSubtypeSensitiveVars()); } - private boolean matchesTarget(ShadowMatch shadowMatch, Class targetClass) { + private boolean matchesTarget(ShadowMatch shadowMatch, Class targetClass) { return getRuntimeTestWalker(shadowMatch).testTargetInstanceOfResidue(targetClass); } @@ -530,10 +530,12 @@ public BeanNameContextMatcher(String expression) { this.expressionPattern = new NamePattern(expression); } + @SuppressWarnings("rawtypes") public boolean couldMatchJoinPointsInType(Class someClass) { return (contextMatch(someClass) == FuzzyBoolean.YES); } + @SuppressWarnings("rawtypes") public boolean couldMatchJoinPointsInType(Class someClass, MatchingContext context) { return (contextMatch(someClass) == FuzzyBoolean.YES); } @@ -550,11 +552,11 @@ public boolean mayNeedDynamicTest() { return false; } - private FuzzyBoolean contextMatch(Class targetType) { + private FuzzyBoolean contextMatch(Class targetType) { String advisedBeanName = getCurrentProxiedBeanName(); if (advisedBeanName == null) { // no proxy creation in progress // abstain; can't return YES, since that will make pointcut with negation fail - return FuzzyBoolean.MAYBE; + return FuzzyBoolean.MAYBE; } if (BeanFactoryUtils.isGeneratedBeanName(advisedBeanName)) { return FuzzyBoolean.NO; diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java index 001b161fe433..e660257f7930 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ /** * Spring AOP Advisor that can be used for any AspectJ pointcut expression. - * + * * @author Rob Harrop * @since 2.0 */ @@ -42,7 +42,7 @@ public void setLocation(String location) { this.pointcut.setLocation(location); } - public void setParameterTypes(Class[] types) { + public void setParameterTypes(Class[] types) { this.pointcut.setParameterTypes(types); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java index 2b8950a0e627..ea3205524807 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJProxyUtils.java index 5c92ae6b4d42..91cd3fe7b972 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJProxyUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJProxyUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ * @since 2.0 */ public abstract class AspectJProxyUtils { - + /** * Add special advisors if necessary to work with a proxy chain that contains AspectJ advisors. * This will expose the current Spring AOP invocation (necessary for some AspectJ pointcut matching) @@ -64,8 +64,8 @@ public static boolean makeAdvisorChainAspectJCapableIfNecessary(List ad */ private static boolean isAspectJAdvice(Advisor advisor) { return (advisor instanceof InstantiationModelAwarePointcutAdvisor || - advisor.getAdvice() instanceof AbstractAspectJAdvice || - (advisor instanceof PointcutAdvisor && + advisor.getAdvice() instanceof AbstractAspectJAdvice || + (advisor instanceof PointcutAdvisor && ((PointcutAdvisor) advisor).getPointcut() instanceof AspectJExpressionPointcut)); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java index 8932259dc38b..5732ae14519b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java @@ -27,7 +27,7 @@ * Implementation of AspectJ's {@link IMessageHandler} interface that * routes AspectJ weaving messages through the same logging system as the * regular Spring messages. - * + * *

Pass the option... * *

-XmessageHandlerClass:org.springframework.aop.aspectj.AspectJWeaverMessageHandler @@ -44,9 +44,9 @@ public class AspectJWeaverMessageHandler implements IMessageHandler { private static final String AJ_ID = "[AspectJ] "; - + private static final Log LOGGER = LogFactory.getLog("AspectJ Weaver"); - + public boolean handleMessage(IMessage message) throws AbortException { Kind messageKind = message.getKind(); @@ -56,39 +56,39 @@ public boolean handleMessage(IMessage message) throws AbortException { LOGGER.debug(makeMessageFor(message)); return true; } - } - + } + if (LOGGER.isInfoEnabled()) { if ((messageKind == IMessage.INFO) || (messageKind == IMessage.WEAVEINFO)) { LOGGER.info(makeMessageFor(message)); return true; } - } - + } + if (LOGGER.isWarnEnabled()) { if (messageKind == IMessage.WARNING) { LOGGER.warn(makeMessageFor(message)); return true; } } - + if (LOGGER.isErrorEnabled()) { if (messageKind == IMessage.ERROR) { LOGGER.error(makeMessageFor(message)); return true; } } - + if (LOGGER.isFatalEnabled()) { if (messageKind == IMessage.ABORT) { LOGGER.fatal(makeMessageFor(message)); return true; } } - + return false; } - + private String makeMessageFor(IMessage aMessage) { return AJ_ID + aMessage.getMessage(); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/DeclareParentsAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/DeclareParentsAdvisor.java index a60227a5df22..dfdcb67f4ebd 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/DeclareParentsAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/DeclareParentsAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ */ public class DeclareParentsAdvisor implements IntroductionAdvisor { - private final Class introducedInterface; + private final Class introducedInterface; private final ClassFilter typePatternClassFilter; @@ -47,8 +47,8 @@ public class DeclareParentsAdvisor implements IntroductionAdvisor { * @param typePattern type pattern the introduction is restricted to * @param defaultImpl the default implementation class */ - public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defaultImpl) { - this(interfaceType, typePattern, defaultImpl, + public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defaultImpl) { + this(interfaceType, typePattern, defaultImpl, new DelegatePerTargetObjectIntroductionInterceptor(defaultImpl, interfaceType)); } @@ -58,8 +58,8 @@ public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defa * @param typePattern type pattern the introduction is restricted to * @param delegateRef the delegate implementation object */ - public DeclareParentsAdvisor(Class interfaceType, String typePattern, Object delegateRef) { - this(interfaceType, typePattern, delegateRef.getClass(), + public DeclareParentsAdvisor(Class interfaceType, String typePattern, Object delegateRef) { + this(interfaceType, typePattern, delegateRef.getClass(), new DelegatingIntroductionInterceptor(delegateRef)); } @@ -71,13 +71,13 @@ public DeclareParentsAdvisor(Class interfaceType, String typePattern, Object del * @param implementationClass implementation class * @param advice delegation advice */ - private DeclareParentsAdvisor(Class interfaceType, String typePattern, Class implementationClass, Advice advice) { + private DeclareParentsAdvisor(Class interfaceType, String typePattern, Class implementationClass, Advice advice) { this.introducedInterface = interfaceType; ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern); // Excludes methods implemented. ClassFilter exclusion = new ClassFilter() { - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { return !(introducedInterface.isAssignableFrom(clazz)); } }; @@ -103,7 +103,7 @@ public Advice getAdvice() { return this.advice; } - public Class[] getInterfaces() { + public Class[] getInterfaces() { return new Class[] {this.introducedInterface}; } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java index 6668a8b0155f..9263e39e9e62 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ * @since 2.0 */ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, JoinPoint.StaticPart { - + private final ProxyMethodInvocation methodInvocation; private Object[] defensiveCopyOfArgs; @@ -169,7 +169,7 @@ public int getModifiers() { return methodInvocation.getMethod().getModifiers(); } - public Class getDeclaringType() { + public Class getDeclaringType() { return methodInvocation.getMethod().getDeclaringClass(); } @@ -177,7 +177,7 @@ public String getDeclaringTypeName() { return methodInvocation.getMethod().getDeclaringClass().getName(); } - public Class getReturnType() { + public Class getReturnType() { return methodInvocation.getMethod().getReturnType(); } @@ -185,7 +185,7 @@ public Method getMethod() { return methodInvocation.getMethod(); } - public Class[] getParameterTypes() { + public Class[] getParameterTypes() { return methodInvocation.getMethod().getParameterTypes(); } @@ -196,7 +196,7 @@ public String[] getParameterNames() { return this.parameterNames; } - public Class[] getExceptionTypes() { + public Class[] getExceptionTypes() { return methodInvocation.getMethod().getExceptionTypes(); } @@ -227,7 +227,7 @@ private String toString(boolean includeModifier, boolean includeReturnTypeAndArg sb.append("."); sb.append(getMethod().getName()); sb.append("("); - Class[] parametersTypes = getParameterTypes(); + Class[] parametersTypes = getParameterTypes(); appendTypes(sb, parametersTypes, includeReturnTypeAndArgs, useLongReturnAndArgumentTypeName); sb.append(")"); return sb.toString(); @@ -267,7 +267,7 @@ private void appendType(StringBuilder sb, Class type, boolean useLongTypeName */ private class SourceLocationImpl implements SourceLocation { - public Class getWithinType() { + public Class getWithinType() { if (methodInvocation.getThis() == null) { throw new UnsupportedOperationException("No source location joinpoint available: target is null"); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java index 1af86cc41715..57987510c07d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ /** * This class encapsulates some AspectJ internal knowledge that should be - * pushed back into the AspectJ project in a future release. + * pushed back into the AspectJ project in a future release. * *

It relies on implementation specific knowledge in AspectJ to break * encapsulation and do something AspectJ was not designed to do: query @@ -87,12 +87,12 @@ public boolean testsSubtypeSensitiveVars() { new SubtypeSensitiveVarTypeTestVisitor().testsSubtypeSensitiveVars(this.runtimeTest)); } - public boolean testThisInstanceOfResidue(Class thisClass) { + public boolean testThisInstanceOfResidue(Class thisClass) { return (this.runtimeTest != null && new ThisInstanceOfResidueTestVisitor(thisClass).thisInstanceOfMatches(this.runtimeTest)); } - public boolean testTargetInstanceOfResidue(Class targetClass) { + public boolean testTargetInstanceOfResidue(Class targetClass) { return (this.runtimeTest != null && new TargetInstanceOfResidueTestVisitor(targetClass).targetInstanceOfMatches(this.runtimeTest)); } @@ -137,7 +137,7 @@ public void visit(HasAnnotation hasAnnotation) { public void visit(MatchingContextBasedTest matchingContextTest) { } - + protected int getVarType(ReflectionVar v) { try { Field varTypeField = ReflectionVar.class.getDeclaredField("varType"); @@ -160,16 +160,16 @@ protected int getVarType(ReflectionVar v) { private static abstract class InstanceOfResidueTestVisitor extends TestVisitorAdapter { - private Class matchClass; + private Class matchClass; private boolean matches; private int matchVarType; - public InstanceOfResidueTestVisitor(Class matchClass, boolean defaultMatches, int matchVarType) { + public InstanceOfResidueTestVisitor(Class matchClass, boolean defaultMatches, int matchVarType) { this.matchClass = matchClass; this.matches = defaultMatches; this.matchVarType = matchVarType; } - + public boolean instanceOfMatches(Test test) { test.accept(this); return matches; @@ -183,7 +183,7 @@ public void visit(Instanceof i) { return; } try { - Class typeClass = ClassUtils.forName(type.getName(), this.matchClass.getClassLoader()); + Class typeClass = ClassUtils.forName(type.getName(), this.matchClass.getClassLoader()); // Don't use ReflectionType.isAssignableFrom() as it won't be aware of (Spring) mixins this.matches = typeClass.isAssignableFrom(this.matchClass); } @@ -199,7 +199,7 @@ public void visit(Instanceof i) { */ private static class TargetInstanceOfResidueTestVisitor extends InstanceOfResidueTestVisitor { - public TargetInstanceOfResidueTestVisitor(Class targetClass) { + public TargetInstanceOfResidueTestVisitor(Class targetClass) { super(targetClass, false, TARGET_VAR); } @@ -214,7 +214,7 @@ public boolean targetInstanceOfMatches(Test test) { */ private static class ThisInstanceOfResidueTestVisitor extends InstanceOfResidueTestVisitor { - public ThisInstanceOfResidueTestVisitor(Class thisClass) { + public ThisInstanceOfResidueTestVisitor(Class thisClass) { super(thisClass, true, THIS_VAR); } @@ -236,7 +236,7 @@ public boolean testsSubtypeSensitiveVars(Test aTest) { aTest.accept(this); return this.testsSubtypeSensitiveVars; } - + @Override public void visit(Instanceof i) { ReflectionVar v = (ReflectionVar) i.getVar(); diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/SimpleAspectInstanceFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/SimpleAspectInstanceFactory.java index 8c0f70fe9866..762273131cd5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/SimpleAspectInstanceFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/SimpleAspectInstanceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,14 +29,14 @@ */ public class SimpleAspectInstanceFactory implements AspectInstanceFactory { - private final Class aspectClass; + private final Class aspectClass; /** * Create a new SimpleAspectInstanceFactory for the given aspect class. * @param aspectClass the aspect class */ - public SimpleAspectInstanceFactory(Class aspectClass) { + public SimpleAspectInstanceFactory(Class aspectClass) { Assert.notNull(aspectClass, "Aspect class must not be null"); this.aspectClass = aspectClass; } @@ -44,7 +44,7 @@ public SimpleAspectInstanceFactory(Class aspectClass) { /** * Return the specified aspect class (never null). */ - public final Class getAspectClass() { + public final Class getAspectClass() { return this.aspectClass; } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/SingletonAspectInstanceFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/SingletonAspectInstanceFactory.java index 53e860022404..c50b359452b7 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/SingletonAspectInstanceFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/SingletonAspectInstanceFactory.java @@ -30,7 +30,7 @@ * @see SimpleAspectInstanceFactory */ public class SingletonAspectInstanceFactory implements AspectInstanceFactory { - + private final Object aspectInstance; diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java index 984c46f4f9b9..d7d60a74914d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ public TypePatternClassFilter() { } /** - * Create a fully configured {@link TypePatternClassFilter} using the + * Create a fully configured {@link TypePatternClassFilter} using the * given type pattern. * @param typePattern the type pattern that AspectJ weaver should parse * @throws IllegalArgumentException if the supplied typePattern is null - * or is recognized as invalid + * or is recognized as invalid */ public TypePatternClassFilter(String typePattern) { setTypePattern(typePattern); @@ -73,7 +73,7 @@ public TypePatternClassFilter(String typePattern) { *

These conventions are established by AspectJ, not Spring AOP. * @param typePattern the type pattern that AspectJ weaver should parse * @throws IllegalArgumentException if the supplied typePattern is null - * or is recognized as invalid + * or is recognized as invalid */ public void setTypePattern(String typePattern) { Assert.notNull(typePattern); @@ -93,7 +93,7 @@ public String getTypePattern() { * @return whether the advice should apply to this candidate target class * @throws IllegalStateException if no {@link #setTypePattern(String)} has been set */ - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { if (this.aspectJTypePatternMatcher == null) { throw new IllegalStateException("No 'typePattern' has been set via ctor/setter."); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java index cb09937a3957..2897108af216 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ * @since 2.0 */ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFactory { - + protected static final ParameterNameDiscoverer ASPECTJ_ANNOTATION_PARAMETER_NAME_DISCOVERER = new AspectJAnnotationParameterNameDiscoverer(); @@ -70,11 +70,11 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac * (there should only be one anyway...) */ @SuppressWarnings("unchecked") - protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) { + protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) { Class[] classesToLookFor = new Class[] { Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class}; for (Class c : classesToLookFor) { - AspectJAnnotation foundAnnotation = findAnnotation(method, c); + AspectJAnnotation foundAnnotation = findAnnotation(method, c); if (foundAnnotation != null) { return foundAnnotation; } @@ -121,7 +121,7 @@ private boolean hasAspectAnnotation(Class clazz) { /** * We need to detect this as "code-style" AspectJ aspects should not be - * interpreted by Spring AOP. + * interpreted by Spring AOP. */ private boolean compiledByAjc(Class clazz) { // The AJTypeSystem goes to great lengths to provide a uniform appearance between code-style and @@ -154,28 +154,28 @@ public void validate(Class aspectClass) throws AopConfigException { if (ajType.getPerClause().getKind() == PerClauseKind.PERCFLOWBELOW) { throw new AopConfigException(aspectClass.getName() + " uses percflowbelow instantiation model: " + "This is not supported in Spring AOP."); - } + } } /** - * The pointcut and advice annotations both have an "argNames" member which contains a + * The pointcut and advice annotations both have an "argNames" member which contains a * comma-separated list of the argument names. We use this (if non-empty) to build the * formal parameters for the pointcut. */ protected AspectJExpressionPointcut createPointcutExpression( - Method annotatedMethod, Class declarationScope, String[] pointcutParameterNames) { + Method annotatedMethod, Class declarationScope, String[] pointcutParameterNames) { Class [] pointcutParameterTypes = new Class[0]; if (pointcutParameterNames != null) { pointcutParameterTypes = extractPointcutParameterTypes(pointcutParameterNames,annotatedMethod); } - + AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(declarationScope,pointcutParameterNames,pointcutParameterTypes); ajexp.setLocation(annotatedMethod.toString()); return ajexp; } - + /** * Create the pointcut parameters needed by aspectj based on the given argument names * and the argument types that are available from the adviceMethod. Needs to take into @@ -217,8 +217,8 @@ protected static class AspectJAnnotation { private static final String[] EXPRESSION_PROPERTIES = new String[] {"value", "pointcut"}; - private static Map annotationTypes = - new HashMap(); + private static Map, AspectJAnnotationType> annotationTypes = + new HashMap, AspectJAnnotationType>(); static { annotationTypes.put(Pointcut.class,AspectJAnnotationType.AtPointcut); @@ -252,7 +252,7 @@ public AspectJAnnotation(A annotation) { } private AspectJAnnotationType determineAnnotationType(A annotation) { - for (Class type : annotationTypes.keySet()) { + for (Class type : annotationTypes.keySet()) { if (type.isInstance(annotation)) { return annotationTypes.get(type); } @@ -313,7 +313,7 @@ public String[] getParameterNames(Method method) { if (method.getParameterTypes().length == 0) { return new String[0]; } - AspectJAnnotation annotation = findAspectJAnnotationOnMethod(method); + AspectJAnnotation annotation = findAspectJAnnotationOnMethod(method); if (annotation == null) { return null; } @@ -326,11 +326,11 @@ public String[] getParameterNames(Method method) { return names; } else { - return null; + return null; } } - - public String[] getParameterNames(Constructor ctor) { + + public String[] getParameterNames(Constructor ctor) { throw new UnsupportedOperationException("Spring AOP cannot handle constructor advice"); } } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AnnotationAwareAspectJAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AnnotationAwareAspectJAutoProxyCreator.java index d19a5d7c6730..b12d3224014a 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AnnotationAwareAspectJAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AnnotationAwareAspectJAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ protected List findCandidateAdvisors() { } @Override - protected boolean isInfrastructureClass(Class beanClass) { + protected boolean isInfrastructureClass(Class beanClass) { // Previously we setProxyTargetClass(true) in the constructor, but that has too // broad an impact. Instead we now override isInfrastructureClass to avoid proxying // aspects. I'm not entirely happy with that as there is no good reason not diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorFactory.java index d6141af1ab81..7dfa68fbff4c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java index cbe06d3c2735..e2ab4d6634a1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java @@ -49,7 +49,7 @@ public class AspectJProxyFactory extends ProxyCreatorSupport { /** Cache for singleton aspect instances */ - private static final Map aspectCache = new HashMap(); + private static final Map, Object> aspectCache = new HashMap, Object>(); private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory(); @@ -75,7 +75,7 @@ public AspectJProxyFactory(Object target) { * Create a new AspectJProxyFactory. * No target, only interfaces. Must add interceptors. */ - public AspectJProxyFactory(Class[] interfaces) { + public AspectJProxyFactory(Class[] interfaces) { setInterfaces(interfaces); } @@ -88,7 +88,7 @@ public AspectJProxyFactory(Class[] interfaces) { * @param aspectInstance the AspectJ aspect instance */ public void addAspect(Object aspectInstance) { - Class aspectClass = aspectInstance.getClass(); + Class aspectClass = aspectInstance.getClass(); String aspectName = aspectClass.getName(); AspectMetadata am = createAspectMetadata(aspectClass, aspectName); if (am.getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON) { @@ -103,7 +103,7 @@ public void addAspect(Object aspectInstance) { * Add an aspect of the supplied type to the end of the advice chain. * @param aspectClass the AspectJ aspect class */ - public void addAspect(Class aspectClass) { + public void addAspect(Class aspectClass) { String aspectName = aspectClass.getName(); AspectMetadata am = createAspectMetadata(aspectClass, aspectName); MetadataAwareAspectInstanceFactory instanceFactory = createAspectInstanceFactory(am, aspectClass, aspectName); @@ -127,7 +127,7 @@ private void addAdvisorsFromAspectInstanceFactory(MetadataAwareAspectInstanceFac /** * Create an {@link AspectMetadata} instance for the supplied aspect type. */ - private AspectMetadata createAspectMetadata(Class aspectClass, String aspectName) { + private AspectMetadata createAspectMetadata(Class aspectClass, String aspectName) { AspectMetadata am = new AspectMetadata(aspectClass, aspectName); if (!am.getAjType().isAspect()) { throw new IllegalArgumentException("Class [" + aspectClass.getName() + "] is not a valid aspect type"); @@ -141,7 +141,7 @@ private AspectMetadata createAspectMetadata(Class aspectClass, String aspectName * a {@link PrototypeAspectInstanceFactory} is returned. */ private MetadataAwareAspectInstanceFactory createAspectInstanceFactory( - AspectMetadata am, Class aspectClass, String aspectName) { + AspectMetadata am, Class aspectClass, String aspectName) { MetadataAwareAspectInstanceFactory instanceFactory = null; if (am.getAjType().getPerClause().getKind() == PerClauseKind.SINGLETON) { @@ -160,7 +160,7 @@ private MetadataAwareAspectInstanceFactory createAspectInstanceFactory( * Get the singleton aspect instance for the supplied aspect type. An instance * is created if one cannot be found in the instance cache. */ - private Object getSingletonAspectInstance(Class aspectClass) { + private Object getSingletonAspectInstance(Class aspectClass) { synchronized (aspectCache) { Object instance = aspectCache.get(aspectClass); if (instance != null) { diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java index cde9f43ef30c..2278185e174b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public class AspectMetadata { /** * AspectJ reflection information (AspectJ 5 / Java 5 specific). */ - private final AjType ajType; + private final AjType ajType; /** * Spring AOP pointcut corresponding to the per clause of the @@ -55,8 +55,8 @@ public class AspectMetadata { private final Pointcut perClausePointcut; /** - * The name of this aspect as defined to Spring (the bean name) - - * allows us to determine if two pieces of advice come from the + * The name of this aspect as defined to Spring (the bean name) - + * allows us to determine if two pieces of advice come from the * same aspect and hence their relative precedence. */ private String aspectName; @@ -71,9 +71,9 @@ public AspectMetadata(Class aspectClass, String aspectName) { this.aspectName = aspectName; Class currClass = aspectClass; - AjType ajType = null; + AjType ajType = null; while (!currClass.equals(Object.class)) { - AjType ajTypeToCheck = AjTypeSystem.getAjType(currClass); + AjType ajTypeToCheck = AjTypeSystem.getAjType(currClass); if (ajTypeToCheck.isAspect()) { ajType = ajTypeToCheck; break; @@ -124,14 +124,14 @@ private String findPerClause(Class aspectClass) { /** * Return AspectJ reflection information. */ - public AjType getAjType() { + public AjType getAjType() { return this.ajType; } /** * Return the aspect class. */ - public Class getAspectClass() { + public Class getAspectClass() { return this.ajType.getJavaClass(); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java index a640e364584a..0caceeeb4b9d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectInstanceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ * backed by a Spring {@link org.springframework.beans.factory.BeanFactory}. * *

Note that this may instantiate multiple times if using a prototype, - * which probably won't give the semantics you expect. + * which probably won't give the semantics you expect. * Use a {@link LazySingletonAspectInstanceFactoryDecorator} * to wrap this to ensure only one new aspect comes back. * @@ -56,7 +56,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) { this(beanFactory, name, beanFactory.getType(name)); } - + /** * Create a BeanFactoryAspectInstanceFactory, providing a type that AspectJ should * introspect to create AJType metadata. Use if the BeanFactory may consider the type @@ -65,7 +65,7 @@ public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name) { * @param name the name of the bean * @param type the type that should be introspected by AspectJ */ - public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class type) { + public BeanFactoryAspectInstanceFactory(BeanFactory beanFactory, String name, Class type) { this.beanFactory = beanFactory; this.name = name; this.aspectMetadata = new AspectMetadata(type, name); diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java index c3c6de336517..fe126b0df38e 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,7 +96,7 @@ public List buildAspectJAdvisors() { // We must be careful not to instantiate beans eagerly as in this // case they would be cached by the Spring container but would not // have been weaved - Class beanType = this.beanFactory.getType(beanName); + Class beanType = this.beanFactory.getType(beanName); if (beanType == null) { continue; } @@ -134,7 +134,7 @@ public List buildAspectJAdvisors() { } if (aspectNames.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } List advisors = new LinkedList(); for (String aspectName : aspectNames) { diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java index 433a33bb6b08..8c59e5ffb137 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/InstantiationModelAwarePointcutAdvisorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,30 +41,30 @@ class InstantiationModelAwarePointcutAdvisorImpl implements InstantiationModelAwarePointcutAdvisor, AspectJPrecedenceInformation { private final AspectJExpressionPointcut declaredPointcut; - + private Pointcut pointcut; - + private final MetadataAwareAspectInstanceFactory aspectInstanceFactory; - + private final Method method; - + private final boolean lazy; - + private final AspectJAdvisorFactory atAspectJAdvisorFactory; - + private Advice instantiatedAdvice; private int declarationOrder; - + private String aspectName; - + private Boolean isBeforeAdvice; private Boolean isAfterAdvice; - public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, AspectJExpressionPointcut ajexp, - MetadataAwareAspectInstanceFactory aif, Method method, int declarationOrderInAspect, String aspectName) { + public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, AspectJExpressionPointcut ajexp, + MetadataAwareAspectInstanceFactory aif, Method method, int declarationOrderInAspect, String aspectName) { this.declaredPointcut = ajexp; this.method = method; @@ -72,12 +72,12 @@ public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, Asp this.aspectInstanceFactory = aif; this.declarationOrder = declarationOrderInAspect; this.aspectName = aspectName; - + if (aif.getAspectMetadata().isLazilyInstantiated()) { // Static part of the pointcut is a lazy type. Pointcut preInstantiationPointcut = Pointcuts.union(aif.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut); - + // Make it dynamic: must mutate from pre-instantiation to post-instantiation state. // If it's not a dynamic pointcut, it may be optimized out // by the Spring AOP infrastructure after the first evaluation. @@ -109,7 +109,7 @@ public Pointcut getPointcut() { public boolean isPerInstance() { return (getAspectMetadata().getAjType().getPerClause().getKind() != PerClauseKind.SINGLETON); } - + /** * Return the AspectJ AspectMetadata for this advisor. */ @@ -126,7 +126,7 @@ public synchronized Advice getAdvice() { } return this.instantiatedAdvice; } - + public boolean isLazy() { return this.lazy; } @@ -140,7 +140,7 @@ private Advice instantiateAdvice(AspectJExpressionPointcut pcut) { return this.atAspectJAdvisorFactory.getAdvice( this.method, pcut, this.aspectInstanceFactory, this.declarationOrder, this.aspectName); } - + public MetadataAwareAspectInstanceFactory getAspectInstanceFactory() { return this.aspectInstanceFactory; } @@ -239,13 +239,13 @@ private PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPo } @Override - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { // We're either instantiated and matching on declared pointcut, or uninstantiated matching on either pointcut return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass)) || this.preInstantiationPointcut.getMethodMatcher().matches(method, targetClass); } - public boolean matches(Method method, Class targetClass, Object[] args) { + public boolean matches(Method method, Class targetClass, Object[] args) { // This can match only on declared pointcut. return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass)); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java index c2e356678a7a..35ade227ce5c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java @@ -203,7 +203,7 @@ public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut return null; } - // If we get here, we know we have an AspectJ method. + // If we get here, we know we have an AspectJ method. // Check that it's an AspectJ-annotated class if (!isAspect(candidateAspectClass)) { throw new AopConfigException("Advice must be declared inside an aspect type: " + diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java index 33d19a8811be..10a6669dcc68 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/SimpleMetadataAwareAspectInstanceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public class SimpleMetadataAwareAspectInstanceFactory extends SimpleAspectInstan * @param aspectClass the aspect class * @param aspectName the aspect name */ - public SimpleMetadataAwareAspectInstanceFactory(Class aspectClass, String aspectName) { + public SimpleMetadataAwareAspectInstanceFactory(Class aspectClass, String aspectName) { super(aspectClass); this.metadata = new AspectMetadata(aspectClass, aspectName); } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java index b0f747284bf8..36b3f59f3d0e 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/package-info.java @@ -2,7 +2,7 @@ /** * * Classes enabling AspectJ 5 @Annotated classes to be used in Spring AOP. - * + * *

Normally to be used through an AspectJAutoProxyCreator rather than directly. * */ diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java index 0cb786cc255d..b731d3e90e75 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ */ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator { - private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator(); + private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator(); /** @@ -72,22 +72,21 @@ protected List sortAdvisors(List advisors) { for (Advisor element : advisors) { partiallyComparableAdvisors.add( new PartiallyComparableAdvisorHolder(element, DEFAULT_PRECEDENCE_COMPARATOR)); - } - + } + // sort it - List sorted = - (List) PartialOrder.sort(partiallyComparableAdvisors); + List sorted = PartialOrder.sort(partiallyComparableAdvisors); if (sorted == null) { // TODO: work harder to give a better error message here. throw new IllegalArgumentException("Advice precedence circularity error"); } - + // extract results again List result = new LinkedList(); for (PartiallyComparableAdvisorHolder pcAdvisor : sorted) { result.add(pcAdvisor.getAdvisor()); } - + return result; } @@ -102,7 +101,7 @@ protected void extendAdvisors(List candidateAdvisors) { } @Override - protected boolean shouldSkip(Class beanClass, String beanName) { + protected boolean shouldSkip(Class beanClass, String beanName) { // TODO: Consider optimization by caching the list of the aspect names List candidateAdvisors = findCandidateAdvisors(); for (Advisor advisor : candidateAdvisors) { @@ -123,9 +122,9 @@ private static class PartiallyComparableAdvisorHolder implements PartialComparab private final Advisor advisor; - private final Comparator comparator; + private final Comparator comparator; - public PartiallyComparableAdvisorHolder(Advisor advisor, Comparator comparator) { + public PartiallyComparableAdvisorHolder(Advisor advisor, Comparator comparator) { this.advisor = advisor; this.comparator = comparator; } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java index c293f0be721a..2445accb43c6 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ * @author Juergen Hoeller * @since 2.0 */ -class AspectJPrecedenceComparator implements Comparator { +class AspectJPrecedenceComparator implements Comparator { private static final int HIGHER_PRECEDENCE = -1; private static final int SAME_PRECEDENCE = 0; @@ -106,14 +106,14 @@ private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) { boolean oneOrOtherIsAfterAdvice = (AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2)); int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2); - + if (oneOrOtherIsAfterAdvice) { // the advice declared last has higher precedence if (adviceDeclarationOrderDelta < 0) { // advice1 was declared before advice2 // so advice1 has lower precedence return LOWER_PRECEDENCE; - } + } else if (adviceDeclarationOrderDelta == 0) { return SAME_PRECEDENCE; } @@ -153,7 +153,7 @@ private String getAspectName(Advisor anAdvisor) { } private int getAspectDeclarationOrder(Advisor anAdvisor) { - AspectJPrecedenceInformation precedenceInfo = + AspectJPrecedenceInformation precedenceInfo = AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor); if (precedenceInfo != null) { return precedenceInfo.getDeclarationOrder(); diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java index 8355bc30826e..6dc2fdb0c0bb 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/package-info.java @@ -5,7 +5,7 @@ * annotation-style methods, and an AspectJExpressionPointcut: a Spring AOP Pointcut * implementation that allows use of the AspectJ pointcut expression language with the Spring AOP * runtime framework. - * + * *

Note that use of this package does not require the use of the ajc compiler * or AspectJ load-time weaver. It is intended to enable the use of a valuable subset of AspectJ * functionality, with consistent semantics, with the proxy-based Spring AOP framework. diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java b/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java index 43de1f644660..f041fef0b26d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AbstractInterceptorDrivenBeanDefinitionDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement public final BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definitionHolder, ParserContext parserContext) { BeanDefinitionRegistry registry = parserContext.getRegistry(); - + // get the root bean name - will be the name of the generated proxy factory bean String existingBeanName = definitionHolder.getBeanName(); BeanDefinition targetDefinition = definitionHolder.getBeanDefinition(); diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java b/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java index 4fa6a8a5524e..180ea636a365 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java @@ -20,7 +20,7 @@ /** * {@link ParseState} entry representing an advice element. - * + * * @author Mark Fisher * @since 2.0 */ diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java b/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java index fa635ae7a953..dc3b4f9ea8ee 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java @@ -20,7 +20,7 @@ /** * {@link ParseState} entry representing an advisor. - * + * * @author Mark Fisher * @since 2.0 */ diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java b/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java index dd568a51bd3b..297e2baf6b90 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +31,8 @@ /** * Utility class for handling registration of AOP auto-proxy creators. * - *

Only a single auto-proxy creator can be registered yet multiple concrete - * implementations are available. Therefore this class wraps a simple escalation + *

Only a single auto-proxy creator can be registered yet multiple concrete + * implementations are available. Therefore this class wraps a simple escalation * protocol, allowing classes to request a particular auto-proxy creator and know * that class, or a subclass thereof, will eventually be resident * in the application context. @@ -54,7 +54,7 @@ public abstract class AopConfigUtils { /** * Stores the auto proxy creator classes in escalation order. */ - private static final List APC_PRIORITY_LIST = new ArrayList(); + private static final List> APC_PRIORITY_LIST = new ArrayList>(); /** * Setup the escalation list. @@ -105,7 +105,7 @@ static void forceAutoProxyCreatorToExposeProxy(BeanDefinitionRegistry registry) } - private static BeanDefinition registerOrEscalateApcAsRequired(Class cls, BeanDefinitionRegistry registry, Object source) { + private static BeanDefinition registerOrEscalateApcAsRequired(Class cls, BeanDefinitionRegistry registry, Object source) { Assert.notNull(registry, "BeanDefinitionRegistry must not be null"); if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) { BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME); @@ -126,13 +126,13 @@ private static BeanDefinition registerOrEscalateApcAsRequired(Class cls, BeanDef return beanDefinition; } - private static int findPriorityForClass(Class clazz) { + private static int findPriorityForClass(Class clazz) { return APC_PRIORITY_LIST.indexOf(clazz); } private static int findPriorityForClass(String className) { for (int i = 0; i < APC_PRIORITY_LIST.size(); i++) { - Class clazz = APC_PRIORITY_LIST.get(i); + Class clazz = APC_PRIORITY_LIST.get(i); if (clazz.getName().equals(className)) { return i; } diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java b/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java index ae9888dca4de..e99ff42ea80f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java b/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java index 0aca37520bae..6c9359a9c441 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java b/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java index de8beff487c1..9845c601a061 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,7 +93,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser { private static final int ASPECT_INSTANCE_FACTORY_INDEX = 2; private ParseState parseState = new ParseState(); - + public BeanDefinition parse(Element element, ParserContext parserContext) { CompositeComponentDefinition compositeDef = @@ -281,10 +281,10 @@ private AbstractBeanDefinition parseDeclareParents(Element declareParentsElement BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(DeclareParentsAdvisor.class); builder.addConstructorArgValue(declareParentsElement.getAttribute(IMPLEMENT_INTERFACE)); builder.addConstructorArgValue(declareParentsElement.getAttribute(TYPE_PATTERN)); - + String defaultImpl = declareParentsElement.getAttribute(DEFAULT_IMPL); String delegateRef = declareParentsElement.getAttribute(DELEGATE_REF); - + if (StringUtils.hasText(defaultImpl) && !StringUtils.hasText(delegateRef)) { builder.addConstructorArgValue(defaultImpl); } @@ -404,7 +404,7 @@ else if (pointcut instanceof String) { /** * Gets the advice implementation class corresponding to the supplied {@link Element}. */ - private Class getAdviceClass(Element adviceElement, ParserContext parserContext) { + private Class getAdviceClass(Element adviceElement, ParserContext parserContext) { String elementName = parserContext.getDelegate().getLocalName(adviceElement); if (BEFORE.equals(elementName)) { return AspectJMethodBeforeAdvice.class; @@ -435,7 +435,7 @@ private AbstractBeanDefinition parsePointcut(Element pointcutElement, ParserCont String expression = pointcutElement.getAttribute(EXPRESSION); AbstractBeanDefinition pointcutDefinition = null; - + try { this.parseState.push(new PointcutEntry(id)); pointcutDefinition = createPointcutDefinition(expression); @@ -462,7 +462,7 @@ private AbstractBeanDefinition parsePointcut(Element pointcutElement, ParserCont /** * Parses the pointcut or pointcut-ref attributes of the supplied * {@link Element} and add a pointcut property as appropriate. Generates a - * {@link org.springframework.beans.factory.config.BeanDefinition} for the pointcut if necessary + * {@link org.springframework.beans.factory.config.BeanDefinition} for the pointcut if necessary * and returns its bean name, otherwise returns the bean name of the referred pointcut. */ private Object parsePointcutProperty(Element element, ParserContext parserContext) { diff --git a/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java index 5891bc8455fd..a34a78dddf13 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/MethodLocatingFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ public void setBeanFactory(BeanFactory beanFactory) { throw new IllegalArgumentException("Property 'methodName' is required"); } - Class beanClass = beanFactory.getType(this.targetBeanName); + Class beanClass = beanFactory.getType(this.targetBeanName); if (beanClass == null) { throw new IllegalArgumentException("Can't determine type of bean with name '" + this.targetBeanName + "'"); } diff --git a/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java b/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java index c308d5b83316..e1cf5f65f329 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java @@ -20,7 +20,7 @@ /** * {@link ParseState} entry representing a pointcut. - * + * * @author Mark Fisher * @since 2.0 */ diff --git a/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java b/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java index ac118d7096cc..daf10524ba72 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/ScopedProxyBeanDefinitionDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS)); } } - + // Register the original bean definition as it will be referenced by the scoped proxy // and is relevant for tooling (validation, navigation). BeanDefinitionHolder holder = diff --git a/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java b/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java index 36c2a9c91182..21bf0edd5be3 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java b/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java index 397c97b7698b..dd7419a6bcc0 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/Advised.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,13 +52,13 @@ public interface Advised extends TargetClassAware { * Return the interfaces proxied by the AOP proxy. Will not * include the target class, which may also be proxied. */ - Class[] getProxiedInterfaces(); + Class[] getProxiedInterfaces(); /** * Determine whether the given interface is proxied. * @param intf the interface to check */ - boolean isInterfaceProxied(Class intf); + boolean isInterfaceProxied(Class intf); /** @@ -124,7 +124,7 @@ public interface Advised extends TargetClassAware { */ void addAdvisor(Advisor advisor) throws AopConfigException; - /** + /** * Add an Advisor at the specified position in the chain. * @param advisor the advisor to add at the specified position in the chain * @param pos position in chain (0 is head). Must be valid. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java index ebb59896ec6a..9c9871d8a789 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,6 @@ * @author Juergen Hoeller * @see org.springframework.aop.framework.AopProxy */ -@SuppressWarnings("unchecked") public class AdvisedSupport extends ProxyConfig implements Advised { /** use serialVersionUID from Spring 2.0 for interoperability */ @@ -88,7 +87,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { * Interfaces to be implemented by the proxy. Held in List to keep the order * of registration, to create JDK proxy with specified order of interfaces. */ - private List interfaces = new ArrayList(); + private List> interfaces = new ArrayList>(); /** * List of Advisors. If an Advice is added, it will be wrapped @@ -114,7 +113,7 @@ public AdvisedSupport() { * Create a AdvisedSupport instance with the given parameters. * @param interfaces the proxied interfaces */ - public AdvisedSupport(Class[] interfaces) { + public AdvisedSupport(Class[] interfaces) { this(); setInterfaces(interfaces); } @@ -158,7 +157,7 @@ public TargetSource getTargetSource() { * @see #setTargetSource * @see #setTarget */ - public void setTargetClass(Class targetClass) { + public void setTargetClass(Class targetClass) { this.targetSource = EmptyTargetSource.forClass(targetClass); } @@ -194,10 +193,10 @@ public AdvisorChainFactory getAdvisorChainFactory() { /** * Set the interfaces to be proxied. */ - public void setInterfaces(Class[] interfaces) { + public void setInterfaces(Class[] interfaces) { Assert.notNull(interfaces, "Interfaces must not be null"); this.interfaces.clear(); - for (Class ifc : interfaces) { + for (Class ifc : interfaces) { addInterface(ifc); } } @@ -206,7 +205,7 @@ public void setInterfaces(Class[] interfaces) { * Add a new proxied interface. * @param intf the additional interface to proxy */ - public void addInterface(Class intf) { + public void addInterface(Class intf) { Assert.notNull(intf, "Interface must not be null"); if (!intf.isInterface()) { throw new IllegalArgumentException("[" + intf.getName() + "] is not an interface"); @@ -224,16 +223,16 @@ public void addInterface(Class intf) { * @return true if the interface was removed; false * if the interface was not found and hence could not be removed */ - public boolean removeInterface(Class intf) { + public boolean removeInterface(Class intf) { return this.interfaces.remove(intf); } - public Class[] getProxiedInterfaces() { + public Class[] getProxiedInterfaces() { return this.interfaces.toArray(new Class[this.interfaces.size()]); } - public boolean isInterfaceProxied(Class intf) { - for (Class proxyIntf : this.interfaces) { + public boolean isInterfaceProxied(Class intf) { + for (Class proxyIntf : this.interfaces) { if (intf.isAssignableFrom(proxyIntf)) { return true; } @@ -351,8 +350,8 @@ public void addAdvisors(Collection advisors) { private void validateIntroductionAdvisor(IntroductionAdvisor advisor) { advisor.validateInterfaces(); // If the advisor passed validation, we can make the change. - Class[] ifcs = advisor.getInterfaces(); - for (Class ifc : ifcs) { + Class[] ifcs = advisor.getInterfaces(); + for (Class ifc : ifcs) { addInterface(ifc); } } @@ -455,7 +454,7 @@ public boolean adviceIncluded(Advice advice) { * @param adviceClass the advice class to check * @return the count of the interceptors of this class or subclasses */ - public int countAdvicesOfType(Class adviceClass) { + public int countAdvicesOfType(Class adviceClass) { int count = 0; if (adviceClass != null) { for (Advisor advisor : this.advisors) { @@ -475,7 +474,7 @@ public int countAdvicesOfType(Class adviceClass) { * @param targetClass the target class * @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers) */ - public List getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) { + public List getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) { MethodCacheKey cacheKey = new MethodCacheKey(method); List cached = this.methodCache.get(cacheKey); if (cached == null) { @@ -513,7 +512,7 @@ protected void copyConfigurationFrom(AdvisedSupport other, TargetSource targetSo copyFrom(other); this.targetSource = targetSource; this.advisorChainFactory = other.advisorChainFactory; - this.interfaces = new ArrayList(other.interfaces); + this.interfaces = new ArrayList>(other.interfaces); for (Advisor advisor : advisors) { if (advisor instanceof IntroductionAdvisor) { validateIntroductionAdvisor((IntroductionAdvisor) advisor); diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java index 53bb3b19c555..5ce1d132b912 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/AdvisorChainFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,6 @@ public interface AdvisorChainFactory { * @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers) */ List getInterceptorsAndDynamicInterceptionAdvice( - Advised config, Method method, Class targetClass); + Advised config, Method method, Class targetClass); } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java index d97934f16c2c..595eb35c65d5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyFactory.java @@ -35,7 +35,7 @@ * *

Proxies may or may not allow advice changes to be made. * If they do not permit advice changes (for example, because - * the configuration was frozen) a proxy should throw an + * the configuration was frozen) a proxy should throw an * {@link AopConfigException} on an attempted advice change. * * @author Rod Johnson diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java index 28e48adb4f92..c542056483a2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,11 +78,11 @@ public static Class ultimateTargetClass(Object candidate) { * @see Advised * @see org.springframework.aop.SpringProxy */ - public static Class[] completeProxiedInterfaces(AdvisedSupport advised) { - Class[] specifiedInterfaces = advised.getProxiedInterfaces(); + public static Class[] completeProxiedInterfaces(AdvisedSupport advised) { + Class[] specifiedInterfaces = advised.getProxiedInterfaces(); if (specifiedInterfaces.length == 0) { // No user-specified interfaces: check whether target class is an interface. - Class targetClass = advised.getTargetClass(); + Class targetClass = advised.getTargetClass(); if (targetClass != null && targetClass.isInterface()) { specifiedInterfaces = new Class[] {targetClass}; } @@ -96,7 +96,7 @@ public static Class[] completeProxiedInterfaces(AdvisedSupport advised) { if (addAdvised) { nonUserIfcCount++; } - Class[] proxiedInterfaces = new Class[specifiedInterfaces.length + nonUserIfcCount]; + Class[] proxiedInterfaces = new Class[specifiedInterfaces.length + nonUserIfcCount]; System.arraycopy(specifiedInterfaces, 0, proxiedInterfaces, 0, specifiedInterfaces.length); if (addSpringProxy) { proxiedInterfaces[specifiedInterfaces.length] = SpringProxy.class; @@ -115,8 +115,8 @@ public static Class[] completeProxiedInterfaces(AdvisedSupport advised) { * in the original order (never null or empty) * @see Advised */ - public static Class[] proxiedUserInterfaces(Object proxy) { - Class[] proxyInterfaces = proxy.getClass().getInterfaces(); + public static Class[] proxiedUserInterfaces(Object proxy) { + Class[] proxyInterfaces = proxy.getClass().getInterfaces(); int nonUserIfcCount = 0; if (proxy instanceof SpringProxy) { nonUserIfcCount++; @@ -124,7 +124,7 @@ public static Class[] proxiedUserInterfaces(Object proxy) { if (proxy instanceof Advised) { nonUserIfcCount++; } - Class[] userInterfaces = new Class[proxyInterfaces.length - nonUserIfcCount]; + Class[] userInterfaces = new Class[proxyInterfaces.length - nonUserIfcCount]; System.arraycopy(proxyInterfaces, 0, userInterfaces, 0, userInterfaces.length); Assert.notEmpty(userInterfaces, "JDK proxy must implement one or more interfaces"); return userInterfaces; diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java index bbf7015e0a6d..cf41efb47c33 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java @@ -778,7 +778,7 @@ public int accept(Method method) { } Class targetClass = this.advised.getTargetClass(); // Proxy is not yet available, but that shouldn't matter. - List chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass); + List chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass); boolean haveAdvice = !chain.isEmpty(); boolean exposeProxy = this.advised.isExposeProxy(); boolean isStatic = this.advised.getTargetSource().isStatic(); diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java index 806e3602bc9e..188887aedf88 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializable { public List getInterceptorsAndDynamicInterceptionAdvice( - Advised config, Method method, Class targetClass) { + Advised config, Method method, Class targetClass) { // This is somewhat tricky... we have to process introductions first, // but we need to preserve order in the ultimate list. @@ -92,7 +92,7 @@ else if (advisor instanceof IntroductionAdvisor) { /** * Determine whether the Advisors contain matching introductions. */ - private static boolean hasMatchingIntroductions(Advised config, Class targetClass) { + private static boolean hasMatchingIntroductions(Advised config, Class targetClass) { for (int i = 0; i < config.getAdvisors().length; i++) { Advisor advisor = config.getAdvisors()[i]; if (advisor instanceof IntroductionAdvisor) { diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java index 43293527e6d8..aa03891da4da 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java @@ -50,7 +50,7 @@ public class DefaultAopProxyFactory implements AopProxyFactory, Serializable { public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException { if (config.isOptimize() || config.isProxyTargetClass() || hasNoUserSuppliedProxyInterfaces(config)) { - Class targetClass = config.getTargetClass(); + Class targetClass = config.getTargetClass(); if (targetClass == null) { throw new AopConfigException("TargetSource cannot determine target class: " + "Either an interface or a target is required for proxy creation."); @@ -71,7 +71,7 @@ public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException * (or no proxy interfaces specified at all). */ private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config) { - Class[] interfaces = config.getProxiedInterfaces(); + Class[] interfaces = config.getProxiedInterfaces(); return (interfaces.length == 0 || (interfaces.length == 1 && SpringProxy.class.equals(interfaces[0]))); } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java index 0a0e1233871d..f043206b1e47 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/InterceptorAndDynamicMethodMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java b/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java index 24c0610c08be..c374535909fa 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/JdkDynamicAopProxy.java @@ -114,7 +114,7 @@ public Object getProxy(ClassLoader classLoader) { if (logger.isDebugEnabled()) { logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource()); } - Class[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised); + Class[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised); findDefinedEqualsAndHashCodeMethods(proxiedInterfaces); return Proxy.newProxyInstance(classLoader, proxiedInterfaces, this); } @@ -124,8 +124,8 @@ public Object getProxy(ClassLoader classLoader) { * on the supplied set of interfaces. * @param proxiedInterfaces the interfaces to introspect */ - private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) { - for (Class proxiedInterface : proxiedInterfaces) { + private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) { + for (Class proxiedInterface : proxiedInterfaces) { Method[] methods = proxiedInterface.getDeclaredMethods(); for (Method method : methods) { if (AopUtils.isEqualsMethod(method)) { @@ -153,7 +153,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl boolean setProxyContext = false; TargetSource targetSource = this.advised.targetSource; - Class targetClass = null; + Class targetClass = null; Object target = null; try { diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java index 989160bf65b2..fc721df0c366 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java @@ -56,7 +56,7 @@ public ProxyFactory(Object target) { *

No target, only interfaces. Must add interceptors. * @param proxyInterfaces the interfaces that the proxy should implement */ - public ProxyFactory(Class[] proxyInterfaces) { + public ProxyFactory(Class[] proxyInterfaces) { setInterfaces(proxyInterfaces); } @@ -68,7 +68,7 @@ public ProxyFactory(Class[] proxyInterfaces) { * @param proxyInterface the interface that the proxy should implement * @param interceptor the interceptor that the proxy should invoke */ - public ProxyFactory(Class proxyInterface, Interceptor interceptor) { + public ProxyFactory(Class proxyInterface, Interceptor interceptor) { addInterface(proxyInterface); addAdvice(interceptor); } @@ -79,7 +79,7 @@ public ProxyFactory(Class proxyInterface, Interceptor interceptor) { * @param proxyInterface the interface that the proxy should implement * @param targetSource the TargetSource that the proxy should invoke */ - public ProxyFactory(Class proxyInterface, TargetSource targetSource) { + public ProxyFactory(Class proxyInterface, TargetSource targetSource) { addInterface(proxyInterface); setTargetSource(targetSource); } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java index 9b4461fcb4b6..920469b00eee 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport protected final Log logger = LogFactory.getLog(getClass()); private String[] interceptorNames; - + private String targetName; private boolean autodetectInterfaces = true; @@ -132,7 +132,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport * @see #setInterfaces * @see AbstractSingletonProxyFactoryBean#setProxyInterfaces */ - public void setProxyInterfaces(Class[] proxyInterfaces) throws ClassNotFoundException { + public void setProxyInterfaces(Class[] proxyInterfaces) throws ClassNotFoundException { setInterfaces(proxyInterfaces); } @@ -262,7 +262,7 @@ public Class getObjectType() { return this.singletonInstance.getClass(); } } - Class[] ifcs = getProxiedInterfaces(); + Class[] ifcs = getProxiedInterfaces(); if (ifcs.length == 1) { return ifcs[0]; } @@ -291,7 +291,7 @@ public boolean isSingleton() { * @return the merged interface as Class * @see java.lang.reflect.Proxy#getProxyClass */ - protected Class createCompositeInterface(Class[] interfaces) { + protected Class createCompositeInterface(Class[] interfaces) { return ClassUtils.createCompositeInterface(interfaces, this.proxyClassLoader); } @@ -305,7 +305,7 @@ private synchronized Object getSingletonInstance() { this.targetSource = freshTargetSource(); if (this.autodetectInterfaces && getProxiedInterfaces().length == 0 && !isProxyTargetClass()) { // Rely on AOP infrastructure to tell us what interfaces to proxy. - Class targetClass = getTargetClass(); + Class targetClass = getTargetClass(); if (targetClass == null) { throw new FactoryBeanNotInitializedException("Cannot determine target class for proxy"); } @@ -395,7 +395,7 @@ private void checkInterceptorNames() { * @return true if it's an Advisor or Advice */ private boolean isNamedBeanAnAdvisorOrAdvice(String beanName) { - Class namedBeanClass = this.beanFactory.getType(beanName); + Class namedBeanClass = this.beanFactory.getType(beanName); if (namedBeanClass != null) { return (Advisor.class.isAssignableFrom(namedBeanClass) || Advice.class.isAssignableFrom(namedBeanClass)); } @@ -543,10 +543,10 @@ private void addAdvisorOnChainCreation(Object next, String name) { Advisor advisor = namedBeanToAdvisor(next); if (logger.isTraceEnabled()) { logger.trace("Adding advisor with name '" + name + "'"); - } + } addAdvisor(advisor); } - + /** * Return a TargetSource to use when creating a proxy. If the target was not * specified at the end of the interceptorNames list, the TargetSource will be @@ -627,24 +627,24 @@ private static class PrototypePlaceholderAdvisor implements Advisor, Serializabl private final String beanName; private final String message; - + public PrototypePlaceholderAdvisor(String beanName) { this.beanName = beanName; this.message = "Placeholder for prototype Advisor/Advice with bean name '" + beanName + "'"; } - + public String getBeanName() { return beanName; } - + public Advice getAdvice() { throw new UnsupportedOperationException("Cannot invoke methods: " + this.message); } - + public boolean isPerInstance() { throw new UnsupportedOperationException("Cannot invoke methods: " + this.message); } - + @Override public String toString() { return this.message; diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java b/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java index 458cc4651808..ef1b3d4e6b89 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea protected Object[] arguments; - private final Class targetClass; + private final Class targetClass; /** * Lazily initialized map of user-specific attributes for this invocation. @@ -79,7 +79,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea * List of MethodInterceptor and InterceptorAndDynamicMethodMatcher * that need dynamic checks. */ - protected final List interceptorsAndDynamicMethodMatchers; + protected final List interceptorsAndDynamicMethodMatchers; /** * Index from 0 of the current interceptor we're invoking. @@ -103,7 +103,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea */ protected ReflectiveMethodInvocation( Object proxy, Object target, Method method, Object[] arguments, - Class targetClass, List interceptorsAndDynamicMethodMatchers) { + Class targetClass, List interceptorsAndDynamicMethodMatchers) { this.proxy = proxy; this.target = target; @@ -151,7 +151,7 @@ public Object proceed() throws Throwable { } Object interceptorOrInterceptionAdvice = - this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex); + this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex); if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) { // Evaluate dynamic method matcher here: static part will already have // been evaluated and found to match. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java index 5acc518359dc..50315c838fc3 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java index f0b38d0d67cf..b4eb2d0ebfc9 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java index 10f861330003..b0d02507f2d2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java index 1e0b0b6417ee..374d723e5b63 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/AfterReturningAdviceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java index 8ac6e5c3e865..d3d8d245633e 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java index 0cd2d7ef9dbf..58a81d442516 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/GlobalAdvisorAdapterRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ public abstract class GlobalAdvisorAdapterRegistry { /** * Keep track of a single instance so we can return it to classes that request it. */ - private static AdvisorAdapterRegistry instance = new DefaultAdvisorAdapterRegistry(); + private static final AdvisorAdapterRegistry instance = new DefaultAdvisorAdapterRegistry(); /** * Return the singleton {@link DefaultAdvisorAdapterRegistry} instance. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java index 6757ab65f5b0..2a15da44c7bf 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java index 82f339b3f643..2decf4590c7a 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/MethodBeforeAdviceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java index 0803088e8bbd..d7e7624c3d48 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java index 8773e933c012..ab73574e7ea4 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice { private final Object throwsAdvice; /** Methods on throws advice, keyed by exception class */ - private final Map exceptionHandlerMap = new HashMap(); + private final Map, Method> exceptionHandlerMap = new HashMap, Method>(); /** @@ -87,13 +87,13 @@ public ThrowsAdviceInterceptor(Object throwsAdvice) { } } } - + if (this.exceptionHandlerMap.isEmpty()) { throw new IllegalArgumentException( "At least one handler method must be found in class [" + throwsAdvice.getClass() + "]"); } } - + public int getHandlerMethodCount() { return this.exceptionHandlerMap.size(); } @@ -104,7 +104,7 @@ public int getHandlerMethodCount() { * @return a handler for the given exception type */ private Method getExceptionHandler(Throwable exception) { - Class exceptionClass = exception.getClass(); + Class exceptionClass = exception.getClass(); if (logger.isTraceEnabled()) { logger.trace("Trying to find handler for exception of type [" + exceptionClass.getName() + "]"); } @@ -131,7 +131,7 @@ public Object invoke(MethodInvocation mi) throws Throwable { throw ex; } } - + private void invokeHandlerMethod(MethodInvocation mi, Throwable ex, Method method) throws Throwable { Object[] handlerArgs; if (method.getParameterTypes().length == 1) { diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java index 5d216e9b6bf4..a479fbc86848 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/UnknownAdviceTypeException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java index 765d127397ed..0b3d0a28bfc2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/package-info.java @@ -7,7 +7,7 @@ * its capabilities, don't need to concern themselves with this package. *
* You may wish to use these adapters to wrap Spring-specific advices, such as MethodBeforeAdvice, - * in MethodInterceptor, to allow their use in another AOP framework supporting the AOP Alliance interfaces. + * in MethodInterceptor, to allow their use in another AOP framework supporting the AOP Alliance interfaces. *
*
* These adapters do not depend on any other Spring framework classes to allow such usage. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java index 8bca7ccd9d91..39e303bb08c2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +64,8 @@ protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) { @Override - protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) { - List advisors = findEligibleAdvisors(beanClass, beanName); + protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) { + List advisors = findEligibleAdvisors(beanClass, beanName); if (advisors.isEmpty()) { return DO_NOT_PROXY; } @@ -82,7 +82,7 @@ protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName * @see #sortAdvisors * @see #extendAdvisors */ - protected List findEligibleAdvisors(Class beanClass, String beanName) { + protected List findEligibleAdvisors(Class beanClass, String beanName) { List candidateAdvisors = findCandidateAdvisors(); List eligibleAdvisors = findAdvisorsThatCanApply(candidateAdvisors, beanClass, beanName); extendAdvisors(eligibleAdvisors); @@ -110,7 +110,7 @@ protected List findCandidateAdvisors() { * @see ProxyCreationContext#getCurrentProxiedBeanName() */ protected List findAdvisorsThatCanApply( - List candidateAdvisors, Class beanClass, String beanName) { + List candidateAdvisors, Class beanClass, String beanName) { ProxyCreationContext.setCurrentProxiedBeanName(beanName); try { diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java index 3216c3e101ff..f8c6da96b5c5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java @@ -151,11 +151,11 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig * @param order ordering value */ public final void setOrder(int order) { - this.order = order; + this.order = order; } public final int getOrder() { - return this.order; + return this.order; } /** diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java index 400018136950..ff749598c40f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanFactoryAdvisorRetrievalHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java index a7b01b573c71..7f99f3d02332 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public void setBeanNames(String[] beanNames) { * Identify as bean to proxy if the bean name is in the configured list of names. */ @Override - protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) { + protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource) { if (this.beanNames != null) { for (String mappedName : this.beanNames) { if (FactoryBean.class.isAssignableFrom(beanClass)) { diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java index 334b9a5cfed3..a7a67a24be19 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/DefaultAdvisorAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,6 +94,6 @@ public void setBeanName(String name) { @Override protected boolean isEligibleAdvisorBean(String beanName) { return (!isUsePrefix() || beanName.startsWith(getAdvisorBeanNamePrefix())); - } + } } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java index 6219a5015c39..735a65b852e9 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/TargetSourceCreator.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,7 +30,7 @@ * @author Juergen Hoeller */ public interface TargetSourceCreator { - + /** * Create a special TargetSource for the given bean, if any. * @param beanClass the class of the bean to create a TargetSource for diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java index 691464cd7da9..8646ea495885 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/package-info.java @@ -3,10 +3,10 @@ * * Bean post-processors for use in ApplicationContexts to simplify AOP usage * by automatically creating AOP proxies without the need to use a ProxyFactoryBean. - * + * *

The various post-processors in this package need only be added to an ApplicationContext * (typically in an XML bean definition document) to automatically proxy selected beans. - * + * *

NB: Automatic auto-proxying is not supported for BeanFactory implementations, * as post-processors beans are only automatically detected in application contexts. * Post-processors can be explicitly registered on a ConfigurableBeanFactory instead. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java index a7bf4b490cc1..3e3870f22d4a 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java index a32f3a3f2c55..25210f45e67b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/LazyInitTargetSourceCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ protected boolean isPrototypeBased() { @Override protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource( - Class beanClass, String beanName) { + Class beanClass, String beanName) { if (getBeanFactory() instanceof ConfigurableListableBeanFactory) { BeanDefinition definition = diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java index 094188be1c9c..dc37b8099f0f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/QuickTargetSourceCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ /** * Convenient TargetSourceCreator using bean name prefixes to create one of three - * well-known TargetSource types: + * well-known TargetSource types: *

  • : CommonsPoolTargetSource *
  • % ThreadLocalTargetSource *
  • ! PrototypeTargetSource @@ -41,7 +41,7 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour @Override protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource( - Class beanClass, String beanName) { + Class beanClass, String beanName) { if (beanName.startsWith(PREFIX_COMMONS_POOL)) { CommonsPoolTargetSource cpts = new CommonsPoolTargetSource(); @@ -59,5 +59,5 @@ else if (beanName.startsWith(PREFIX_PROTOTYPE)) { return null; } } - + } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java b/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java index 4958a010cbaa..3581a82efe38 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/package-info.java @@ -3,13 +3,13 @@ * * Package containing Spring's basic AOP infrastructure, compliant with the * AOP Alliance interfaces. - * + * *

    Spring AOP supports proxying interfaces or classes, introductions, and offers * static and dynamic pointcuts. - * + * *

    Any Spring AOP proxy can be cast to the ProxyConfig AOP configuration interface * in this package to add or remove interceptors. - * + * *

    The ProxyFactoryBean is a convenient way to create AOP proxies in a BeanFactory * or ApplicationContext. However, proxies can be created programmatically using the * ProxyFactory class. diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java index 0c257c1c506f..8502faa7b7e1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractMonitoringInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ *

    Subclasses should call the createInvocationTraceName(MethodInvocation) * method to create a name for the given trace that includes information about the * method invocation under trace along with the prefix and suffix added as appropriate. - * + * * @author Rob Harrop * @author Juergen Hoeller * @since 1.2.7 @@ -97,7 +97,7 @@ public void setLogTargetClassInvocation(boolean logTargetClassInvocation) { protected String createInvocationTraceName(MethodInvocation invocation) { StringBuilder sb = new StringBuilder(getPrefix()); Method method = invocation.getMethod(); - Class clazz = method.getDeclaringClass(); + Class clazz = method.getDeclaringClass(); if (this.logTargetClassInvocation && clazz.isInstance(invocation.getThis())) { clazz = invocation.getThis().getClass(); } diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java index 2c367c20c044..f13fdcaf3095 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/AbstractTraceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -140,7 +140,7 @@ protected Log getLoggerForInvocation(MethodInvocation invocation) { * @return the target class for the given object * @see #setHideProxyClassNames */ - protected Class getClassForLogging(Object target) { + protected Class getClassForLogging(Object target) { return (this.hideProxyClassNames ? AopUtils.getTargetClass(target) : target.getClass()); } diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java index bf14ab64308b..881fef9e34a4 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java index db00bcbbf6f8..8eb71609b6f1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,7 +150,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor { /** * The Set of allowed placeholders. */ - private static final Set ALLOWED_PLACEHOLDERS = + private static final Set ALLOWED_PLACEHOLDERS = new Constants(CustomizableTraceInterceptor.class).getValues("PLACEHOLDER_"); @@ -393,7 +393,7 @@ else if (returnValue == null) { * @param output the StringBuffer containing the output */ private void appendArgumentTypes(MethodInvocation methodInvocation, Matcher matcher, StringBuffer output) { - Class[] argumentTypes = methodInvocation.getMethod().getParameterTypes(); + Class[] argumentTypes = methodInvocation.getMethod().getParameterTypes(); String[] argumentTypeShortNames = new String[argumentTypes.length]; for (int i = 0; i < argumentTypeShortNames.length; i++) { argumentTypeShortNames[i] = ClassUtils.getShortName(argumentTypes[i]); diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java index 81b31107424d..bf55f76a5a7a 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisors.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,7 +125,7 @@ public Object invoke(MethodInvocation mi) throws Throwable { */ private static class ExposeBeanNameIntroduction extends DelegatingIntroductionInterceptor implements NamedBean { - private final String beanName; + private final String beanName; public ExposeBeanNameIntroduction(String beanName) { this.beanName = beanName; diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java index 86ac2027569c..d61caa219467 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/ExposeInvocationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java index 0ea4dd527f40..801567245bdd 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ * and output the stats. * *

    This code is inspired by Thierry Templier's blog. - * + * * @author Dmitriy Kopylenko * @author Juergen Hoeller * @author Rob Harrop diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java index f22f54a77bcd..e4e3bc0f60b1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/package-info.java b/spring-aop/src/main/java/org/springframework/aop/package-info.java index 5076bc067815..b5691ccfa67d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/package-info.java +++ b/spring-aop/src/main/java/org/springframework/aop/package-info.java @@ -2,9 +2,9 @@ /** * * Core Spring AOP interfaces, built on AOP Alliance AOP interoperability interfaces. - * + * *
    Any AOP Alliance MethodInterceptor is usable in Spring. - * + * *
    Spring AOP also offers: *

      *
    • Introduction support @@ -15,7 +15,7 @@ *
    • Extensibility allowing arbitrary custom advice types to * be plugged in without modifying the core framework. *
    - * + * *
    * Spring AOP can be used programmatically or (preferably) * integrated with the Spring IoC container. diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java b/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java index 77c3a107ab06..05a041aeec74 100644 --- a/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java +++ b/spring-aop/src/main/java/org/springframework/aop/scope/DefaultScopedObject.java @@ -23,7 +23,7 @@ /** * Default implementation of the {@link ScopedObject} interface. - * + * *

    Simply delegates the calls to the underlying * {@link ConfigurableBeanFactory bean factory} * ({@link ConfigurableBeanFactory#getBean(String)}/ diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java index 1a5008264168..9e46d230cd2c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java +++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedObject.java @@ -49,5 +49,5 @@ public interface ScopedObject extends RawTargetAccess { * the exact same target object in the target scope). */ void removeFromScope(); - + } diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java index b13a9eb50995..826e4a06adde 100644 --- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java +++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,14 +32,14 @@ /** * Convenient proxy factory bean for scoped objects. - * + * *

    Proxies created using this factory bean are thread-safe singletons * and may be injected into shared objects, with transparent scoping behavior. * *

    Proxies returned by this class implement the {@link ScopedObject} interface. * This presently allows for removing the corresponding object from the scope, * seamlessly creating a new instance in the scope on next access. - * + * *

    Please note that the proxies created by this factory are * class-based proxies by default. This can be customized * through switching the "proxyTargetClass" property to "false". @@ -89,7 +89,7 @@ public void setBeanFactory(BeanFactory beanFactory) { pf.copyFrom(this); pf.setTargetSource(this.scopedTargetSource); - Class beanType = beanFactory.getType(this.targetBeanName); + Class beanType = beanFactory.getType(this.targetBeanName); if (beanType == null) { throw new IllegalStateException("Cannot create scoped proxy for bean '" + this.targetBeanName + "': Target type could not be determined at the time of proxy creation."); diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java index 62f13bb5c8ac..e59267d30f38 100644 --- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java @@ -47,7 +47,7 @@ public abstract class ScopedProxyUtils { */ public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder definition, BeanDefinitionRegistry registry, boolean proxyTargetClass) { - + String originalBeanName = definition.getBeanName(); BeanDefinition targetDefinition = definition.getBeanDefinition(); @@ -87,7 +87,7 @@ public static BeanDefinitionHolder createScopedProxy(BeanDefinitionHolder defini // (potentially an inner bean). return new BeanDefinitionHolder(proxyDefinition, originalBeanName, definition.getAliases()); } - + /** * Generates the bean name that is used within the scoped proxy to reference the target bean. * @param originalBeanName the original name of bean diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java index 0d11ab36a748..5d16f3d24afd 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java index a9031bcc3c07..f97836bc5cad 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java index ac64a992267b..e9bafe25d1dd 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java @@ -123,7 +123,7 @@ public String[] getExcludedPatterns() { * of the target class as well as against the method's declaring class, * plus the name of the method. */ - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) || matchesPattern(method.getDeclaringClass().getName() + "." + method.getName())); } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java index 86234323a256..aca8a6f9ac32 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java @@ -215,7 +215,7 @@ public static boolean canApply(Pointcut pc, Class targetClass, boolean hasInt introductionAwareMethodMatcher = (IntroductionAwareMethodMatcher) methodMatcher; } - Set classes = new HashSet(ClassUtils.getAllInterfacesForClassAsSet(targetClass)); + Set> classes = new HashSet>(ClassUtils.getAllInterfacesForClassAsSet(targetClass)); classes.add(targetClass); for (Class clazz : classes) { Method[] methods = clazz.getMethods(); diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java b/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java index e8fd0213ea3f..cd03b81739c0 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,7 +95,7 @@ public UnionClassFilter(ClassFilter[] filters) { this.filters = filters; } - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { for (int i = 0; i < this.filters.length; i++) { if (this.filters[i].matches(clazz)) { return true; @@ -128,7 +128,7 @@ public IntersectionClassFilter(ClassFilter[] filters) { this.filters = filters; } - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { for (int i = 0; i < this.filters.length; i++) { if (!this.filters[i].matches(clazz)) { return false; diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java index e0d0b6dc33d1..3adf703d7ce5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ */ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher, Serializable { - private Class clazz; + private Class clazz; private String methodName; @@ -49,7 +49,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher * Construct a new pointcut that matches all control flows below that class. * @param clazz the clazz */ - public ControlFlowPointcut(Class clazz) { + public ControlFlowPointcut(Class clazz) { this(clazz, null); } @@ -60,7 +60,7 @@ public ControlFlowPointcut(Class clazz) { * @param clazz the clazz * @param methodName the name of the method */ - public ControlFlowPointcut(Class clazz, String methodName) { + public ControlFlowPointcut(Class clazz, String methodName) { Assert.notNull(clazz, "Class must not be null"); this.clazz = clazz; this.methodName = methodName; @@ -70,7 +70,7 @@ public ControlFlowPointcut(Class clazz, String methodName) { /** * Subclasses can override this for greater filtering (and performance). */ - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { return true; } @@ -78,7 +78,7 @@ public boolean matches(Class clazz) { * Subclasses can override this if it's possible to filter out * some candidate classes. */ - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return true; } @@ -86,7 +86,7 @@ public boolean isRuntime() { return true; } - public boolean matches(Method method, Class targetClass, Object[] args) { + public boolean matches(Method method, Class targetClass, Object[] args) { ++this.evaluations; ControlFlow cflow = ControlFlowFactory.createControlFlow(); return (this.methodName != null) ? cflow.under(this.clazz, this.methodName) : cflow.under(this.clazz); diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java index 194ae88656e5..0267e932c957 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ * @author Juergen Hoeller * @since 11.11.2003 */ -@SuppressWarnings({ "unchecked", "serial" }) +@SuppressWarnings({ "serial" }) public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFilter, Ordered, Serializable { private final Advice advice; - - private final Set interfaces = new HashSet(); + + private final Set> interfaces = new HashSet>(); private int order = Integer.MAX_VALUE; @@ -68,11 +68,11 @@ public DefaultIntroductionAdvisor(Advice advice, IntroductionInfo introductionIn Assert.notNull(advice, "Advice must not be null"); this.advice = advice; if (introductionInfo != null) { - Class[] introducedInterfaces = introductionInfo.getInterfaces(); + Class[] introducedInterfaces = introductionInfo.getInterfaces(); if (introducedInterfaces.length == 0) { throw new IllegalArgumentException("IntroductionAdviceSupport implements no interfaces"); } - for (Class ifc : introducedInterfaces) { + for (Class ifc : introducedInterfaces) { addInterface(ifc); } } @@ -83,7 +83,7 @@ public DefaultIntroductionAdvisor(Advice advice, IntroductionInfo introductionIn * @param advice the Advice to apply * @param intf the interface to introduce */ - public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class intf) { + public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class intf) { Assert.notNull(advice, "Advice must not be null"); this.advice = advice; addInterface(intf); @@ -94,7 +94,7 @@ public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class intf) * Add the specified interface to the list of interfaces to introduce. * @param intf the interface to introduce */ - public void addInterface(Class intf) { + public void addInterface(Class intf) { Assert.notNull(intf, "Interface must not be null"); if (!intf.isInterface()) { throw new IllegalArgumentException("Specified class [" + intf.getName() + "] must be an interface"); @@ -102,12 +102,12 @@ public void addInterface(Class intf) { this.interfaces.add(intf); } - public Class[] getInterfaces() { + public Class[] getInterfaces() { return this.interfaces.toArray(new Class[this.interfaces.size()]); } public void validateInterfaces() throws IllegalArgumentException { - for (Class ifc : this.interfaces) { + for (Class ifc : this.interfaces) { if (this.advice instanceof DynamicIntroductionAdvice && !((DynamicIntroductionAdvice) this.advice).implementsInterface(ifc)) { throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " + @@ -138,7 +138,7 @@ public ClassFilter getClassFilter() { return this; } - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { return true; } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java index cb4402683d81..1817be6d6d16 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DefaultPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor imple */ public DefaultPointcutAdvisor() { } - + /** * Create a DefaultPointcutAdvisor that matches all methods. *

    Pointcut.TRUE will be used as Pointcut. @@ -55,7 +55,7 @@ public DefaultPointcutAdvisor() { public DefaultPointcutAdvisor(Advice advice) { this(Pointcut.TRUE, advice); } - + /** * Create a DefaultPointcutAdvisor, specifying Pointcut and Advice. * @param pointcut the Pointcut targeting the Advice diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java index 5278ee233fff..baa2becbeffa 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DelegatePerTargetObjectIntroductionInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2087 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,17 +53,17 @@ public class DelegatePerTargetObjectIntroductionInterceptor extends IntroductionInfoSupport implements IntroductionInterceptor { - /** + /** * Hold weak references to keys as we don't want to interfere with garbage collection.. */ private final Map delegateMap = new WeakHashMap(); - private Class defaultImplType; + private Class defaultImplType; - private Class interfaceType; + private Class interfaceType; - public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Class interfaceType) { + public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Class interfaceType) { this.defaultImplType = defaultImplType; this.interfaceType = interfaceType; // cCeate a new delegate now (but don't store it in the map). @@ -85,12 +85,12 @@ public DelegatePerTargetObjectIntroductionInterceptor(Class defaultImplType, Cla public Object invoke(MethodInvocation mi) throws Throwable { if (isMethodOnIntroducedInterface(mi)) { Object delegate = getIntroductionDelegateFor(mi.getThis()); - + // Using the following method rather than direct reflection, // we get correct handling of InvocationTargetException // if the introduced method throws an exception. Object retVal = AopUtils.invokeJoinpointUsingReflection(delegate, mi.getMethod(), mi.getArguments()); - + // Massage return value if possible: if the delegate returned itself, // we really want to return the proxy. if (retVal == delegate && mi instanceof ProxyMethodInvocation) { @@ -126,7 +126,7 @@ private Object getIntroductionDelegateFor(Object targetObject) { } } } - + private Object createNewDelegate() { try { return this.defaultImplType.newInstance(); diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java index fc9631bd6137..ea5b62e63d6b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DelegatingIntroductionInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ *

    The suppressInterface method can be used to suppress interfaces * implemented by the delegate but which should not be introduced to the owning * AOP proxy. - * + * *

    An instance of this class is serializable if the delegate is. * * @author Rod Johnson @@ -50,7 +50,7 @@ */ public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport implements IntroductionInterceptor { - + /** * Object that actually implements the interfaces. * May be "this" if a subclass implements the introduced interfaces. @@ -66,7 +66,7 @@ public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport public DelegatingIntroductionInterceptor(Object delegate) { init(delegate); } - + /** * Construct a new DelegatingIntroductionInterceptor. * The delegate will be the subclass, which must implement @@ -91,10 +91,10 @@ private void init(Object delegate) { suppressInterface(IntroductionInterceptor.class); suppressInterface(DynamicIntroductionAdvice.class); } - - + + /** - * Subclasses may need to override this if they want to perform custom + * Subclasses may need to override this if they want to perform custom * behaviour in around advice. However, subclasses should invoke this * method, which handles introduced interfaces and forwarding to the target. */ @@ -104,7 +104,7 @@ public Object invoke(MethodInvocation mi) throws Throwable { // get correct handling of InvocationTargetException // if the introduced method throws an exception. Object retVal = AopUtils.invokeJoinpointUsingReflection(this.delegate, mi.getMethod(), mi.getArguments()); - + // Massage return value if possible: if the delegate returned itself, // we really want to return the proxy. if (retVal == this.delegate && mi instanceof ProxyMethodInvocation) { diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java index d011aa641bad..6a6a70c98514 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcher.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java index 5adc4fa53955..e70530b09829 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DynamicMethodMatcherPointcut.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java b/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java index c04c049163e7..82006e06bc5c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/IntroductionInfoSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ */ public class IntroductionInfoSupport implements IntroductionInfo, Serializable { - protected final Set publishedInterfaces = new HashSet(); + protected final Set> publishedInterfaces = new HashSet>(); private transient Map rememberedMethods = new ConcurrentHashMap(32); @@ -54,11 +54,11 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable { *

    Does nothing if the interface is not implemented by the delegate. * @param intf the interface to suppress */ - public void suppressInterface(Class intf) { + public void suppressInterface(Class intf) { this.publishedInterfaces.remove(intf); } - public Class[] getInterfaces() { + public Class[] getInterfaces() { return this.publishedInterfaces.toArray(new Class[this.publishedInterfaces.size()]); } @@ -67,8 +67,8 @@ public Class[] getInterfaces() { * @param ifc the interface to check * @return whether the interface is part of this introduction */ - public boolean implementsInterface(Class ifc) { - for (Class pubIfc : this.publishedInterfaces) { + public boolean implementsInterface(Class ifc) { + for (Class pubIfc : this.publishedInterfaces) { if (ifc.isInterface() && ifc.isAssignableFrom(pubIfc)) { return true; } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java index d2a4fe139516..61595ff86ac4 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/JdkRegexpMethodPointcut.java @@ -38,13 +38,13 @@ * @since 1.1 */ public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut { - - /** + + /** * Compiled form of the patterns. */ private Pattern[] compiledPatterns = new Pattern[0]; - /** + /** * Compiled form of the exclusion patterns. */ private Pattern[] compiledExclusionPatterns = new Pattern[0]; diff --git a/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java b/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java index b4d4fd6f4793..58b8fdde5748 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ public static MethodMatcher intersection(MethodMatcher mm1, MethodMatcher mm2) { * asking is the subject on one or more introductions; false otherwise * @return whether or not this method matches statically */ - public static boolean matches(MethodMatcher mm, Method method, Class targetClass, boolean hasIntroductions) { + public static boolean matches(MethodMatcher mm, Method method, Class targetClass, boolean hasIntroductions) { Assert.notNull(mm, "MethodMatcher must not be null"); return ((mm instanceof IntroductionAwareMethodMatcher && ((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions)) || @@ -111,21 +111,21 @@ public UnionMethodMatcher(MethodMatcher mm1, MethodMatcher mm2) { this.mm2 = mm2; } - public boolean matches(Method method, Class targetClass, boolean hasIntroductions) { + public boolean matches(Method method, Class targetClass, boolean hasIntroductions) { return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) || (matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions)); } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return (matchesClass1(targetClass) && this.mm1.matches(method, targetClass)) || (matchesClass2(targetClass) && this.mm2.matches(method, targetClass)); } - protected boolean matchesClass1(Class targetClass) { + protected boolean matchesClass1(Class targetClass) { return true; } - protected boolean matchesClass2(Class targetClass) { + protected boolean matchesClass2(Class targetClass) { return true; } @@ -133,7 +133,7 @@ public boolean isRuntime() { return this.mm1.isRuntime() || this.mm2.isRuntime(); } - public boolean matches(Method method, Class targetClass, Object[] args) { + public boolean matches(Method method, Class targetClass, Object[] args) { return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args); } @@ -175,12 +175,12 @@ public ClassFilterAwareUnionMethodMatcher(MethodMatcher mm1, ClassFilter cf1, Me } @Override - protected boolean matchesClass1(Class targetClass) { + protected boolean matchesClass1(Class targetClass) { return this.cf1.matches(targetClass); } @Override - protected boolean matchesClass2(Class targetClass) { + protected boolean matchesClass2(Class targetClass) { return this.cf2.matches(targetClass); } @@ -213,12 +213,12 @@ public IntersectionMethodMatcher(MethodMatcher mm1, MethodMatcher mm2) { this.mm2 = mm2; } - public boolean matches(Method method, Class targetClass, boolean hasIntroductions) { + public boolean matches(Method method, Class targetClass, boolean hasIntroductions) { return MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions); } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return this.mm1.matches(method, targetClass) && this.mm2.matches(method, targetClass); } @@ -226,7 +226,7 @@ public boolean isRuntime() { return this.mm1.isRuntime() || this.mm2.isRuntime(); } - public boolean matches(Method method, Class targetClass, Object[] args) { + public boolean matches(Method method, Class targetClass, Object[] args) { // Because a dynamic intersection may be composed of a static and dynamic part, // we must avoid calling the 3-arg matches method on a dynamic matcher, as // it will probably be an unsupported operation. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java index 44a03380ff4e..feafd4869b6b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public NameMatchMethodPointcut addMethodName(String name) { } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { for (String mappedName : this.mappedNames) { if (mappedName.equals(method.getName()) || isMatch(method.getName(), mappedName)) { return true; diff --git a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java index 4cd21ec070fa..e521736bf550 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java b/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java index cdeb21e8b910..3dbe5310c264 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ public static Pointcut intersection(Pointcut pc1, Pointcut pc2) { * @param args arguments to the method * @return whether there's a runtime match */ - public static boolean matches(Pointcut pointcut, Method method, Class targetClass, Object[] args) { + public static boolean matches(Pointcut pointcut, Method method, Class targetClass, Object[] args) { Assert.notNull(pointcut, "Pointcut must not be null"); if (pointcut == Pointcut.TRUE) { return true; @@ -95,7 +95,7 @@ private static class SetterPointcut extends StaticMethodMatcherPointcut implemen public static SetterPointcut INSTANCE = new SetterPointcut(); - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return method.getName().startsWith("set") && method.getParameterTypes().length == 1 && method.getReturnType() == Void.TYPE; @@ -114,7 +114,7 @@ private static class GetterPointcut extends StaticMethodMatcherPointcut implemen public static GetterPointcut INSTANCE = new GetterPointcut(); - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return method.getName().startsWith("get") && method.getParameterTypes().length == 0; } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java index a610e37f71e9..e96d1abe6a05 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java index 193de1d96956..61fbc351b7c1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,16 +25,16 @@ * @author Rod Johnson */ public class RootClassFilter implements ClassFilter, Serializable { - - private Class clazz; - + + private Class clazz; + // TODO inheritance - - public RootClassFilter(Class clazz) { + + public RootClassFilter(Class clazz) { this.clazz = clazz; } - public boolean matches(Class candidate) { + public boolean matches(Class candidate) { return clazz.isAssignableFrom(candidate); } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java index 8023ff883735..27209a18ac15 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcher.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ /** * Convenient abstract superclass for static method matchers, which don't care - * about arguments at runtime. + * about arguments at runtime. */ public abstract class StaticMethodMatcher implements MethodMatcher { diff --git a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java index 921129c89b06..5ff78837c566 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java index 9136c8974e71..d312c4f37108 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public AnnotationClassFilter(Class annotationType, boolean } - public boolean matches(Class clazz) { + public boolean matches(Class clazz) { return (this.checkInherited ? (AnnotationUtils.findAnnotation(clazz, this.annotationType) != null) : clazz.isAnnotationPresent(this.annotationType)); diff --git a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java index 4f4dd6c391a3..4f7cfbb833fd 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java @@ -47,7 +47,7 @@ public AnnotationMethodMatcher(Class annotationType) { } - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { if (method.isAnnotationPresent(this.annotationType)) { return true; } diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java index 2980b0bf4268..f3437fb29ce4 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,7 +97,7 @@ public String getTargetBeanName() { *

    Default is to detect the type automatically, through a getType * call on the BeanFactory (or even a full getBean call as fallback). */ - public void setTargetClass(Class targetClass) { + public void setTargetClass(Class targetClass) { this.targetClass = targetClass; } diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java index 3119e847f1b6..b78e18faf691 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractLazyCreationTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java index 8111f2e4c47d..3c73521e7499 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java @@ -90,7 +90,7 @@ public final void setBeanFactory(BeanFactory beanFactory) throws BeansException * @throws Exception to avoid placing constraints on pooling APIs */ protected abstract void createPool() throws Exception; - + /** * Acquire an object from the pool. * @return an object from the pool @@ -98,7 +98,7 @@ public final void setBeanFactory(BeanFactory beanFactory) throws BeansException * APIs, so we're forgiving with our exception signature */ public abstract Object getTarget() throws Exception; - + /** * Return the given object to the pool. * @param target object that must have been acquired from the pool diff --git a/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java index 887e253a087b..cc9641a3fc73 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ * properties are explictly not mirrored because the implementation of * PoolableObjectFactory used by this class does not implement * meaningful validation. All exposed Commons Pool properties use the corresponding - * Commons Pool defaults: for example, + * Commons Pool defaults: for example, * * @author Rod Johnson * @author Rob Harrop diff --git a/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java index d67b03f0f3c2..e20bac8b59f2 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/EmptyTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ public class EmptyTargetSource implements TargetSource, Serializable { * @param targetClass the target Class (may be null) * @see #getTargetClass() */ - public static EmptyTargetSource forClass(Class targetClass) { + public static EmptyTargetSource forClass(Class targetClass) { return forClass(targetClass, true); } @@ -60,7 +60,7 @@ public static EmptyTargetSource forClass(Class targetClass) { * @param isStatic whether the TargetSource should be marked as static * @see #getTargetClass() */ - public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) { + public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) { return (targetClass == null && isStatic ? INSTANCE : new EmptyTargetSource(targetClass, isStatic)); } @@ -69,7 +69,7 @@ public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) { // Instance implementation //--------------------------------------------------------------------- - private final Class targetClass; + private final Class targetClass; private final boolean isStatic; @@ -81,7 +81,7 @@ public static EmptyTargetSource forClass(Class targetClass, boolean isStatic) { * @param targetClass the target class to expose (may be null) * @param isStatic whether the TargetSource is marked as static */ - private EmptyTargetSource(Class targetClass, boolean isStatic) { + private EmptyTargetSource(Class targetClass, boolean isStatic) { this.targetClass = targetClass; this.isStatic = isStatic; } diff --git a/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java b/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java index 4327a2747a2b..ddaad787043b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/PoolingConfig.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java index 08ae6534a64c..844073a5ab82 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/SingletonTargetSource.java @@ -58,11 +58,11 @@ public SingletonTargetSource(Object target) { public Class getTargetClass() { return this.target.getClass(); } - + public Object getTarget() { return this.target; } - + public void releaseTarget(Object target) { // nothing to do } diff --git a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java index 6048f7b48466..e614f27a8b8d 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java @@ -49,7 +49,7 @@ */ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource implements ThreadLocalTargetSourceStats, DisposableBean { - + /** * ThreadLocal holding the target associated with the current * thread. Unlike most ThreadLocals, which are static, this variable @@ -61,10 +61,10 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource /** * Set of managed targets, enabling us to keep track of the targets we've created. */ - private final Set targetSet = new HashSet(); - + private final Set targetSet = Collections.synchronizedSet(new HashSet()); + private int invocationCount; - + private int hitCount; @@ -79,7 +79,7 @@ public Object getTarget() throws BeansException { if (target == null) { if (logger.isDebugEnabled()) { logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " + - "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); + "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); } // Associate target with ThreadLocal. target = newPrototypeInstance(); @@ -93,7 +93,7 @@ public Object getTarget() throws BeansException { } return target; } - + /** * Dispose of targets if necessary; clear ThreadLocal. * @see #destroyPrototypeInstance diff --git a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java index 7e3a2fa5cf50..688b89133066 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSourceStats.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ * @author Juergen Hoeller */ public interface ThreadLocalTargetSourceStats { - + /** * Return the number of client invocations. */ diff --git a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java index befbcf393928..e4c805010d03 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java index 7d55a0d59a18..82d16e7fd489 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/dynamic/Refreshable.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2006 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java index 3bc43af65764..0d523ba87e3d 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java @@ -36,7 +36,7 @@ public final class AspectJAdviceParameterNameDiscoverAnnotationTests @Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation {} - + public void pjpAndAnAnnotation(ProceedingJoinPoint pjp, MyAnnotation ann) {} @Test diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java index f135239fe093..7662195c0fd0 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -247,7 +247,7 @@ public void testReferenceBinding() { public void testReferenceBindingWithAlternateTokenizations() { assertParameterNames(getMethod("onePrimitive"),"call(bar *) && somepc(foo)",new String[] {"foo"}); assertParameterNames(getMethod("onePrimitive"),"somepc ( foo )",new String[] {"foo"}); - assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"}); + assertParameterNames(getMethod("onePrimitive"),"somepc( foo)",new String[] {"foo"}); } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java index b1678c9d7c89..d34e0d794721 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,7 @@ * @author Chris Beams */ public final class AspectJExpressionPointcutTests { - + public static final String MATCH_ALL_METHODS = "execution(* *(..))"; private Method getAge; @@ -53,17 +53,14 @@ public final class AspectJExpressionPointcutTests { private Method setSomeNumber; - private Method isPostProcessed; - - @Before public void setUp() throws NoSuchMethodException { getAge = TestBean.class.getMethod("getAge", (Class[])null); setAge = TestBean.class.getMethod("setAge", new Class[]{int.class}); setSomeNumber = TestBean.class.getMethod("setSomeNumber", new Class[]{Number.class}); - isPostProcessed = TestBean.class.getMethod("isPostProcessed", (Class[]) null); + TestBean.class.getMethod("isPostProcessed", (Class[]) null); } - + @Test public void testMatchExplicit() { String expression = "execution(int test.beans.TestBean.getAge())"; @@ -100,60 +97,60 @@ public void testMatchWithTypePattern() throws Exception { assertTrue("Expression should match setAge(int) method", methodMatcher.matches(setAge, TestBean.class)); } - + @Test public void testThis() throws SecurityException, NoSuchMethodException{ testThisOrTarget("this"); } - + @Test public void testTarget() throws SecurityException, NoSuchMethodException { testThisOrTarget("target"); } - + public static class OtherIOther implements IOther { public void absquatulate() { // Empty } - + } - + /** * This and target are equivalent. Really instanceof pointcuts. - * @throws Exception * @param which this or target - * @throws NoSuchMethodException - * @throws SecurityException + * @throws Exception + * @throws NoSuchMethodException + * @throws SecurityException */ private void testThisOrTarget(String which) throws SecurityException, NoSuchMethodException { String matchesTestBean = which + "(test.beans.TestBean)"; String matchesIOther = which + "(test.beans.IOther)"; AspectJExpressionPointcut testBeanPc = new AspectJExpressionPointcut(); testBeanPc.setExpression(matchesTestBean); - + AspectJExpressionPointcut iOtherPc = new AspectJExpressionPointcut(); iOtherPc.setExpression(matchesIOther); - + assertTrue(testBeanPc.matches(TestBean.class)); assertTrue(testBeanPc.matches(getAge, TestBean.class)); assertTrue(iOtherPc.matches(OtherIOther.class.getMethod("absquatulate", (Class[])null), OtherIOther.class)); - + assertFalse(testBeanPc.matches(OtherIOther.class.getMethod("absquatulate", (Class[])null), OtherIOther.class)); } - + @Test public void testWithinRootPackage() throws SecurityException, NoSuchMethodException { testWithinPackage(false); } - + @Test public void testWithinRootAndSubpackages() throws SecurityException, NoSuchMethodException { testWithinPackage(true); } - + private void testWithinPackage(boolean matchSubpackages) throws SecurityException, NoSuchMethodException { String withinBeansPackage = "within(test.beans."; // Subpackages are matched by ** @@ -163,7 +160,7 @@ private void testWithinPackage(boolean matchSubpackages) throws SecurityExceptio withinBeansPackage = withinBeansPackage + "*)"; AspectJExpressionPointcut withinBeansPc = new AspectJExpressionPointcut(); withinBeansPc.setExpression(withinBeansPackage); - + assertTrue(withinBeansPc.matches(TestBean.class)); assertTrue(withinBeansPc.matches(getAge, TestBean.class)); assertEquals(matchSubpackages, withinBeansPc.matches(DeepBean.class)); @@ -173,7 +170,7 @@ private void testWithinPackage(boolean matchSubpackages) throws SecurityExceptio assertFalse(withinBeansPc.matches(OtherIOther.class.getMethod("absquatulate", (Class[])null), OtherIOther.class)); } - + @Test public void testFriendlyErrorOnNoLocationClassMatching() { AspectJExpressionPointcut pc = new AspectJExpressionPointcut(); @@ -185,7 +182,7 @@ public void testFriendlyErrorOnNoLocationClassMatching() { assertTrue(ex.getMessage().indexOf("expression") != -1); } } - + @Test public void testFriendlyErrorOnNoLocation2ArgMatching() { AspectJExpressionPointcut pc = new AspectJExpressionPointcut(); @@ -197,7 +194,7 @@ public void testFriendlyErrorOnNoLocation2ArgMatching() { assertTrue(ex.getMessage().indexOf("expression") != -1); } } - + @Test public void testFriendlyErrorOnNoLocation3ArgMatching() { AspectJExpressionPointcut pc = new AspectJExpressionPointcut(); @@ -210,7 +207,7 @@ public void testFriendlyErrorOnNoLocation3ArgMatching() { } } - + @Test public void testMatchWithArgs() throws Exception { String expression = "execution(void test.beans.TestBean.setSomeNumber(Number)) && args(Double)"; @@ -308,10 +305,6 @@ private void assertMatchesTestBeanClass(ClassFilter classFilter) { assertTrue("Expression should match TestBean class", classFilter.matches(TestBean.class)); } - private void assertDoesNotMatchStringClass(ClassFilter classFilter) { - assertFalse("Expression should not match String class", classFilter.matches(String.class)); - } - @Test public void testWithUnsupportedPointcutPrimitive() throws Exception { String expression = "call(int test.beans.TestBean.getAge())"; @@ -329,19 +322,19 @@ public void testWithUnsupportedPointcutPrimitive() throws Exception { @Test public void testAndSubstitution() { Pointcut pc = getPointcut("execution(* *(..)) and args(String)"); - PointcutExpression expr = + PointcutExpression expr = ((AspectJExpressionPointcut) pc).getPointcutExpression(); assertEquals("execution(* *(..)) && args(String)",expr.getPointcutExpression()); } - + @Test public void testMultipleAndSubstitutions() { Pointcut pc = getPointcut("execution(* *(..)) and args(String) and this(Object)"); - PointcutExpression expr = + PointcutExpression expr = ((AspectJExpressionPointcut) pc).getPointcutExpression(); - assertEquals("execution(* *(..)) && args(String) && this(Object)",expr.getPointcutExpression()); + assertEquals("execution(* *(..)) && args(String) && this(Object)",expr.getPointcutExpression()); } - + private Pointcut getPointcut(String expression) { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(expression); @@ -367,4 +360,4 @@ public void reset() { this.count = 0; } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java index ce148b7faa42..a38779c4b743 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,8 @@ public final class BeanNamePointcutMatchingTests { public void testMatchingPointcuts() { assertMatch("someName", "bean(someName)"); - // Spring bean names are less restrictive compared to AspectJ names (methods, types etc.) - // MVC Controller-kind + // Spring bean names are less restrictive compared to AspectJ names (methods, types etc.) + // MVC Controller-kind assertMatch("someName/someOtherName", "bean(someName/someOtherName)"); assertMatch("someName/foo/someOtherName", "bean(someName/*/someOtherName)"); assertMatch("someName/foo/bar/someOtherName", "bean(someName/*/someOtherName)"); @@ -58,9 +58,9 @@ public void testMatchingPointcuts() { // Or, and, not expressions assertMatch("someName", "bean(someName) || bean(someOtherName)"); assertMatch("someOtherName", "bean(someName) || bean(someOtherName)"); - + assertMatch("someName", "!bean(someOtherName)"); - + assertMatch("someName", "bean(someName) || !bean(someOtherName)"); assertMatch("someName", "bean(someName) && !bean(someOtherName)"); } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java index 6de4f5c6407f..da541816583e 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,31 +72,31 @@ public void testCanGetMethodSignatureFromJoinPoint() { final Object raw = new TestBean(); // Will be set by advice during a method call final int newAge = 23; - + ProxyFactory pf = new ProxyFactory(raw); pf.setExposeProxy(true); pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR); pf.addAdvice(new MethodBeforeAdvice() { private int depth; - + public void before(Method method, Object[] args, Object target) throws Throwable { JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint(); assertTrue("Method named in toString", jp.toString().contains(method.getName())); // Ensure that these don't cause problems jp.toShortString(); jp.toLongString(); - + assertSame(target, AbstractAspectJAdvice.currentJoinPoint().getTarget()); assertFalse(AopUtils.isAopProxy(AbstractAspectJAdvice.currentJoinPoint().getTarget())); - + ITestBean thisProxy = (ITestBean) AbstractAspectJAdvice.currentJoinPoint().getThis(); assertTrue(AopUtils.isAopProxy(AbstractAspectJAdvice.currentJoinPoint().getThis())); - + assertNotSame(target, thisProxy); - + // Check getting again doesn't cause a problem assertSame(thisProxy, AbstractAspectJAdvice.currentJoinPoint().getThis()); - + // Try reentrant call--will go through this advice. // Be sure to increment depth to avoid infinite recursion if (depth++ == 0) { @@ -109,10 +109,10 @@ public void before(Method method, Object[] args, Object target) throws Throwable assertSame(AopContext.currentProxy(), thisProxy); assertSame(target, raw); - + assertSame(method.getName(), AbstractAspectJAdvice.currentJoinPoint().getSignature().getName()); assertEquals(method.getModifiers(), AbstractAspectJAdvice.currentJoinPoint().getSignature().getModifiers()); - + MethodSignature msig = (MethodSignature) AbstractAspectJAdvice.currentJoinPoint().getSignature(); assertSame("Return same MethodSignature repeatedly", msig, AbstractAspectJAdvice.currentJoinPoint().getSignature()); assertSame("Return same JoinPoint repeatedly", AbstractAspectJAdvice.currentJoinPoint(), AbstractAspectJAdvice.currentJoinPoint()); @@ -137,7 +137,7 @@ public void testCanGetSourceLocationFromJoinPoint() { pf.addAdvice(new MethodBeforeAdvice() { public void before(Method method, Object[] args, Object target) throws Throwable { SourceLocation sloc = AbstractAspectJAdvice.currentJoinPoint().getSourceLocation(); - assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation()); + assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation()); assertEquals(TestBean.class, sloc.getWithinType()); try { sloc.getLine(); @@ -146,7 +146,7 @@ public void before(Method method, Object[] args, Object target) throws Throwable catch (UnsupportedOperationException ex) { // Expected } - + try { sloc.getFileName(); fail("Can't get file name"); @@ -169,7 +169,7 @@ public void testCanGetStaticPartFromJoinPoint() { pf.addAdvice(new MethodBeforeAdvice() { public void before(Method method, Object[] args, Object target) throws Throwable { StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart(); - assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart()); + assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart()); assertEquals(ProceedingJoinPoint.METHOD_EXECUTION, staticPart.getKind()); assertSame(AbstractAspectJAdvice.currentJoinPoint().getSignature(), staticPart.getSignature()); assertEquals(AbstractAspectJAdvice.currentJoinPoint().getSourceLocation(), staticPart.getSourceLocation()); @@ -191,7 +191,7 @@ public void before(Method method, Object[] args, Object target) throws Throwable // it serves our purpose here JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method); JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint(); - + assertEquals(aspectJVersionJp.getSignature().toLongString(), jp.getSignature().toLongString()); assertEquals(aspectJVersionJp.getSignature().toShortString(), jp.getSignature().toShortString()); assertEquals(aspectJVersionJp.getSignature().toString(), jp.getSignature().toString()); diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java index 824f51433b63..d9769685c5d4 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java @@ -38,37 +38,37 @@ public void testAtThis() { public void testAtTarget() { assertParameterNames(getMethod("oneAnnotation"),"@target(a)",new String[]{"a"}); } - + @Test public void testAtArgs() { assertParameterNames(getMethod("oneAnnotation"),"@args(a)",new String[]{"a"}); } - + @Test public void testAtWithin() { assertParameterNames(getMethod("oneAnnotation"),"@within(a)",new String[]{"a"}); } - + @Test public void testAtWithincode() { assertParameterNames(getMethod("oneAnnotation"),"@withincode(a)",new String[]{"a"}); } - + @Test public void testAtAnnotation() { assertParameterNames(getMethod("oneAnnotation"),"@annotation(a)",new String[]{"a"}); } - + @Test public void testAmbiguousAnnotationTwoVars() { assertException(getMethod("twoAnnotations"),"@annotation(a) && @this(x)",AmbiguousBindingException.class, "Found 2 potential annotation variable(s), and 2 potential argument slots"); } - + @Test public void testAmbiguousAnnotationOneVar() { assertException(getMethod("oneAnnotation"),"@annotation(a) && @this(x)",IllegalArgumentException.class, - "Found 2 candidate annotation binding variables but only one potential argument binding slot"); + "Found 2 candidate annotation binding variables but only one potential argument binding slot"); } @Test diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java index 9877171a60ad..912edf612347 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import test.beans.TestBean; -/** +/** * Java5-specific {@link AspectJExpressionPointcutTests}. * * @author Rod Johnson @@ -54,10 +54,10 @@ public void setUp() throws NoSuchMethodException { methodsOnHasGeneric.put(m.getName(), m); } } - + public static class HasGeneric { - + public void setFriends(List friends) { } public void setEnemies(List enemies) { @@ -73,41 +73,42 @@ public void testMatchGenericArgument() { String expression = "execution(* set*(java.util.List) )"; AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(expression); - + // TODO this will currently map, would be nice for optimization //assertTrue(ajexp.matches(HasGeneric.class)); //assertFalse(ajexp.matches(TestBean.class)); - + Method takesGenericList = methodsOnHasGeneric.get("setFriends"); assertTrue(ajexp.matches(takesGenericList, HasGeneric.class)); assertTrue(ajexp.matches(methodsOnHasGeneric.get("setEnemies"), HasGeneric.class)); assertFalse(ajexp.matches(methodsOnHasGeneric.get("setPartners"), HasGeneric.class)); assertFalse(ajexp.matches(methodsOnHasGeneric.get("setPhoneNumbers"), HasGeneric.class)); - + assertFalse(ajexp.matches(getAge, TestBean.class)); } - + @Test public void testMatchVarargs() throws SecurityException, NoSuchMethodException { class MyTemplate { - public int queryForInt(String sql, Object... params) { - return 0; - } + @SuppressWarnings("unused") + public int queryForInt(String sql, Object... params) { + return 0; + } } - + String expression = "execution(int *.*(String, Object...))"; AspectJExpressionPointcut jdbcVarArgs = new AspectJExpressionPointcut(); jdbcVarArgs.setExpression(expression); - + // TODO: the expression above no longer matches Object[] // assertFalse(jdbcVarArgs.matches( // JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class), // JdbcTemplate.class)); - + assertTrue(jdbcVarArgs.matches( MyTemplate.class.getMethod("queryForInt", String.class, Object[].class), MyTemplate.class)); - + Method takesGenericList = methodsOnHasGeneric.get("setFriends"); assertFalse(jdbcVarArgs.matches(takesGenericList, HasGeneric.class)); assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setEnemies"), HasGeneric.class)); @@ -115,44 +116,44 @@ public int queryForInt(String sql, Object... params) { assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setPhoneNumbers"), HasGeneric.class)); assertFalse(jdbcVarArgs.matches(getAge, TestBean.class)); } - + @Test public void testMatchAnnotationOnClassWithAtWithin() throws SecurityException, NoSuchMethodException { String expression = "@within(test.annotation.transaction.Tx)"; testMatchAnnotationOnClass(expression); } - + @Test public void testMatchAnnotationOnClassWithoutBinding() throws SecurityException, NoSuchMethodException { String expression = "within(@test.annotation.transaction.Tx *)"; testMatchAnnotationOnClass(expression); } - + @Test public void testMatchAnnotationOnClassWithSubpackageWildcard() throws SecurityException, NoSuchMethodException { String expression = "within(@(test.annotation..*) *)"; AspectJExpressionPointcut springAnnotatedPc = testMatchAnnotationOnClass(expression); - assertFalse(springAnnotatedPc.matches(TestBean.class.getMethod("setName", String.class), + assertFalse(springAnnotatedPc.matches(TestBean.class.getMethod("setName", String.class), TestBean.class)); - assertTrue(springAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null), + assertTrue(springAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null), SpringAnnotated.class)); - + expression = "within(@(test.annotation.transaction..*) *)"; AspectJExpressionPointcut springTxAnnotatedPc = testMatchAnnotationOnClass(expression); - assertFalse(springTxAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null), + assertFalse(springTxAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null), SpringAnnotated.class)); } - + @Test public void testMatchAnnotationOnClassWithExactPackageWildcard() throws SecurityException, NoSuchMethodException { String expression = "within(@(test.annotation.transaction.*) *)"; testMatchAnnotationOnClass(expression); } - + private AspectJExpressionPointcut testMatchAnnotationOnClass(String expression) throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(expression); - + assertFalse(ajexp.matches(getAge, TestBean.class)); assertTrue(ajexp.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class)); assertTrue(ajexp.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class)); @@ -160,13 +161,13 @@ private AspectJExpressionPointcut testMatchAnnotationOnClass(String expression) assertFalse(ajexp.matches(BeanA.class.getMethod("setName", String.class), BeanA.class)); return ajexp; } - + @Test public void testAnnotationOnMethodWithFQN() throws SecurityException, NoSuchMethodException { String expression = "@annotation(test.annotation.transaction.Tx)"; AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(expression); - + assertFalse(ajexp.matches(getAge, TestBean.class)); assertFalse(ajexp.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class)); assertFalse(ajexp.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class)); @@ -174,13 +175,13 @@ public void testAnnotationOnMethodWithFQN() throws SecurityException, NoSuchMeth assertTrue(ajexp.matches(BeanA.class.getMethod("getAge", (Class[]) null), BeanA.class)); assertFalse(ajexp.matches(BeanA.class.getMethod("setName", String.class), BeanA.class)); } - + @Test public void testAnnotationOnMethodWithWildcard() throws SecurityException, NoSuchMethodException { String expression = "execution(@(test.annotation..*) * *(..))"; AspectJExpressionPointcut anySpringMethodAnnotation = new AspectJExpressionPointcut(); anySpringMethodAnnotation.setExpression(expression); - + assertFalse(anySpringMethodAnnotation.matches(getAge, TestBean.class)); assertFalse(anySpringMethodAnnotation.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class)); assertFalse(anySpringMethodAnnotation.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class)); @@ -194,43 +195,43 @@ public void testAnnotationOnMethodArgumentsWithFQN() throws SecurityException, N String expression = "@args(*, test.annotation.EmptySpringAnnotation))"; AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut(); takesSpringAnnotatedArgument2.setExpression(expression); - + assertFalse(takesSpringAnnotatedArgument2.matches(getAge, TestBean.class)); assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class)); assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class)); assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class)); assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("getAge", (Class[]) null), BeanA.class)); assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class)); - + assertTrue(takesSpringAnnotatedArgument2.matches( ProcessesSpringAnnotatedParameters.class.getMethod("takesAnnotatedParameters", TestBean.class, SpringAnnotated.class), ProcessesSpringAnnotatedParameters.class)); - + // True because it maybeMatches with potential argument subtypes assertTrue(takesSpringAnnotatedArgument2.matches( ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, BeanA.class), ProcessesSpringAnnotatedParameters.class)); - + assertFalse(takesSpringAnnotatedArgument2.matches( ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, BeanA.class), ProcessesSpringAnnotatedParameters.class, new Object[] { new TestBean(), new BeanA()}) ); } - + @Test public void testAnnotationOnMethodArgumentsWithWildcards() throws SecurityException, NoSuchMethodException { String expression = "execution(* *(*, @(test..*) *))"; AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut(); takesSpringAnnotatedArgument2.setExpression(expression); - + assertFalse(takesSpringAnnotatedArgument2.matches(getAge, TestBean.class)); assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class)); assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class)); assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class)); assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("getAge", (Class[]) null), BeanA.class)); assertFalse(takesSpringAnnotatedArgument2.matches(BeanA.class.getMethod("setName", String.class), BeanA.class)); - + assertTrue(takesSpringAnnotatedArgument2.matches( ProcessesSpringAnnotatedParameters.class.getMethod("takesAnnotatedParameters", TestBean.class, SpringAnnotated.class), ProcessesSpringAnnotatedParameters.class)); @@ -267,8 +268,9 @@ public void foo() { } } - + static class BeanA { + @SuppressWarnings("unused") private String name; private int age; @@ -283,9 +285,10 @@ public int getAge() { } } - + @Tx static class BeanB { + @SuppressWarnings("unused") private String name; public void setName(String name) { diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java index 227c1553c317..cb78cd56f750 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java @@ -67,7 +67,7 @@ public void testManualProxyJavaWithStaticPointcutAndTwoClassLoaders() throws Exc // Test with default class loader first... testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, new TestServiceImpl(), "TestServiceImpl"); - + // Then try again with a different class loader on the target... SimpleThrowawayClassLoader loader = new SimpleThrowawayClassLoader(new TestServiceImpl().getClass().getClassLoader()); // Make sure the interface is loaded from the parent class loader @@ -102,7 +102,7 @@ private void testAdvice(Advisor advisor, LogUserAdvice logAdvice, TestService ta } assertEquals(1, logAdvice.getCountThrows()); } - + public static class SimpleThrowawayClassLoader extends OverridingClassLoader { /** @@ -114,7 +114,7 @@ public SimpleThrowawayClassLoader(ClassLoader parent) { } } - + public static class TestException extends RuntimeException { public TestException(String string) { @@ -129,32 +129,32 @@ public TestException(String string) { @Inherited public static @interface Log { } - + public static interface TestService { - public String sayHello(); + public String sayHello(); } - + @Log public static class TestServiceImpl implements TestService{ - public String sayHello() { - throw new TestException("TestServiceImpl"); - } + public String sayHello() { + throw new TestException("TestServiceImpl"); + } } public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice { - + private int countBefore = 0; - + private int countThrows = 0; - + public void before(Method method, Object[] objects, Object o) throws Throwable { countBefore++; - } + } public void afterThrowing(Exception e) throws Throwable { countThrows++; - throw e; - } + throw e; + } public int getCountBefore() { return countBefore; @@ -163,12 +163,12 @@ public int getCountBefore() { public int getCountThrows() { return countThrows; } - + public void reset() { countThrows = 0; countBefore = 0; } } - + } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java index c3708d6b86cc..fea874179e00 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public void testSubclassMatching() { assertFalse("Must be excluded: not subclass", tpcf.matches(IOther.class)); assertFalse("Must be excluded: not subclass", tpcf.matches(DefaultListableBeanFactory.class)); } - + @Test public void testAndOrNotReplacement() { TypePatternClassFilter tpcf = new TypePatternClassFilter("java.lang.Object or java.lang.String"); @@ -75,12 +75,12 @@ public void testAndOrNotReplacement() { assertFalse("matches Double",tpcf.matches(Double.class)); tpcf = new TypePatternClassFilter("java.lang.Number+ and not java.lang.Float"); assertFalse("matches Float",tpcf.matches(Float.class)); - assertTrue("matches Double",tpcf.matches(Double.class)); + assertTrue("matches Double",tpcf.matches(Double.class)); } @Test(expected=IllegalArgumentException.class) public void testSetTypePatternWithNullArgument() throws Exception { - new TypePatternClassFilter(null); + new TypePatternClassFilter(null); } @Test(expected=IllegalStateException.class) diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java index 1c366a70425c..ce569e3b01c0 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java @@ -76,7 +76,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests { * @return the fixture */ protected abstract AspectJAdvisorFactory getFixture(); - + @Test public void testRejectsPerCflowAspect() { @@ -88,7 +88,7 @@ public void testRejectsPerCflowAspect() { assertTrue(ex.getMessage().indexOf("PERCFLOW") != -1); } } - + @Test public void testRejectsPerCflowBelowAspect() { try { @@ -105,11 +105,11 @@ public void testPerTargetAspect() throws SecurityException, NoSuchMethodExceptio TestBean target = new TestBean(); int realAge = 65; target.setAge(realAge); - TestBean itb = (TestBean) createProxy(target, + TestBean itb = (TestBean) createProxy(target, getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(), "someBean")), TestBean.class); assertEquals("Around advice must NOT apply", realAge, itb.getAge()); - + Advised advised = (Advised) itb; SyntheticInstantiationAdvisor sia = (SyntheticInstantiationAdvisor) advised.getAdvisors()[1]; assertTrue(sia.getPointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null)); @@ -121,10 +121,10 @@ public void testPerTargetAspect() throws SecurityException, NoSuchMethodExceptio // Check that the perclause pointcut is valid assertTrue(maaif.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null)); assertNotSame(imapa.getDeclaredPointcut(), imapa.getPointcut()); - + // Hit the method in the per clause to instantiate the aspect itb.getSpouse(); - + assertTrue(maaif.isMaterialized()); assertEquals("Around advice must apply", 0, itb.getAge()); @@ -190,11 +190,11 @@ public void testPerThisAspect() throws SecurityException, NoSuchMethodException TestBean target = new TestBean(); int realAge = 65; target.setAge(realAge); - TestBean itb = (TestBean) createProxy(target, + TestBean itb = (TestBean) createProxy(target, getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new PerThisAspect(), "someBean")), TestBean.class); assertEquals("Around advice must NOT apply", realAge, itb.getAge()); - + Advised advised = (Advised) itb; // Will be ExposeInvocationInterceptor, synthetic instantiation advisor, 2 method advisors assertEquals(4, advised.getAdvisors().length); @@ -208,30 +208,30 @@ public void testPerThisAspect() throws SecurityException, NoSuchMethodException // Check that the perclause pointcut is valid assertTrue(maaif.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null)); assertNotSame(imapa.getDeclaredPointcut(), imapa.getPointcut()); - + // Hit the method in the per clause to instantiate the aspect itb.getSpouse(); - + assertTrue(maaif.isMaterialized()); assertTrue(imapa.getDeclaredPointcut().getMethodMatcher().matches(TestBean.class.getMethod("getAge"), null)); - + assertEquals("Around advice must apply", 0, itb.getAge()); assertEquals("Around advice must apply", 1, itb.getAge()); } - + @Test public void testPerTypeWithinAspect() throws SecurityException, NoSuchMethodException { TestBean target = new TestBean(); int realAge = 65; target.setAge(realAge); PerTypeWithinAspectInstanceFactory aif = new PerTypeWithinAspectInstanceFactory(); - TestBean itb = (TestBean) createProxy(target, - getFixture().getAdvisors(aif), + TestBean itb = (TestBean) createProxy(target, + getFixture().getAdvisors(aif), TestBean.class); assertEquals("No method calls", 0, aif.getInstantiationCount()); assertEquals("Around advice must now apply", 0, itb.getAge()); - + Advised advised = (Advised) itb; // Will be ExposeInvocationInterceptor, synthetic instantiation advisor, 2 method advisors assertEquals(4, advised.getAdvisors().length); @@ -245,19 +245,19 @@ public void testPerTypeWithinAspect() throws SecurityException, NoSuchMethodExce // Check that the perclause pointcut is valid assertTrue(maaif.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches(TestBean.class.getMethod("getSpouse"), null)); assertNotSame(imapa.getDeclaredPointcut(), imapa.getPointcut()); - + // Hit the method in the per clause to instantiate the aspect itb.getSpouse(); - + assertTrue(maaif.isMaterialized()); assertTrue(imapa.getDeclaredPointcut().getMethodMatcher().matches(TestBean.class.getMethod("getAge"), null)); - + assertEquals("Around advice must still apply", 1, itb.getAge()); assertEquals("Around advice must still apply", 2, itb.getAge()); - - TestBean itb2 = (TestBean) createProxy(target, - getFixture().getAdvisors(aif), + + TestBean itb2 = (TestBean) createProxy(target, + getFixture().getAdvisors(aif), TestBean.class); assertEquals(1, aif.getInstantiationCount()); assertEquals("Around advice be independent for second instance", 0, itb2.getAge()); @@ -282,20 +282,20 @@ public void testNamedPointcutFromAspectLibrary() { @Test public void testNamedPointcutFromAspectLibraryWithBinding() { TestBean target = new TestBean(); - ITestBean itb = (ITestBean) createProxy(target, - getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new NamedPointcutAspectFromLibraryWithBinding(),"someBean")), + ITestBean itb = (ITestBean) createProxy(target, + getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new NamedPointcutAspectFromLibraryWithBinding(),"someBean")), ITestBean.class); itb.setAge(10); assertEquals("Around advice must apply", 20, itb.getAge()); assertEquals(20,target.getAge()); } - + private void testNamedPointcuts(Object aspectInstance) { TestBean target = new TestBean(); int realAge = 65; target.setAge(realAge); - ITestBean itb = (ITestBean) createProxy(target, - getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(aspectInstance,"someBean")), + ITestBean itb = (ITestBean) createProxy(target, + getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(aspectInstance,"someBean")), ITestBean.class); assertEquals("Around advice must apply", -1, itb.getAge()); assertEquals(realAge, target.getAge()); @@ -304,8 +304,8 @@ private void testNamedPointcuts(Object aspectInstance) { @Test public void testBindingWithSingleArg() { TestBean target = new TestBean(); - ITestBean itb = (ITestBean) createProxy(target, - getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new BindingAspectWithSingleArg(),"someBean")), + ITestBean itb = (ITestBean) createProxy(target, + getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new BindingAspectWithSingleArg(),"someBean")), ITestBean.class); itb.setAge(10); assertEquals("Around advice must apply", 20, itb.getAge()); @@ -315,10 +315,10 @@ public void testBindingWithSingleArg() { @Test public void testBindingWithMultipleArgsDifferentlyOrdered() { ManyValuedArgs target = new ManyValuedArgs(); - ManyValuedArgs mva = (ManyValuedArgs) createProxy(target, - getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ManyValuedArgs(),"someBean")), + ManyValuedArgs mva = (ManyValuedArgs) createProxy(target, + getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ManyValuedArgs(),"someBean")), ManyValuedArgs.class); - + String a = "a"; int b = 12; int c = 25; @@ -327,7 +327,7 @@ public void testBindingWithMultipleArgsDifferentlyOrdered() { String expectedResult = a + b+ c + d + e; assertEquals(expectedResult, mva.mungeArgs(a, b, c, d, e)); } - + /** * In this case the introduction will be made. */ @@ -344,7 +344,7 @@ public void testIntroductionOnTargetNotImplementingInterface() { assertFalse(lockable.locked()); lockable.lock(); assertTrue(lockable.locked()); - + NotLockable notLockable2Target = new NotLockable(); NotLockable notLockable2 = (NotLockable) createProxy(notLockable2Target, getFixture().getAdvisors( @@ -363,17 +363,17 @@ public void testIntroductionOnTargetNotImplementingInterface() { } assertTrue(lockable2.locked()); } - + @Test public void testIntroductionAdvisorExcludedFromTargetImplementingInterface() { assertTrue(AopUtils.findAdvisorsThatCanApply( getFixture().getAdvisors( new SingletonMetadataAwareAspectInstanceFactory( - new MakeLockable(),"someBean")), + new MakeLockable(),"someBean")), CannotBeUnlocked.class).isEmpty()); assertEquals(2, AopUtils.findAdvisorsThatCanApply(getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(),"someBean")), NotLockable.class).size()); } - + @Test public void testIntroductionOnTargetImplementingInterface() { CannotBeUnlocked target = new CannotBeUnlocked(); @@ -385,25 +385,23 @@ public void testIntroductionOnTargetImplementingInterface() { CannotBeUnlocked.class ), CannotBeUnlocked.class); - assertTrue(proxy instanceof Lockable); - Lockable lockable = (Lockable) proxy; - assertTrue("Already locked", lockable.locked()); - lockable.lock(); - assertTrue("Real target ignores locking", lockable.locked()); + assertTrue("Already locked", proxy.locked()); + proxy.lock(); + assertTrue("Real target ignores locking", proxy.locked()); try { - lockable.unlock(); + proxy.unlock(); fail(); } catch (UnsupportedOperationException ex) { // Ok } } - + @SuppressWarnings("unchecked") @Test public void testIntroductionOnTargetExcludedByTypePattern() { - LinkedList target = new LinkedList(); - List proxy = (List) createProxy(target, + LinkedList target = new LinkedList(); + List proxy = (List) createProxy(target, AopUtils.findAdvisorsThatCanApply( getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(), "someBean")), List.class @@ -415,7 +413,7 @@ public void testIntroductionOnTargetExcludedByTypePattern() { @Test public void testIntroductionBasedOnAnnotationMatch_Spr5307() { AnnotatedTarget target = new AnnotatedTargetImpl(); - + List advisors = getFixture().getAdvisors( new SingletonMetadataAwareAspectInstanceFactory(new MakeAnnotatedTypeModifiable(),"someBean")); Object proxy = createProxy(target, @@ -426,23 +424,22 @@ public void testIntroductionBasedOnAnnotationMatch_Spr5307() { Lockable lockable = (Lockable)proxy; lockable.locked(); } - */ + */ // TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed... public void XtestIntroductionWithArgumentBinding() { TestBean target = new TestBean(); - + List advisors = getFixture().getAdvisors( new SingletonMetadataAwareAspectInstanceFactory(new MakeITestBeanModifiable(),"someBean")); advisors.addAll(getFixture().getAdvisors( new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(),"someBean"))); - + Modifiable modifiable = (Modifiable) createProxy(target, advisors, ITestBean.class); - assertTrue(modifiable instanceof Modifiable); Lockable lockable = (Lockable) modifiable; assertFalse(lockable.locked()); - + ITestBean itb = (ITestBean) modifiable; assertFalse(modifiable.isModified()); int oldAge = itb.getAge(); @@ -454,7 +451,7 @@ public void XtestIntroductionWithArgumentBinding() { assertFalse("Setting same value does not modify", modifiable.isModified()); itb.setName("And now for something completely different"); assertTrue(modifiable.isModified()); - + lockable.lock(); assertTrue(lockable.locked()); try { @@ -474,8 +471,8 @@ public void testAspectMethodThrowsExceptionLegalOnSignature() { UnsupportedOperationException expectedException = new UnsupportedOperationException(); List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ExceptionAspect(expectedException),"someBean")); assertEquals("One advice method was found", 1, advisors.size()); - ITestBean itb = (ITestBean) createProxy(target, - advisors, + ITestBean itb = (ITestBean) createProxy(target, + advisors, ITestBean.class); try { itb.getAge(); @@ -485,7 +482,7 @@ public void testAspectMethodThrowsExceptionLegalOnSignature() { assertSame(expectedException, ex); } } - + // TODO document this behaviour. // Is it different AspectJ behaviour, at least for checked exceptions? @Test @@ -494,8 +491,8 @@ public void testAspectMethodThrowsExceptionIllegalOnSignature() { RemoteException expectedException = new RemoteException(); List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new ExceptionAspect(expectedException),"someBean")); assertEquals("One advice method was found", 1, advisors.size()); - ITestBean itb = (ITestBean) createProxy(target, - advisors, + ITestBean itb = (ITestBean) createProxy(target, + advisors, ITestBean.class); try { itb.getAge(); @@ -505,7 +502,7 @@ public void testAspectMethodThrowsExceptionIllegalOnSignature() { assertSame(expectedException, ex.getCause()); } } - + protected Object createProxy(Object target, List advisors, Class... interfaces) { ProxyFactory pf = new ProxyFactory(target); if (interfaces.length > 1 || interfaces[0].isInterface()) { @@ -533,8 +530,8 @@ public void testTwoAdvicesOnOneAspect() { TwoAdviceAspect twoAdviceAspect = new TwoAdviceAspect(); List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(twoAdviceAspect,"someBean")); assertEquals("Two advice methods found", 2, advisors.size()); - ITestBean itb = (ITestBean) createProxy(target, - advisors, + ITestBean itb = (ITestBean) createProxy(target, + advisors, ITestBean.class); itb.setName(""); assertEquals(0, itb.getAge()); @@ -549,8 +546,8 @@ public void testAfterAdviceTypes() throws Exception { ExceptionHandling afterReturningAspect = new ExceptionHandling(); List advisors = getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(afterReturningAspect,"someBean")); - Echo echo = (Echo) createProxy(target, - advisors, + Echo echo = (Echo) createProxy(target, + advisors, Echo.class); assertEquals(0, afterReturningAspect.successCount); assertEquals("", echo.echo("")); @@ -574,20 +571,31 @@ public void testAfterAdviceTypes() throws Exception { @Test public void testFailureWithoutExplicitDeclarePrecedence() { TestBean target = new TestBean(); - MetadataAwareAspectInstanceFactory aspectInstanceFactory = new SingletonMetadataAwareAspectInstanceFactory( - new NoDeclarePrecedenceShouldFail(), "someBean"); ITestBean itb = (ITestBean) createProxy(target, - getFixture().getAdvisors(aspectInstanceFactory), ITestBean.class); - itb.getAge(); + getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new NoDeclarePrecedenceShouldFail(), "someBean")), + ITestBean.class); + try { + itb.getAge(); + fail(); + } + catch (IllegalStateException ex) { + // expected + } } - @Test(expected=IllegalArgumentException.class) + @Test public void testDeclarePrecedenceNotSupported() { TestBean target = new TestBean(); - MetadataAwareAspectInstanceFactory aspectInstanceFactory = new SingletonMetadataAwareAspectInstanceFactory( - new DeclarePrecedenceShouldSucceed(), "someBean"); - createProxy(target, getFixture().getAdvisors(aspectInstanceFactory), - ITestBean.class); + try { + createProxy(target, + getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory( + new DeclarePrecedenceShouldSucceed(),"someBean")), + ITestBean.class); + fail(); + } + catch (IllegalArgumentException ex) { + // Not supported in 2.0 + } } /** Not supported in 2.0! @@ -694,6 +702,7 @@ public int getOrder() { @Aspect public static class NamedPointcutAspectWithFQN { + @SuppressWarnings("unused") private ITestBean fieldThatShouldBeIgnoredBySpringAtAspectJProcessing = new TestBean(); @Pointcut("execution(* getAge())") @@ -886,47 +895,47 @@ public int preventExecution(ProceedingJoinPoint pjp) { */ @Aspect abstract class AbstractMakeModifiable { - + public interface MutableModifable extends Modifiable { void markDirty(); } - + public static class ModifiableImpl implements MutableModifable { private boolean modified; - + public void acceptChanges() { modified = false; } - + public boolean isModified() { return modified; } - + public void markDirty() { this.modified = true; } } - - @Before(value="execution(void set*(*)) && this(modifiable) && args(newValue)", + + @Before(value="execution(void set*(*)) && this(modifiable) && args(newValue)", argNames="modifiable,newValue") - public void recordModificationIfSetterArgumentDiffersFromOldValue(JoinPoint jp, + public void recordModificationIfSetterArgumentDiffersFromOldValue(JoinPoint jp, MutableModifable mixin, Object newValue) { - + /* * We use the mixin to check and, if necessary, change, - * modification status. We need the JoinPoint to get the - * setter method. We use newValue for comparison. + * modification status. We need the JoinPoint to get the + * setter method. We use newValue for comparison. * We try to invoke the getter if possible. */ - + if (mixin.isModified()) { // Already changed, don't need to change again //System.out.println("changed"); return; } - + // Find the current raw value, by invoking the corresponding setter - Method correspondingGetter = getGetterFromSetter(((MethodSignature) jp.getSignature()).getMethod()); + Method correspondingGetter = getGetterFromSetter(((MethodSignature) jp.getSignature()).getMethod()); boolean modified = true; if (correspondingGetter != null) { try { @@ -946,12 +955,12 @@ public void recordModificationIfSetterArgumentDiffersFromOldValue(JoinPoint jp, mixin.markDirty(); } } - + private Method getGetterFromSetter(Method setter) { String getterName = setter.getName().replaceFirst("set", "get"); try { return setter.getDeclaringClass().getMethod(getterName, (Class[]) null); - } + } catch (NoSuchMethodException ex) { // must be write only return null; @@ -968,7 +977,7 @@ private Method getGetterFromSetter(Method setter) { */ @Aspect class MakeITestBeanModifiable extends AbstractMakeModifiable { - + @DeclareParents(value = "test.beans.ITestBean+", defaultImpl=ModifiableImpl.class) public static MutableModifable mixin; @@ -982,7 +991,7 @@ class MakeITestBeanModifiable extends AbstractMakeModifiable { */ @Aspect class MakeAnnotatedTypeModifiable extends AbstractMakeModifiable { - + @DeclareParents(value = "(@org.springframework.aop.aspectj.annotation.Measured *)", // @DeclareParents(value = "(@Measured *)", // this would be a nice alternative... defaultImpl=DefaultLockable.class) @@ -996,11 +1005,11 @@ class MakeAnnotatedTypeModifiable extends AbstractMakeModifiable { */ @Aspect class MakeLockable { - + @DeclareParents(value = "org.springframework..*", defaultImpl=DefaultLockable.class) public static Lockable mixin; - + @Before(value="execution(void set*(*)) && this(mixin)", argNames="mixin") public void checkNotLocked( Lockable mixin) // Bind to arg @@ -1043,9 +1052,9 @@ public int compareTo(Object arg0) { interface Modifiable { boolean isModified(); - + void acceptChanges(); - + } /** @@ -1057,14 +1066,14 @@ interface AnnotatedTarget { @Measured class AnnotatedTargetImpl implements AnnotatedTarget { - + } @Retention(RetentionPolicy.RUNTIME) @interface Measured {} class NotLockable { - + private int intValue; public int getIntValue() { @@ -1086,6 +1095,7 @@ class PerThisAspect { /** * Just to check that this doesn't cause problems with introduction processing */ + @SuppressWarnings("unused") private ITestBean fieldThatShouldBeIgnoredBySpringAtAspectJProcessing = new TestBean(); @Around("execution(int *.getAge())") @@ -1097,5 +1107,5 @@ public int returnCountAsAge() { public void countSetter() { ++count; } - + } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java index 5f108cb56da4..17eb415a0417 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ArgumentBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public void testBindingInPointcutUsedByAdvice() { TestBean tb = new TestBean(); AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb); proxyFactory.addAspect(NamedPointcutWithArgs.class); - + ITestBean proxiedTestBean = (ITestBean) proxyFactory.getProxy(); proxiedTestBean.setName("Supercalifragalisticexpialidocious"); // should throw } @@ -54,7 +54,7 @@ public void testAnnotationArgumentNameBinding() { TransactionalBean tb = new TransactionalBean(); AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb); proxyFactory.addAspect(PointcutWithAnnotationArgument.class); - + ITransactionalBean proxiedTestBean = (ITransactionalBean) proxyFactory.getProxy(); proxiedTestBean.doInTransaction(); // should throw } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java index ead9f1f62cc1..88beb1455a50 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,56 +29,56 @@ /** - * @author Rod Johnson + * @author Rod Johnson * @author Chris Beams */ public final class AspectJPointcutAdvisorTests { - + private AspectJAdvisorFactory af = new ReflectiveAspectJAdvisorFactory(); @Test public void testSingleton() throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS); - - InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp, - new SingletonMetadataAwareAspectInstanceFactory(new AbstractAspectJAdvisorFactoryTests.ExceptionAspect(null),"someBean"), + + InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp, + new SingletonMetadataAwareAspectInstanceFactory(new AbstractAspectJAdvisorFactoryTests.ExceptionAspect(null),"someBean"), TestBean.class.getMethod("getAge", (Class[]) null),1,"someBean"); assertSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut()); assertFalse(ajpa.isPerInstance()); } - + @Test public void testPerTarget() throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS); - - InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp, + + InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp, new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(),"someBean"), null, 1, "someBean"); assertNotSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut); assertTrue(ajpa.isPerInstance()); - + assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class)); assertFalse(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getAge", (Class[]) null), TestBean.class)); - + assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getSpouse", (Class[]) null), TestBean.class)); } - + @Test(expected=AopConfigException.class) public void testPerCflowTarget() { testIllegalInstantiationModel(AbstractAspectJAdvisorFactoryTests.PerCflowAspect.class); } - + @Test(expected=AopConfigException.class) public void testPerCflowBelowTarget() { testIllegalInstantiationModel(AbstractAspectJAdvisorFactoryTests.PerCflowBelowAspect.class); } - + private void testIllegalInstantiationModel(Class c) throws AopConfigException { new AspectMetadata(c,"someBean"); } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java index f1c32fe992ea..af55e122a63c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectMetadataTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ public final class AspectMetadataTests { public void testNotAnAspect() { new AspectMetadata(String.class,"someBean"); } - + @Test public void testSingletonAspect() { AspectMetadata am = new AspectMetadata(ExceptionAspect.class,"someBean"); @@ -45,7 +45,7 @@ public void testSingletonAspect() { assertSame(Pointcut.TRUE, am.getPerClausePointcut()); assertEquals(PerClauseKind.SINGLETON, am.getAjType().getPerClause().getKind()); } - + @Test public void testPerTargetAspect() { AspectMetadata am = new AspectMetadata(PerTargetAspect.class,"someBean"); @@ -53,7 +53,7 @@ public void testPerTargetAspect() { assertNotSame(Pointcut.TRUE, am.getPerClausePointcut()); assertEquals(PerClauseKind.PERTARGET, am.getAjType().getPerClause().getKind()); } - + @Test public void testPerThisAspect() { AspectMetadata am = new AspectMetadata(PerThisAspect.class,"someBean"); diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java index d6c24cd0a106..ecbd1b0c14cb 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java index 9cb01199f061..085e8c5d9f51 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactoryTests.java @@ -17,7 +17,7 @@ package org.springframework.aop.aspectj.annotation; /** - * Tests for ReflectiveAtAspectJAdvisorFactory. + * Tests for ReflectiveAtAspectJAdvisorFactory. * Tests are inherited: we only set the test fixture here. * * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java index 6b7d3ff09656..0dc4555c0724 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java index 0869a1fa02dd..9a65ae7c8fbd 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,9 +42,9 @@ public final class AspectJPrecedenceComparatorTests { /* - * Specification for the comparator (as defined in the + * Specification for the comparator (as defined in the * AspectJPrecedenceComparator class) - * + * *

    * Orders AspectJ advice/advisors by invocation order. *

    diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java index de36eb98b631..0d86588b8c94 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,18 +43,18 @@ public final class AopNamespaceHandlerEventTests { private static final Class CLASS = AopNamespaceHandlerEventTests.class; - + private static final Resource CONTEXT = qualifiedResource(CLASS, "context.xml"); private static final Resource POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "pointcutEvents.xml"); private static final Resource POINTCUT_REF_CONTEXT = qualifiedResource(CLASS, "pointcutRefEvents.xml"); private static final Resource DIRECT_POINTCUT_EVENTS_CONTEXT = qualifiedResource(CLASS, "directPointcutEvents.xml"); - + private CollectingReaderEventListener eventListener = new CollectingReaderEventListener(); private XmlBeanDefinitionReader reader; private DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); - + @Before diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java index 860e3dd0ba85..b7754b693ecd 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,26 +17,24 @@ package org.springframework.aop.config; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; -import org.springframework.beans.factory.xml.XmlBeanFactory; /** * @author Mark Fisher * @author Chris Beams */ public final class AopNamespaceHandlerPointcutErrorTests { - + @Test public void testDuplicatePointcutConfig() { try { - new XmlBeanFactory(qualifiedResource(getClass(), "pointcutDuplication.xml")); + beanFactoryFromQualifiedResource(getClass(), "pointcutDuplication.xml"); fail("parsing should have caused a BeanDefinitionStoreException"); - } - catch (BeanDefinitionStoreException ex) { + } catch (BeanDefinitionStoreException ex) { assertTrue(ex.contains(BeanDefinitionParsingException.class)); } } @@ -44,7 +42,7 @@ public void testDuplicatePointcutConfig() { @Test public void testMissingPointcutConfig() { try { - new XmlBeanFactory(qualifiedResource(getClass(), "pointcutMissing.xml")); + beanFactoryFromQualifiedResource(getClass(), "pointcutMissing.xml"); fail("parsing should have caused a BeanDefinitionStoreException"); } catch (BeanDefinitionStoreException ex) { diff --git a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java index 353df218fa47..40209c7d7bf0 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java @@ -26,12 +26,12 @@ /** * Tests that the <aop:config/> element can be used as a top level element. - * + * * @author Rob Harrop * @author Chris Beams */ public final class TopLevelAopTagTests { - + private static final Resource CONTEXT = qualifiedResource(TopLevelAopTagTests.class, "context.xml"); @Test diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java index dda6cf20b1aa..75eadcf99ab1 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ * @author Chris Beams */ public final class AopProxyUtilsTests { - + @Test public void testCompleteProxiedInterfacesWorksWithNull() { AdvisedSupport as = new AdvisedSupport(); @@ -45,7 +45,7 @@ public void testCompleteProxiedInterfacesWorksWithNull() { assertTrue(ifaces.contains(Advised.class)); assertTrue(ifaces.contains(SpringProxy.class)); } - + @Test public void testCompleteProxiedInterfacesWorksWithNullOpaque() { AdvisedSupport as = new AdvisedSupport(); @@ -53,7 +53,7 @@ public void testCompleteProxiedInterfacesWorksWithNullOpaque() { Class[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as); assertEquals(1, completedInterfaces.length); } - + @Test public void testCompleteProxiedInterfacesAdvisedNotIncluded() { AdvisedSupport as = new AdvisedSupport(); @@ -61,14 +61,14 @@ public void testCompleteProxiedInterfacesAdvisedNotIncluded() { as.addInterface(Comparable.class); Class[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as); assertEquals(4, completedInterfaces.length); - + // Can't assume ordering for others, so use a list List l = Arrays.asList(completedInterfaces); assertTrue(l.contains(Advised.class)); assertTrue(l.contains(ITestBean.class)); assertTrue(l.contains(Comparable.class)); } - + @Test public void testCompleteProxiedInterfacesAdvisedIncluded() { AdvisedSupport as = new AdvisedSupport(); @@ -77,14 +77,14 @@ public void testCompleteProxiedInterfacesAdvisedIncluded() { as.addInterface(Advised.class); Class[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as); assertEquals(4, completedInterfaces.length); - + // Can't assume ordering for others, so use a list List l = Arrays.asList(completedInterfaces); assertTrue(l.contains(Advised.class)); assertTrue(l.contains(ITestBean.class)); assertTrue(l.contains(Comparable.class)); } - + @Test public void testCompleteProxiedInterfacesAdvisedNotIncludedOpaque() { AdvisedSupport as = new AdvisedSupport(); @@ -93,7 +93,7 @@ public void testCompleteProxiedInterfacesAdvisedNotIncludedOpaque() { as.addInterface(Comparable.class); Class[] completedInterfaces = AopProxyUtils.completeProxiedInterfaces(as); assertEquals(3, completedInterfaces.length); - + // Can't assume ordering for others, so use a list List l = Arrays.asList(completedInterfaces); assertFalse(l.contains(Advised.class)); @@ -136,4 +136,4 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl AopProxyUtils.proxiedUserInterfaces(proxy); } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java index a8623ba81c74..9de89648053c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,9 +25,9 @@ /** * Benchmarks for introductions. - * + * * NOTE: No assertions! - * + * * @author Rod Johnson * @author Chris Beams * @since 2.0 diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java index 4fdbbc0126b8..883fdde9721c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ * @since 14.03.2003 */ public final class MethodInvocationTests { - + @Test public void testValidInvocation() throws Throwable { Method m = Object.class.getMethod("hashCode", (Class[]) null); @@ -52,7 +52,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { Object rv = invocation.proceed(); assertTrue("correct response", rv == returnValue); } - + /** * toString on target can cause failure. */ @@ -68,7 +68,7 @@ public String toString() { Method m = Object.class.getMethod("hashCode", (Class[]) null); Object proxy = new Object(); ReflectiveMethodInvocation invocation = - new ReflectiveMethodInvocation(proxy, target, m, null, null, is); + new ReflectiveMethodInvocation(proxy, target, m, null, null, is); // If it hits target, the test will fail with the UnsupportedOpException // in the inner class above. diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java index fd4eae3a7fb4..59f27fb0bfd7 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,12 @@ package org.springframework.aop.framework; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.BeanFactory; /** * @author Juergen Hoeller @@ -31,36 +30,30 @@ * @since 03.09.2004 */ public final class PrototypeTargetTests { - - private static final Resource CONTEXT = qualifiedResource(PrototypeTargetTests.class, "context.xml"); @Test public void testPrototypeProxyWithPrototypeTarget() { - TestBeanImpl.constructionCount = 0; - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); - for (int i = 0; i < 10; i++) { - TestBean tb = (TestBean) xbf.getBean("testBeanPrototype"); - tb.doSomething(); - } - TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor"); - assertEquals(10, TestBeanImpl.constructionCount); - assertEquals(10, interceptor.invocationCount); + assertConstructionAndInvocationCounts("testBeanPrototype", 10, 10); } @Test public void testSingletonProxyWithPrototypeTarget() { + assertConstructionAndInvocationCounts("testBeanSingleton", 1, 10); + } + + private void assertConstructionAndInvocationCounts(String beanName, + int constructionCount, int invocationCount) { TestBeanImpl.constructionCount = 0; - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml"); for (int i = 0; i < 10; i++) { - TestBean tb = (TestBean) xbf.getBean("testBeanSingleton"); + TestBean tb = (TestBean) bf.getBean(beanName); tb.doSomething(); } - TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor"); - assertEquals(1, TestBeanImpl.constructionCount); - assertEquals(10, interceptor.invocationCount); + TestInterceptor interceptor = (TestInterceptor) bf.getBean("testInterceptor"); + assertEquals(constructionCount, TestBeanImpl.constructionCount); + assertEquals(invocationCount, interceptor.invocationCount); } - public static interface TestBean { public void doSomething(); } diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java index f7d325e4c53f..3a867c666640 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public void testIndexOfMethods() { assertEquals(1, pf.indexOf(advisor)); assertEquals(-1, advised.indexOf(new DefaultPointcutAdvisor(null))); } - + @Test public void testRemoveAdvisorByReference() { TestBean target = new TestBean(); @@ -84,7 +84,7 @@ public void testRemoveAdvisorByReference() { assertEquals(2, nop.getCount()); assertFalse(pf.removeAdvisor(new DefaultPointcutAdvisor(null))); } - + @Test public void testRemoveAdvisorByIndex() { TestBean target = new TestBean(); @@ -113,7 +113,7 @@ public void testRemoveAdvisorByIndex() { assertEquals(1, cba.getCalls()); assertEquals(2, nop.getCount()); assertEquals(3, nop2.getCount()); - + // Check out of bounds try { pf.removeAdvisor(-1); @@ -121,14 +121,14 @@ public void testRemoveAdvisorByIndex() { catch (AopConfigException ex) { // Ok } - + try { pf.removeAdvisor(2); } catch (AopConfigException ex) { // Ok } - + assertEquals(5, proxied.getAge()); assertEquals(4, nop2.getCount()); } @@ -191,17 +191,17 @@ public int compareTo(Object arg0) { assertEquals("Found correct number of interfaces", 3, factory.getProxiedInterfaces().length); ITestBean tb = (ITestBean) factory.getProxy(); assertThat("Picked up secondary interface", tb, instanceOf(IOther.class)); - + raw.setAge(25); assertTrue(tb.getAge() == raw.getAge()); long t = 555555L; TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor(t); - + Class[] oldProxiedInterfaces = factory.getProxiedInterfaces(); - + factory.addAdvisor(0, new DefaultIntroductionAdvisor(ti, TimeStamped.class)); - + Class[] newProxiedInterfaces = factory.getProxiedInterfaces(); assertEquals("Advisor proxies one more interface after introduction", oldProxiedInterfaces.length + 1, newProxiedInterfaces.length); @@ -210,7 +210,7 @@ public int compareTo(Object arg0) { // Shouldn't fail; ((IOther) ts).absquatulate(); } - + @Test public void testInterceptorInclusionMethods() { class MyInterceptor implements MethodInterceptor { @@ -218,7 +218,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { throw new UnsupportedOperationException(); } } - + NopInterceptor di = new NopInterceptor(); NopInterceptor diUnused = new NopInterceptor(); ProxyFactory factory = new ProxyFactory(new TestBean()); @@ -228,7 +228,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { assertTrue(!factory.adviceIncluded(diUnused)); assertTrue(factory.countAdvicesOfType(NopInterceptor.class) == 1); assertTrue(factory.countAdvicesOfType(MyInterceptor.class) == 0); - + factory.addAdvice(0, diUnused); assertTrue(factory.adviceIncluded(diUnused)); assertTrue(factory.countAdvicesOfType(NopInterceptor.class) == 2); diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java index ceae4f577e8c..127001b58ec7 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,7 +150,7 @@ public void afterThrowing(RemoteException ex) throws Throwable { } @SuppressWarnings("serial") - private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice { + public static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice { // Full method signature public void afterThrowing(Method m, Object[] args, Object target, IOException ex) { count("ioException"); diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java index 9b3aaf6d9a34..487427aa6042 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java index 1fe27b3dfc58..639bd1a56cf4 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java index 6ac026fcbf4a..d2f8b9b69507 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public final class DebugInterceptorTests { @Test public void testSunnyDayPathLogsCorrectly() throws Throwable { Log log = createMock(Log.class); - + MethodInvocation methodInvocation = createMock(MethodInvocation.class); expect(log.isTraceEnabled()).andReturn(true); @@ -56,7 +56,7 @@ public void testSunnyDayPathLogsCorrectly() throws Throwable { @Test public void testExceptionPathStillLogsCorrectly() throws Throwable { Log log = createMock(Log.class); - + MethodInvocation methodInvocation = createMock(MethodInvocation.class); expect(log.isTraceEnabled()).andReturn(true); diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java index cc105bebcd61..2ceac0586185 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,20 +30,20 @@ * @author Chris Beams */ public final class ExposeBeanNameAdvisorsTests { - + private class RequiresBeanNameBoundTestBean extends TestBean { private final String beanName; - + public RequiresBeanNameBoundTestBean(String beanName) { this.beanName = beanName; } - + public int getAge() { assertEquals(beanName, ExposeBeanNameAdvisors.getBeanName()); return super.getAge(); } } - + @Test public void testNoIntroduction() { String beanName = "foo"; @@ -52,12 +52,12 @@ public void testNoIntroduction() { pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR); pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorWithoutIntroduction(beanName)); ITestBean proxy = (ITestBean) pf.getProxy(); - + assertFalse("No introduction", proxy instanceof NamedBean); // Requires binding proxy.getAge(); } - + @Test public void testWithIntroduction() { String beanName = "foo"; @@ -66,11 +66,11 @@ public void testWithIntroduction() { pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR); pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorIntroducingNamedBean(beanName)); ITestBean proxy = (ITestBean) pf.getProxy(); - + assertTrue("Introduction was made", proxy instanceof NamedBean); // Requires binding proxy.getAge(); - + NamedBean nb = (NamedBean) proxy; assertEquals("Name returned correctly", beanName, nb.getBeanName()); } diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java index bfa9ea4d0535..e1f238667b65 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,32 +17,28 @@ package org.springframework.aop.interceptor; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.BeanFactory; import test.beans.ITestBean; import test.beans.TestBean; /** * Non-XML tests are in AbstractAopProxyTests - * + * * @author Rod Johnson * @author Chris Beams */ public final class ExposeInvocationInterceptorTests { - - private static final Resource CONTEXT = - qualifiedResource(ExposeInvocationInterceptorTests.class, "context.xml"); @Test public void testXmlConfig() { - XmlBeanFactory bf = new XmlBeanFactory(CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml"); ITestBean tb = (ITestBean) bf.getBean("proxy"); - String name= "tony"; + String name = "tony"; tb.setName(name); // Fires context checks assertEquals(name, tb.getName()); @@ -50,7 +46,6 @@ public void testXmlConfig() { } - abstract class ExposedInvocationTestBean extends TestBean { public String getName() { @@ -64,15 +59,15 @@ public void absquatulate() { assertions(invocation); super.absquatulate(); } - + protected abstract void assertions(MethodInvocation invocation); } - class InvocationCheckExposedInvocationTestBean extends ExposedInvocationTestBean { + protected void assertions(MethodInvocation invocation) { assertTrue(invocation.getThis() == this); - assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(), - ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass())); + assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(), + ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass())); } } diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java index 5cc35f10ecbf..de7f7bce5416 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java index 7845f1268b67..20c165af9cb2 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java index 80f62da86b70..8dc810eb18d5 100644 --- a/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java index 3706293c2c33..056967979156 100644 --- a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,26 +17,20 @@ package org.springframework.aop.scope; import static org.junit.Assert.assertSame; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.BeanFactory; /** * @author Mark Fisher * @author Chris Beams */ public final class ScopedProxyAutowireTests { - - private static final Class CLASS = ScopedProxyAutowireTests.class; - - private static final Resource SCOPED_AUTOWIRE_TRUE_CONTEXT = qualifiedResource(CLASS, "scopedAutowireTrue.xml"); - private static final Resource SCOPED_AUTOWIRE_FALSE_CONTEXT = qualifiedResource(CLASS, "scopedAutowireFalse.xml"); @Test public void testScopedProxyInheritsAutowireCandidateFalse() { - XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_FALSE_CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "scopedAutowireFalse.xml"); TestBean autowired = (TestBean) bf.getBean("autowired"); TestBean unscoped = (TestBean) bf.getBean("unscoped"); assertSame(unscoped, autowired.getChild()); @@ -44,7 +38,7 @@ public void testScopedProxyInheritsAutowireCandidateFalse() { @Test public void testScopedProxyReplacesAutowireCandidateTrue() { - XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_TRUE_CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "scopedAutowireTrue.xml"); TestBean autowired = (TestBean) bf.getBean("autowired"); TestBean scoped = (TestBean) bf.getBean("scoped"); assertSame(scoped, autowired.getChild()); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java index b230ed726052..284809d236d2 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java index c423579aa01f..b17b8ac6030e 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public boolean matches(Method method, Class clazzy) { return false; } } - + Pointcut no = new TestPointcut(); assertFalse(AopUtils.canApply(no, Object.class)); } @@ -64,7 +64,7 @@ public boolean matches(Method method, Class clazz) { } Pointcut pc = new TestPointcut(); - + // will return true if we're not proxying interfaces assertTrue(AopUtils.canApply(pc, Object.class)); } diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java index 3c9f37ef1371..42992fb57c2a 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ClassFiltersTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,11 +30,11 @@ * @author Chris Beams */ public final class ClassFiltersTests { - + private ClassFilter exceptionFilter = new RootClassFilter(Exception.class); - + private ClassFilter itbFilter = new RootClassFilter(ITestBean.class); - + private ClassFilter hasRootCauseFilter = new RootClassFilter(NestedRuntimeException.class); @Test @@ -47,7 +47,7 @@ public void testUnion() { assertTrue(union.matches(RuntimeException.class)); assertTrue(union.matches(TestBean.class)); } - + @Test public void testIntersection() { assertTrue(exceptionFilter.matches(RuntimeException.class)); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java index 1c250e966da3..ac320429ad07 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java index 85b40b9112e5..eec75f28afd2 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,31 +33,31 @@ * @author Chris Beams */ public final class ComposablePointcutTests { - + public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() { public boolean matches(Method m, Class targetClass) { return m.getName().startsWith("get"); } }; - + public static MethodMatcher GET_AGE_METHOD_MATCHER = new StaticMethodMatcher() { public boolean matches(Method m, Class targetClass) { return m.getName().equals("getAge"); } }; - + public static MethodMatcher ABSQUATULATE_METHOD_MATCHER = new StaticMethodMatcher() { public boolean matches(Method m, Class targetClass) { return m.getName().equals("absquatulate"); } }; - + public static MethodMatcher SETTER_METHOD_MATCHER = new StaticMethodMatcher() { public boolean matches(Method m, Class targetClass) { return m.getName().startsWith("set"); } }; - + @Test public void testMatchAll() throws NoSuchMethodException { Pointcut pc = new ComposablePointcut(); @@ -68,9 +68,9 @@ public void testMatchAll() throws NoSuchMethodException { @Test public void testFilterByClass() throws NoSuchMethodException { ComposablePointcut pc = new ComposablePointcut(); - + assertTrue(pc.getClassFilter().matches(Object.class)); - + ClassFilter cf = new RootClassFilter(Exception.class); pc.intersection(cf); assertFalse(pc.getClassFilter().matches(Object.class)); @@ -92,15 +92,15 @@ public void testUnionMethodMatcher() { assertFalse(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class, null)); assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class, null)); assertFalse(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_NAME, TestBean.class, null)); - + pc.union(GETTER_METHOD_MATCHER); // Should now match all getter methods assertFalse(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class, null)); assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class, null)); assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_NAME, TestBean.class, null)); - + pc.union(ABSQUATULATE_METHOD_MATCHER); - // Should now match absquatulate() as well + // Should now match absquatulate() as well assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class, null)); assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class, null)); assertTrue(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_GET_NAME, TestBean.class, null)); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java index ed17db66188b..6288f7674af4 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ * @author Chris Beams */ public final class ControlFlowPointcutTests { - + @Test public void testMatches() { TestBean target = new TestBean(); @@ -41,21 +41,21 @@ public void testMatches() { ProxyFactory pf = new ProxyFactory(target); ITestBean proxied = (ITestBean) pf.getProxy(); pf.addAdvisor(new DefaultPointcutAdvisor(cflow, nop)); - + // Not advised, not under One assertEquals(target.getAge(), proxied.getAge()); assertEquals(0, nop.getCount()); - + // Will be advised assertEquals(target.getAge(), new One().getAge(proxied)); assertEquals(1, nop.getCount()); - + // Won't be advised assertEquals(target.getAge(), new One().nomatch(proxied)); assertEquals(1, nop.getCount()); assertEquals(3, cflow.getEvaluations()); } - + /** * Check that we can use a cflow pointcut only in conjunction with * a static pointcut: e.g. all setter methods that are invoked under @@ -73,19 +73,19 @@ public void testSelectiveApplication() { ProxyFactory pf = new ProxyFactory(target); ITestBean proxied = (ITestBean) pf.getProxy(); pf.addAdvisor(new DefaultPointcutAdvisor(settersUnderOne, nop)); - + // Not advised, not under One target.setAge(16); assertEquals(0, nop.getCount()); - + // Not advised; under One but not a setter assertEquals(16, new One().getAge(proxied)); assertEquals(0, nop.getCount()); - + // Won't be advised new One().set(proxied); assertEquals(1, nop.getCount()); - + // We saved most evaluations assertEquals(1, cflow.getEvaluations()); } @@ -99,7 +99,7 @@ public void testEqualsAndHashCode() throws Exception { assertEquals(new ControlFlowPointcut(One.class, "getAge").hashCode(), new ControlFlowPointcut(One.class, "getAge").hashCode()); assertFalse(new ControlFlowPointcut(One.class, "getAge").hashCode() == new ControlFlowPointcut(One.class).hashCode()); } - + public class One { int getAge(ITestBean proxied) { return proxied.getAge(); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java index cd51a4895c4b..e3cf9801b2ad 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -79,7 +79,7 @@ public void testIntroductionInterceptorWithInterfaceHierarchy() throws Exception long timestamp = 111L; expect(ts.getTimeStamp()).andReturn(timestamp); replay(ts); - + factory.addAdvisor(0, new DefaultIntroductionAdvisor(new DelegatingIntroductionInterceptor(ts), SubTimeStamped.class)); SubTimeStamped tsp = (SubTimeStamped) factory.getProxy(); @@ -160,7 +160,6 @@ public long getTimeStamp() { //assertTrue(Arrays.binarySearch(pf.getProxiedInterfaces(), TimeStamped.class) != -1); TimeStamped ts = (TimeStamped) pf.getProxy(); - assertTrue(ts instanceof TimeStamped); // Shoulnd't proxy framework interfaces assertTrue(!(ts instanceof MethodInterceptor)); assertTrue(!(ts instanceof IntroductionInterceptor)); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java index 4df8bcde48ef..d752d0ca5996 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,9 +37,9 @@ public final class MethodMatchersTests { private final Method EXCEPTION_GETMESSAGE; private final Method ITESTBEAN_SETAGE; - + private final Method ITESTBEAN_GETAGE; - + private final Method IOTHER_ABSQUATULATE; public MethodMatchersTests() throws Exception { @@ -55,7 +55,7 @@ public void testDefaultMatchesAll() throws Exception { assertTrue(defaultMm.matches(EXCEPTION_GETMESSAGE, Exception.class)); assertTrue(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class)); } - + @Test public void testMethodMatcherTrueSerializable() throws Exception { assertSame(SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE), MethodMatcher.TRUE); @@ -72,7 +72,7 @@ public void testSingle() throws Exception { assertFalse(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class)); } - + @Test public void testDynamicAndStaticMethodMatcherIntersection() throws Exception { MethodMatcher mm1 = MethodMatcher.TRUE; @@ -87,13 +87,13 @@ public void testDynamicAndStaticMethodMatcherIntersection() throws Exception { assertTrue("2Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class)); assertFalse("3 - not Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class, new Object[] { new Integer(5) })); } - + @Test public void testStaticMethodMatcherUnion() throws Exception { MethodMatcher getterMatcher = new StartsWithMatcher("get"); MethodMatcher setterMatcher = new StartsWithMatcher("set"); MethodMatcher union = MethodMatchers.union(getterMatcher, setterMatcher); - + assertFalse("Union is a static matcher", union.isRuntime()); assertTrue("Matched setAge method", union.matches(ITESTBEAN_SETAGE, TestBean.class)); assertTrue("Matched getAge method", union.matches(ITESTBEAN_GETAGE, TestBean.class)); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java index 996d72f02fa5..8b89281e763c 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,11 +34,11 @@ * @author Chris Beams */ public final class NameMatchMethodPointcutTests { - + protected NameMatchMethodPointcut pc; - + protected Person proxied; - + protected SerializableNopInterceptor nop; /** @@ -52,7 +52,7 @@ public void setUp() { pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop)); proxied = (Person) pf.getProxy(); } - + @Test public void testMatchingOnly() { // Can't do exact matching through isMatch @@ -63,7 +63,7 @@ public void testMatchingOnly() { assertFalse(pc.isMatch("setName", "set")); assertTrue(pc.isMatch("testing", "*ing")); } - + @Test public void testEmpty() throws Throwable { assertEquals(0, nop.getCount()); @@ -72,8 +72,8 @@ public void testEmpty() throws Throwable { proxied.echo(null); assertEquals(0, nop.getCount()); } - - + + @Test public void testMatchOneMethod() throws Throwable { pc.addMethodName("echo"); @@ -84,7 +84,7 @@ public void testMatchOneMethod() throws Throwable { assertEquals(0, nop.getCount()); proxied.echo(null); assertEquals(1, nop.getCount()); - + proxied.setName(""); assertEquals(2, nop.getCount()); proxied.setAge(25); @@ -102,7 +102,7 @@ public void testSets() throws Throwable { proxied.echo(null); assertEquals(2, nop.getCount()); } - + @Test public void testSerializable() throws Throwable { testSets(); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java index eb008c7f30e1..3c3bf029ee9f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,12 +31,12 @@ * @author Chris Beams */ public final class PointcutsTests { - + public static Method TEST_BEAN_SET_AGE; public static Method TEST_BEAN_GET_AGE; public static Method TEST_BEAN_GET_NAME; public static Method TEST_BEAN_ABSQUATULATE; - + static { try { TEST_BEAN_SET_AGE = TestBean.class.getMethod("setAge", new Class[] { int.class }); @@ -48,7 +48,7 @@ public final class PointcutsTests { throw new RuntimeException("Shouldn't happen: error in test suite"); } } - + /** * Matches only TestBean class, not subclasses */ @@ -65,13 +65,13 @@ public boolean matches(Method m, Class targetClass) { return true; } }; - + public static Pointcut allClassSetterPointcut = Pointcuts.SETTERS; - + // Subclass used for matching public static class MyTestBean extends TestBean { } - + public static Pointcut myTestBeanSetterPointcut = new StaticMethodMatcherPointcut() { public ClassFilter getClassFilter() { return new RootClassFilter(MyTestBean.class); @@ -81,7 +81,7 @@ public boolean matches(Method m, Class targetClass) { return m.getName().startsWith("set"); } }; - + // Will match MyTestBeanSubclass public static Pointcut myTestBeanGetterPointcut = new StaticMethodMatcherPointcut() { public ClassFilter getClassFilter() { @@ -92,11 +92,11 @@ public boolean matches(Method m, Class targetClass) { return m.getName().startsWith("get"); } }; - + // Still more specific class public static class MyTestBeanSubclass extends MyTestBean { } - + public static Pointcut myTestBeanSubclassGetterPointcut = new StaticMethodMatcherPointcut() { public ClassFilter getClassFilter() { return new RootClassFilter(MyTestBeanSubclass.class); @@ -106,14 +106,14 @@ public boolean matches(Method m, Class targetClass) { return m.getName().startsWith("get"); } }; - + public static Pointcut allClassGetterPointcut = Pointcuts.GETTERS; - + public static Pointcut allClassGetAgePointcut = new NameMatchMethodPointcut().addMethodName("getAge"); - + public static Pointcut allClassGetNamePointcut = new NameMatchMethodPointcut().addMethodName("getName"); - - + + @Test public void testTrue() { assertTrue(Pointcuts.matches(Pointcut.TRUE, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)})); @@ -133,7 +133,7 @@ public void testMatches() { assertTrue(Pointcuts.matches(allClassGetterPointcut, TEST_BEAN_GET_AGE, TestBean.class, null)); assertFalse(Pointcuts.matches(allClassGetterPointcut, TEST_BEAN_ABSQUATULATE, TestBean.class, null)); } - + /** * Should match all setters and getters on any class */ @@ -144,7 +144,7 @@ public void testUnionOfSettersAndGetters() { assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, TestBean.class, null)); assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null)); } - + @Test public void testUnionOfSpecificGetters() { Pointcut union = Pointcuts.union(allClassGetAgePointcut, allClassGetNamePointcut); @@ -153,7 +153,7 @@ public void testUnionOfSpecificGetters() { assertFalse(Pointcuts.matches(allClassGetAgePointcut, TEST_BEAN_GET_NAME, TestBean.class, null)); assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_NAME, TestBean.class, null)); assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null)); - + // Union with all setters union = Pointcuts.union(union, allClassSetterPointcut); assertTrue(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)})); @@ -161,10 +161,10 @@ public void testUnionOfSpecificGetters() { assertFalse(Pointcuts.matches(allClassGetAgePointcut, TEST_BEAN_GET_NAME, TestBean.class, null)); assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_NAME, TestBean.class, null)); assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null)); - + assertTrue(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)})); } - + /** * Tests vertical composition. First pointcut matches all setters. * Second one matches all getters in the MyTestBean class. TestBean getters shouldn't pass. @@ -174,7 +174,7 @@ public void testUnionOfAllSettersAndSubclassSetters() { assertFalse(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)})); assertTrue(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_SET_AGE, MyTestBean.class, new Object[] { new Integer(6)})); assertFalse(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_GET_AGE, TestBean.class, null)); - + Pointcut union = Pointcuts.union(myTestBeanSetterPointcut, allClassGetterPointcut); assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, TestBean.class, null)); assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, MyTestBean.class, null)); @@ -182,7 +182,7 @@ public void testUnionOfAllSettersAndSubclassSetters() { assertTrue(Pointcuts.matches(union, TEST_BEAN_SET_AGE, MyTestBean.class, new Object[] { new Integer(6)})); assertFalse(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, new Object[] { new Integer(6)})); } - + /** * Intersection should be MyTestBean getAge() only: * it's the union of allClassGetAge and subclass getters @@ -195,7 +195,7 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() { assertFalse(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_AGE, TestBean.class, null)); assertTrue(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_NAME, MyTestBean.class, null)); assertTrue(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_AGE, MyTestBean.class, null)); - + Pointcut intersection = Pointcuts.intersection(allClassGetAgePointcut, myTestBeanGetterPointcut); assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, TestBean.class, null)); assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, TestBean.class, null)); @@ -204,7 +204,7 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() { // Matches subclass of MyTestBean assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, MyTestBeanSubclass.class, null)); assertTrue(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, MyTestBeanSubclass.class, null)); - + // Now intersection with MyTestBeanSubclass getters should eliminate MyTestBean target intersection = Pointcuts.intersection(intersection, myTestBeanSubclassGetterPointcut); assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, TestBean.class, null)); @@ -214,7 +214,7 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() { // Still matches subclass of MyTestBean assertFalse(Pointcuts.matches(intersection, TEST_BEAN_GET_NAME, MyTestBeanSubclass.class, null)); assertTrue(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, MyTestBeanSubclass.class, null)); - + // Now union with all TestBean methods Pointcut union = Pointcuts.union(intersection, allTestBeanMethodsPointcut); assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_NAME, TestBean.class, null)); @@ -224,12 +224,12 @@ public void testIntersectionOfSpecificGettersAndSubclassGetters() { // Still matches subclass of MyTestBean assertFalse(Pointcuts.matches(union, TEST_BEAN_GET_NAME, MyTestBeanSubclass.class, null)); assertTrue(Pointcuts.matches(union, TEST_BEAN_GET_AGE, MyTestBeanSubclass.class, null)); - + assertTrue(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, TestBean.class, null)); assertFalse(Pointcuts.matches(union, TEST_BEAN_ABSQUATULATE, MyTestBean.class, null)); } - - + + /** * The intersection of these two pointcuts leaves nothing. */ diff --git a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java index 8218e4d5db3c..2a71e548f6f6 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,13 +17,11 @@ package org.springframework.aop.support; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.junit.Test; import org.springframework.aop.framework.Advised; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; import test.aop.NopInterceptor; import test.aop.SerializableNopInterceptor; @@ -37,18 +35,15 @@ * @author Chris Beams */ public final class RegexpMethodPointcutAdvisorIntegrationTests { - - private static final Resource CONTEXT = - qualifiedResource(RegexpMethodPointcutAdvisorIntegrationTests.class, "context.xml"); @Test public void testSinglePattern() throws Throwable { - BeanFactory bf = new XmlBeanFactory(CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml"); ITestBean advised = (ITestBean) bf.getBean("settersAdvised"); // Interceptor behind regexp advisor NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor"); assertEquals(0, nop.getCount()); - + int newAge = 12; // Not advised advised.exceptional(null); @@ -58,21 +53,21 @@ public void testSinglePattern() throws Throwable { // Only setter fired assertEquals(1, nop.getCount()); } - + @Test public void testMultiplePatterns() throws Throwable { - BeanFactory bf = new XmlBeanFactory(CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml"); // This is a CGLIB proxy, so we can proxy it to the target class TestBean advised = (TestBean) bf.getBean("settersAndAbsquatulateAdvised"); // Interceptor behind regexp advisor NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor"); assertEquals(0, nop.getCount()); - + int newAge = 12; // Not advised advised.exceptional(null); assertEquals(0, nop.getCount()); - + // This is proxied advised.absquatulate(); assertEquals(1, nop.getCount()); @@ -81,21 +76,21 @@ public void testMultiplePatterns() throws Throwable { // Only setter fired assertEquals(2, nop.getCount()); } - + @Test public void testSerialization() throws Throwable { - BeanFactory bf = new XmlBeanFactory(CONTEXT); + BeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "context.xml"); // This is a CGLIB proxy, so we can proxy it to the target class Person p = (Person) bf.getBean("serializableSettersAdvised"); // Interceptor behind regexp advisor NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor"); assertEquals(0, nop.getCount()); - + int newAge = 12; // Not advised assertEquals(0, p.getAge()); assertEquals(0, nop.getCount()); - + // This is proxied p.setAge(newAge); assertEquals(1, nop.getCount()); @@ -103,7 +98,7 @@ public void testSerialization() throws Throwable { assertEquals(newAge, p.getAge()); // Only setter fired assertEquals(2, nop.getCount()); - + // Serialize and continue... p = (Person) SerializationTestUtils.serializeAndDeserialize(p); assertEquals(newAge, p.getAge()); diff --git a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java index 69907b0f2f1c..269d585e9d42 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceProxyTests.java @@ -33,7 +33,7 @@ * @since 2.0 */ public final class CommonsPoolTargetSourceProxyTests { - + private static final Resource CONTEXT = qualifiedResource(CommonsPoolTargetSourceProxyTests.class, "context.xml"); diff --git a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java index 284c3ae56191..ef872560f880 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,7 @@ package org.springframework.aop.target; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.junit.After; import org.junit.Before; @@ -25,8 +25,7 @@ import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.support.DefaultPointcutAdvisor; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; import test.aop.SerializableNopInterceptor; import test.beans.Person; @@ -40,19 +39,17 @@ * @author Chris Beams */ public final class HotSwappableTargetSourceTests { - - private static final Resource CONTEXT = qualifiedResource(HotSwappableTargetSourceTests.class, "context.xml"); /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; - private XmlBeanFactory beanFactory; - + private ConfigurableBeanFactory beanFactory; + @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = beanFactoryFromQualifiedResource(getClass(), "context.xml"); } - + /** * We must simulate container shutdown, which should clear threads. */ @@ -72,42 +69,42 @@ public void testBasicFunctionality() { assertEquals(INITIAL_COUNT, proxied.getCount() ); proxied.doWork(); assertEquals(INITIAL_COUNT + 1, proxied.getCount() ); - + proxied = (SideEffectBean) beanFactory.getBean("swappable"); proxied.doWork(); assertEquals(INITIAL_COUNT + 2, proxied.getCount() ); } - + @Test public void testValidSwaps() { SideEffectBean target1 = (SideEffectBean) beanFactory.getBean("target1"); SideEffectBean target2 = (SideEffectBean) beanFactory.getBean("target2"); - + SideEffectBean proxied = (SideEffectBean) beanFactory.getBean("swappable"); assertEquals(target1.getCount(), proxied.getCount() ); proxied.doWork(); assertEquals(INITIAL_COUNT + 1, proxied.getCount() ); - + HotSwappableTargetSource swapper = (HotSwappableTargetSource) beanFactory.getBean("swapper"); Object old = swapper.swap(target2); assertEquals("Correct old target was returned", target1, old); - + // TODO should be able to make this assertion: need to fix target handling // in AdvisedSupport //assertEquals(target2, ((Advised) proxied).getTarget()); - + assertEquals(20, proxied.getCount()); proxied.doWork(); assertEquals(21, target2.getCount()); - + // Swap it back swapper.swap(target1); assertEquals(target1.getCount(), proxied.getCount()); } - - + + /** - * + * * @param invalid * @return the message */ @@ -122,46 +119,46 @@ private IllegalArgumentException testRejectsSwapToInvalidValue(Object invalid) { // Ok aopex = ex; } - + // It shouldn't be corrupted, it should still work testBasicFunctionality(); return aopex; } - + @Test public void testRejectsSwapToNull() { IllegalArgumentException ex = testRejectsSwapToInvalidValue(null); assertTrue(ex.getMessage().indexOf("null") != -1); } - + // TODO test reject swap to wrong interface or class? // how to decide what's valid? - - + + @Test public void testSerialization() throws Exception { SerializablePerson sp1 = new SerializablePerson(); sp1.setName("Tony"); SerializablePerson sp2 = new SerializablePerson(); sp1.setName("Gordon"); - + HotSwappableTargetSource hts = new HotSwappableTargetSource(sp1); ProxyFactory pf = new ProxyFactory(); pf.addInterface(Person.class); pf.setTargetSource(hts); pf.addAdvisor(new DefaultPointcutAdvisor(new SerializableNopInterceptor())); Person p = (Person) pf.getProxy(); - + assertEquals(sp1.getName(), p.getName()); hts.swap(sp2); assertEquals(sp2.getName(), p.getName()); - + p = (Person) SerializationTestUtils.serializeAndDeserialize(p); // We need to get a reference to the client-side targetsource hts = (HotSwappableTargetSource) ((Advised) p).getTargetSource(); assertEquals(sp2.getName(), p.getName()); hts.swap(sp1); assertEquals(sp1.getName(), p.getName()); - + } } diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java index d6dc8f426cd6..03b92d94d12d 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java index b26fbb1e9118..c0ac218ae20e 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,12 @@ package org.springframework.aop.target; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import java.util.Set; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import test.beans.ITestBean; @@ -34,16 +33,10 @@ * @since 07.01.2005 */ public final class LazyInitTargetSourceTests { - - private static final Class CLASS = LazyInitTargetSourceTests.class; - - private static final Resource SINGLETON_CONTEXT = qualifiedResource(CLASS, "singleton.xml"); - private static final Resource CUSTOM_TARGET_CONTEXT = qualifiedResource(CLASS, "customTarget.xml"); - private static final Resource FACTORY_BEAN_CONTEXT = qualifiedResource(CLASS, "factoryBean.xml"); @Test public void testLazyInitSingletonTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(SINGLETON_CONTEXT); + DefaultListableBeanFactory bf = beanFactoryFromQualifiedResource(getClass(), "singleton.xml"); bf.preInstantiateSingletons(); ITestBean tb = (ITestBean) bf.getBean("proxy"); @@ -54,7 +47,8 @@ public void testLazyInitSingletonTargetSource() { @Test public void testCustomLazyInitSingletonTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(CUSTOM_TARGET_CONTEXT); + DefaultListableBeanFactory bf = beanFactoryFromQualifiedResource(getClass(), + "customTarget.xml"); bf.preInstantiateSingletons(); ITestBean tb = (ITestBean) bf.getBean("proxy"); @@ -65,7 +59,8 @@ public void testCustomLazyInitSingletonTargetSource() { @Test public void testLazyInitFactoryBeanTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(FACTORY_BEAN_CONTEXT); + DefaultListableBeanFactory bf = beanFactoryFromQualifiedResource(getClass(), + "factoryBean.xml"); bf.preInstantiateSingletons(); Set set1 = (Set) bf.getBean("proxy1"); diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java index 43ba8a211a7e..143601c44290 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,10 +41,12 @@ public final class PrototypeBasedTargetSourceTests { public void testSerializability() throws Exception { MutablePropertyValues tsPvs = new MutablePropertyValues(); tsPvs.add("targetBeanName", "person"); - RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class, tsPvs); + RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class); + tsBd.setPropertyValues(tsPvs); MutablePropertyValues pvs = new MutablePropertyValues(); - RootBeanDefinition bd = new RootBeanDefinition(SerializablePerson.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(SerializablePerson.class); + bd.setPropertyValues(pvs); bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); @@ -59,13 +61,14 @@ public void testSerializability() throws Exception { assertNotNull(sts.getTarget()); } - + private static class TestTargetSource extends AbstractPrototypeBasedTargetSource { - + /** * Nonserializable test field to check that subclass * state can't prevent serialization from working */ + @SuppressWarnings("unused") private TestBean thisFieldIsNotSerializable = new TestBean(); public Object getTarget() throws Exception { @@ -77,4 +80,4 @@ public void releaseTarget(Object target) throws Exception { } } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java index c5f0fa9d3859..cb4f80d38fea 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,13 +17,11 @@ package org.springframework.aop.target; import static org.junit.Assert.assertEquals; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; import test.beans.SideEffectBean; @@ -33,17 +31,15 @@ * @author Chris Beams */ public final class PrototypeTargetSourceTests { - - private static final Resource CONTEXT = qualifiedResource(PrototypeTargetSourceTests.class, "context.xml"); - + /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; - + private BeanFactory beanFactory; - + @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = beanFactoryFromQualifiedResource(getClass(), "context.xml"); } /** @@ -57,7 +53,7 @@ public void testPrototypeAndSingletonBehaveDifferently() { assertEquals(INITIAL_COUNT, singleton.getCount() ); singleton.doWork(); assertEquals(INITIAL_COUNT + 1, singleton.getCount() ); - + SideEffectBean prototype = (SideEffectBean) beanFactory.getBean("prototype"); assertEquals(INITIAL_COUNT, prototype.getCount() ); prototype.doWork(); diff --git a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java index bd79620b700b..4693df4128e5 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,12 +17,11 @@ package org.springframework.aop.target; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import test.beans.ITestBean; import test.beans.SideEffectBean; @@ -33,26 +32,24 @@ * @author Chris Beams */ public class ThreadLocalTargetSourceTests { - - private static final Resource CONTEXT = qualifiedResource(ThreadLocalTargetSourceTests.class, "context.xml"); /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; - private XmlBeanFactory beanFactory; - + private DefaultListableBeanFactory beanFactory; + @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = beanFactoryFromQualifiedResource(getClass(), "context.xml"); } - + /** * We must simulate container shutdown, which should clear threads. */ protected void tearDown() { this.beanFactory.destroySingletons(); } - + /** * Check we can use two different ThreadLocalTargetSources * managing objects of different types without them interfering @@ -64,7 +61,7 @@ public void testUseDifferentManagedInstancesInSameThread() { assertEquals(INITIAL_COUNT, apartment.getCount() ); apartment.doWork(); assertEquals(INITIAL_COUNT + 1, apartment.getCount() ); - + ITestBean test = (ITestBean) beanFactory.getBean("threadLocal2"); assertEquals("Rod", test.getName()); assertEquals("Kerry", test.getSpouse().getName()); @@ -76,11 +73,11 @@ public void testReuseInSameThread() { assertEquals(INITIAL_COUNT, apartment.getCount() ); apartment.doWork(); assertEquals(INITIAL_COUNT + 1, apartment.getCount() ); - + apartment = (SideEffectBean) beanFactory.getBean("apartment"); assertEquals(INITIAL_COUNT + 1, apartment.getCount() ); } - + /** * Relies on introduction. */ @@ -101,7 +98,7 @@ public void testCanGetStatsViaMixin() { // Only one thread so only one object can have been bound assertEquals(1, stats.getObjectCount()); } - + @Test public void testNewThreadHasOwnInstance() throws InterruptedException { SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment"); @@ -110,7 +107,7 @@ public void testNewThreadHasOwnInstance() throws InterruptedException { apartment.doWork(); apartment.doWork(); assertEquals(INITIAL_COUNT + 3, apartment.getCount() ); - + class Runner implements Runnable { public SideEffectBean mine; public void run() { @@ -124,16 +121,16 @@ public void run() { Thread t = new Thread(r); t.start(); t.join(); - + assertNotNull(r); - + // Check it didn't affect the other thread's copy assertEquals(INITIAL_COUNT + 3, apartment.getCount() ); - - // When we use other thread's copy in this thread + + // When we use other thread's copy in this thread // it should behave like ours assertEquals(INITIAL_COUNT + 3, r.mine.getCount() ); - + // Bound to two threads assertEquals(2, ((ThreadLocalTargetSourceStats) apartment).getObjectCount()); } diff --git a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java index ee0913a11460..f66421e2fd72 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java b/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java index 60c43c858ff6..140f0fee3d4d 100644 --- a/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java +++ b/spring-aop/src/test/java/test/annotation/EmptySpringAnnotation.java @@ -25,4 +25,4 @@ @Target(ElementType.TYPE) public @interface EmptySpringAnnotation { -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/aop/DefaultLockable.java b/spring-aop/src/test/java/test/aop/DefaultLockable.java index 42d6c73cb096..82c59d8bc543 100644 --- a/spring-aop/src/test/java/test/aop/DefaultLockable.java +++ b/spring-aop/src/test/java/test/aop/DefaultLockable.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ /** * Simple implementation of Lockable interface for use in mixins. - * + * * @author Rod Johnson */ public class DefaultLockable implements Lockable { diff --git a/spring-aop/src/test/java/test/aop/Lockable.java b/spring-aop/src/test/java/test/aop/Lockable.java index 94272745673b..cc1a869d9835 100644 --- a/spring-aop/src/test/java/test/aop/Lockable.java +++ b/spring-aop/src/test/java/test/aop/Lockable.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,15 +19,15 @@ /** * Simple interface to use for mixins - * + * * @author Rod Johnson * */ public interface Lockable { - + void lock(); - + void unlock(); - + boolean locked(); -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/aop/MethodCounter.java b/spring-aop/src/test/java/test/aop/MethodCounter.java index 9c5ed06e9ac7..745b7289cbbc 100644 --- a/spring-aop/src/test/java/test/aop/MethodCounter.java +++ b/spring-aop/src/test/java/test/aop/MethodCounter.java @@ -22,7 +22,7 @@ /** * Abstract superclass for counting advices etc. - * + * * @author Rod Johnson * @author Chris Beams */ diff --git a/spring-aop/src/test/java/test/aop/NopInterceptor.java b/spring-aop/src/test/java/test/aop/NopInterceptor.java index 81bdd9e703fb..1dc341d427b5 100644 --- a/spring-aop/src/test/java/test/aop/NopInterceptor.java +++ b/spring-aop/src/test/java/test/aop/NopInterceptor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,7 +25,7 @@ * @author Rod Johnson */ public class NopInterceptor implements MethodInterceptor { - + private int count; /** @@ -35,11 +35,11 @@ public Object invoke(MethodInvocation invocation) throws Throwable { increment(); return invocation.proceed(); } - + public int getCount() { return this.count; } - + protected void increment() { ++count; } diff --git a/spring-aop/src/test/java/test/aop/PerTargetAspect.java b/spring-aop/src/test/java/test/aop/PerTargetAspect.java index 2d373f17e7a7..eef3c3cdea16 100644 --- a/spring-aop/src/test/java/test/aop/PerTargetAspect.java +++ b/spring-aop/src/test/java/test/aop/PerTargetAspect.java @@ -1,5 +1,5 @@ /** - * + * */ package test.aop; @@ -32,4 +32,4 @@ public int getOrder() { public void setOrder(int order) { this.order = order; } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java b/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java index ca425b81f6c1..be041c6302fb 100644 --- a/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java +++ b/spring-aop/src/test/java/test/aop/SerializableNopInterceptor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,26 +23,26 @@ /** * Subclass of NopInterceptor that is serializable and * can be used to test proxy serialization. - * + * * @author Rod Johnson * @author Chris Beams */ @SuppressWarnings("serial") public class SerializableNopInterceptor extends NopInterceptor implements Serializable { - + /** * We must override this field and the related methods as * otherwise count won't be serialized from the non-serializable * NopInterceptor superclass. */ private int count; - + public int getCount() { return this.count; } - + protected void increment() { ++count; } - -} \ No newline at end of file + +} diff --git a/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java b/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java index 42ee4bf0ca3b..6745457a9d23 100644 --- a/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java +++ b/spring-aop/src/test/java/test/aop/TwoAdviceAspect.java @@ -34,4 +34,4 @@ public int returnCallCount(ProceedingJoinPoint pjp) throws Exception { public void countSet(int newAge) throws Exception { ++totalCalls; } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/Colour.java b/spring-aop/src/test/java/test/beans/Colour.java index 8793fd3f94ba..f91897055594 100644 --- a/spring-aop/src/test/java/test/beans/Colour.java +++ b/spring-aop/src/test/java/test/beans/Colour.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ /** * @author Rob Harrop */ -@SuppressWarnings("serial") +@SuppressWarnings({ "serial", "deprecation" }) public class Colour extends ShortCodedLabeledEnum { public static final Colour RED = new Colour(0, "RED"); @@ -33,4 +33,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/INestedTestBean.java b/spring-aop/src/test/java/test/beans/INestedTestBean.java index 228109c284ab..1023dbbc1399 100644 --- a/spring-aop/src/test/java/test/beans/INestedTestBean.java +++ b/spring-aop/src/test/java/test/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/IOther.java b/spring-aop/src/test/java/test/beans/IOther.java index 734235aa068a..80fe4e84983b 100644 --- a/spring-aop/src/test/java/test/beans/IOther.java +++ b/spring-aop/src/test/java/test/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/ITestBean.java b/spring-aop/src/test/java/test/beans/ITestBean.java index 74f371b05476..09c20ec73b4a 100644 --- a/spring-aop/src/test/java/test/beans/ITestBean.java +++ b/spring-aop/src/test/java/test/beans/ITestBean.java @@ -66,4 +66,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/NestedTestBean.java b/spring-aop/src/test/java/test/beans/NestedTestBean.java index d3fde438b67b..b0f9df9d9b6e 100644 --- a/spring-aop/src/test/java/test/beans/NestedTestBean.java +++ b/spring-aop/src/test/java/test/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/Person.java b/spring-aop/src/test/java/test/beans/Person.java index d163756b4e27..163f110d960e 100644 --- a/spring-aop/src/test/java/test/beans/Person.java +++ b/spring-aop/src/test/java/test/beans/Person.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,20 +17,20 @@ package test.beans; /** - * + * * @author Rod Johnson */ public interface Person { - + String getName(); void setName(String name); int getAge(); void setAge(int i); - - /** + + /** * Test for non-property method matching. - * If the parameter is a Throwable, it will be thrown rather than + * If the parameter is a Throwable, it will be thrown rather than * returned. */ Object echo(Object o) throws Throwable; -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/SerializablePerson.java b/spring-aop/src/test/java/test/beans/SerializablePerson.java index e0a1839c0c11..adb2966907e2 100644 --- a/spring-aop/src/test/java/test/beans/SerializablePerson.java +++ b/spring-aop/src/test/java/test/beans/SerializablePerson.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,26 +34,26 @@ public class SerializablePerson implements Person, Serializable { public int getAge() { return age; } - + public void setAge(int age) { this.age = age; } - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } - + public Object echo(Object o) throws Throwable { if (o instanceof Throwable) { throw (Throwable) o; } return o; } - + public boolean equals(Object other) { if (!(other instanceof SerializablePerson)) { return false; diff --git a/spring-aop/src/test/java/test/beans/SideEffectBean.java b/spring-aop/src/test/java/test/beans/SideEffectBean.java index ea8279e2c2d1..82871af75271 100644 --- a/spring-aop/src/test/java/test/beans/SideEffectBean.java +++ b/spring-aop/src/test/java/test/beans/SideEffectBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ * @author Rod Johnson */ public class SideEffectBean { - + private int count; - + public void setCount(int count) { this.count = count; } - + public int getCount() { return this.count; } - + public void doWork() { ++count; } diff --git a/spring-aop/src/test/java/test/beans/TestBean.java b/spring-aop/src/test/java/test/beans/TestBean.java index 8f14fd61a2c5..14d3d039fdbb 100644 --- a/spring-aop/src/test/java/test/beans/TestBean.java +++ b/spring-aop/src/test/java/test/beans/TestBean.java @@ -411,4 +411,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java b/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java index 7920111e2e88..211e10102347 100644 --- a/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java +++ b/spring-aop/src/test/java/test/beans/subpkg/DeepBean.java @@ -20,9 +20,9 @@ /** * Used for testing pointcut matching. - * + * * @see AspectJExpressionPointcutTests#testWithinRootAndSubpackages() - * + * * @author Chris Beams */ public class DeepBean { diff --git a/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java b/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java index 4d9355f616f8..6d50c8512240 100644 --- a/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java +++ b/spring-aop/src/test/java/test/parsing/CollectingReaderEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ public class CollectingReaderEventListener implements ReaderEventListener { private final Map componentDefinitions = new LinkedHashMap(8); - private final Map aliasMap = new LinkedHashMap(8); + private final Map> aliasMap = new LinkedHashMap>(8); private final List imports = new LinkedList(); @@ -67,18 +67,17 @@ public ComponentDefinition[] getComponentDefinitions() { return collection.toArray(new ComponentDefinition[collection.size()]); } - @SuppressWarnings("unchecked") public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); + List aliases = this.aliasMap.get(aliasDefinition.getBeanName()); if(aliases == null) { - aliases = new ArrayList(); + aliases = new ArrayList(); this.aliasMap.put(aliasDefinition.getBeanName(), aliases); } aliases.add(aliasDefinition); } public List getAliases(String beanName) { - List aliases = (List) this.aliasMap.get(beanName); + List aliases = this.aliasMap.get(beanName); return aliases == null ? null : Collections.unmodifiableList(aliases); } diff --git a/spring-aop/src/test/java/test/util/SerializationTestUtils.java b/spring-aop/src/test/java/test/util/SerializationTestUtils.java index 74130ff343cf..8fd73e3cfb06 100644 --- a/spring-aop/src/test/java/test/util/SerializationTestUtils.java +++ b/spring-aop/src/test/java/test/util/SerializationTestUtils.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2009 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -63,7 +63,7 @@ public static Object serializeAndDeserialize(Object o) throws IOException, Class oos.flush(); baos.flush(); byte[] bytes = baos.toByteArray(); - + ByteArrayInputStream is = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(is); Object o2 = ois.readObject(); @@ -84,7 +84,7 @@ public void testWithNonSerializableObject() throws IOException { public void testWithSerializableObject() throws Exception { int x = 5; int y = 10; - Point p = new Point(x, y); + Object p = new Point(x, y); assertTrue(p instanceof Serializable); testSerialization(p); diff --git a/spring-aop/src/test/java/test/util/TestResourceUtils.java b/spring-aop/src/test/java/test/util/TestResourceUtils.java index bae2b829acda..03303e78a549 100644 --- a/spring-aop/src/test/java/test/util/TestResourceUtils.java +++ b/spring-aop/src/test/java/test/util/TestResourceUtils.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,65 @@ import static java.lang.String.format; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; /** * Convenience utilities for common operations with test resources. * * @author Chris Beams + * @author Phillip Webb */ public class TestResourceUtils { /** - * Loads a {@link ClassPathResource} qualified by the simple name of clazz, - * and relative to the package for clazz. - * - *

    Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', - * this method will return a ClassPathResource representing com/foo/BarTests-context.xml - * - *

    Intended for use loading context configuration XML files within JUnit tests. - * + * Loads a {@link ClassPathResource} qualified by the simple name of clazz, and relative to the package for clazz. + * + *

    + * Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', this method will return a + * ClassPathResource representing com/foo/BarTests-context.xml + * + *

    + * Intended for use loading context configuration XML files within JUnit tests. + * + * @param clazz + * @param resourceSuffix + */ + public static ClassPathResource qualifiedResource(Class clazz, + String resourceSuffix) { + return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), + resourceSuffix), clazz); + } + + /** + * Creates a {@link DefaultListableBeanFactory} using a {@link #qualifiedResource(Class, String) qualified XML + * resource}. + * * @param clazz * @param resourceSuffix */ - public static ClassPathResource qualifiedResource(Class clazz, String resourceSuffix) { - return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz); + public static DefaultListableBeanFactory beanFactoryFromQualifiedResource( + Class clazz, String resourceSuffix) { + return beanFactoryFromQualifiedResource(clazz, resourceSuffix, null); } + /** + * Creates a {@link DefaultListableBeanFactory} using a {@link #qualifiedResource(Class, String) qualified XML + * resource}. + * + * @param clazz + * @param resourceSuffix + * @param parentBeanFactory + */ + public static DefaultListableBeanFactory beanFactoryFromQualifiedResource( + Class clazz, String resourceSuffix, BeanFactory parentBeanFactory) { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory( + parentBeanFactory); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); + ClassPathResource resource = qualifiedResource(clazz, resourceSuffix); + reader.loadBeanDefinitions(resource); + return beanFactory; + } } diff --git a/spring-aop/src/test/java/test/util/TimeStamped.java b/spring-aop/src/test/java/test/util/TimeStamped.java index 052b56ff7387..484d5dda44bb 100644 --- a/spring-aop/src/test/java/test/util/TimeStamped.java +++ b/spring-aop/src/test/java/test/util/TimeStamped.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ * @author Rod Johnson */ public interface TimeStamped { - + /** * Return the timestamp for this object. * @return long the timestamp for this object, diff --git a/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java b/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java index 13597f9a97ec..9aca558660f7 100644 --- a/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java +++ b/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java @@ -17,7 +17,7 @@ /** * Marker interface for domain object that need DI through aspects. - * + * * @author Ramnivas Laddad * @since 2.5 */ diff --git a/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java b/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java index 51347810dd07..8534fd76b5a3 100644 --- a/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java +++ b/spring-aspects/src/main/java/org/springframework/context/annotation/aspectj/SpringConfiguredConfiguration.java @@ -29,7 +29,7 @@ * Configurable}. * *

    This configuration class is automatically imported when using the @{@link - * EnableSpringConfigured} annotation. See {@code @EnableSpringConfigured} Javadoc for + * EnableSpringConfigured} annotation. See {@code @EnableSpringConfigured} Javadoc for * complete usage details. * * @author Chris Beams diff --git a/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj b/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj index 6ca2bd728c64..24e887098726 100644 --- a/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj +++ b/spring-aspects/src/main/java/org/springframework/mock/staticmock/AbstractMethodMockingControl.aj @@ -114,7 +114,7 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth if (responseType == CallResponse.return_) { return call.returnValue(lastSig, args); } else if(responseType == CallResponse.throw_) { - return (RuntimeException)call.throwException(lastSig, args); + return call.throwException(lastSig, args); } else if(responseType == CallResponse.nothing) { // do nothing } diff --git a/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java b/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java index 2dd6faa417a2..e6f8cb8459e7 100644 --- a/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java +++ b/spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/AutoProxyWithCodeStyleAspectsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public class AutoProxyWithCodeStyleAspectsTests extends TestCase { public void testNoAutoproxyingOfAjcCompiledAspects() { - new ClassPathXmlApplicationContext("org/springframework/aop/aspectj/autoproxy/ajcAutoproxyTests.xml"); + new ClassPathXmlApplicationContext("org/springframework/aop/aspectj/autoproxy/ajcAutoproxyTests.xml"); } - + } diff --git a/spring-aspects/src/test/java/org/springframework/beans/Colour.java b/spring-aspects/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..4db722187d9d 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/Colour.java +++ b/spring-aspects/src/test/java/org/springframework/beans/Colour.java @@ -32,4 +32,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java index 2bb41a9d5b68..db326041c361 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java +++ b/spring-aspects/src/test/java/org/springframework/beans/DerivedTestBean.java @@ -82,4 +82,4 @@ public boolean wasDestroyed() { return destroyed; } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-aspects/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/IOther.java b/spring-aspects/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/IOther.java +++ b/spring-aspects/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java b/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-aspects/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..4f3012666eac 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-aspects/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-aspects/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/TestBean.java b/spring-aspects/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..4cd145c9bb7e 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-aspects/src/test/java/org/springframework/beans/TestBean.java @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java index 16e2522d9344..aae9ff6cd75c 100644 --- a/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java +++ b/spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/SpringConfiguredWithAutoProxyingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,4 +30,4 @@ protected void setUp() throws Exception { public void testSpringConfiguredAndAutoProxyUsedTogether() { ; // set up is sufficient to trigger failure if this is going to fail... } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java index b3f9d4937b7c..943b3e281d62 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java +++ b/spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractAnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 the original author or authors. + * Copyright 2010-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -593,4 +593,4 @@ public void testMultiConditionalCacheAndEvict() { public void testClassMultiConditionalCacheAndEvict() { testMultiConditionalCacheAndEvict(ccs); } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java index a6d1b4f7bda1..88f00b851722 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java +++ b/spring-aspects/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java @@ -135,4 +135,4 @@ public Object multiConditionalCacheAndEvict(Object arg1) { public Object multiUpdate(Object arg1) { return arg1; } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java index cdcb73b2cbcf..bd61e7435a99 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java +++ b/spring-aspects/src/test/java/org/springframework/cache/config/CacheableService.java @@ -18,7 +18,7 @@ /** * Basic service interface. - * + * * @author Costin Leau */ public interface CacheableService { @@ -67,4 +67,4 @@ public interface CacheableService { T multiConditionalCacheAndEvict(Object arg1); T multiUpdate(Object arg1); -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java b/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java index e8938a804e0f..2ad5b84b71f8 100644 --- a/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java +++ b/spring-aspects/src/test/java/org/springframework/cache/config/DefaultCacheableService.java @@ -25,7 +25,7 @@ /** * Simple cacheable service - * + * * @author Costin Leau */ public class DefaultCacheableService implements CacheableService { @@ -141,4 +141,4 @@ public Long multiConditionalCacheAndEvict(Object arg1) { public Long multiUpdate(Object arg1) { return Long.valueOf(arg1.toString()); } -} \ No newline at end of file +} diff --git a/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java b/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java index e33e3aa3f3d1..8c1584fc99c1 100644 --- a/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java +++ b/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public void testNoArgIntReturn() { playback(); Assert.assertEquals(expectedCount, Person.countPeople()); } - + @Test(expected=PersistenceException.class) public void testNoArgThrows() { Person.countPeople(); @@ -64,7 +64,7 @@ public void testArgMethodMatches() { Assert.assertEquals(found, Person.findPerson(id)); } - + @Test public void testLongSeriesOfCalls() { long id1 = 13; @@ -80,7 +80,7 @@ public void testLongSeriesOfCalls() { Person.countPeople(); expectReturn(0); playback(); - + Assert.assertEquals(found1, Person.findPerson(id1)); Assert.assertEquals(found2, Person.findPerson(id2)); Assert.assertEquals(found1, Person.findPerson(id1)); @@ -122,22 +122,22 @@ public void testReentrant() { public void testRejectUnexpectedCall() { new Delegate().rejectUnexpectedCall(); } - + @Test(expected=IllegalStateException.class) public void testFailTooFewCalls() { new Delegate().failTooFewCalls(); } - + @Test public void testEmpty() { // Test that verification check doesn't blow up if no replay() call happened } - + @Test(expected=IllegalStateException.class) public void testDoesntEverReplay() { new Delegate().doesntEverReplay(); } - + @Test(expected=IllegalStateException.class) public void testDoesntEverSetReturn() { new Delegate().doesntEverSetReturn(); diff --git a/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java b/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java index c99dfe0c2e33..ad9bac544385 100644 --- a/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java +++ b/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ public void testArgMethodNoMatchExpectThrow() { AnnotationDrivenStaticEntityMockingControl.playback(); Assert.assertEquals(found, Person.findPerson(id + 1)); } - + @Test public void failTooFewCalls() { long id = 13; @@ -69,7 +69,7 @@ public void failTooFewCalls() { public void doesntEverReplay() { Person.countPeople(); } - + @Test public void doesntEverSetReturn() { Person.countPeople(); @@ -81,7 +81,7 @@ public void rejectUnexpectedCall() { AnnotationDrivenStaticEntityMockingControl.playback(); Person.countPeople(); } - + @Test(expected=RemoteException.class) public void testVerificationFailsEvenWhenTestFailsInExpectedManner() throws RemoteException { Person.countPeople(); diff --git a/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java index d5c2531fbde5..563d61071495 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java @@ -50,7 +50,7 @@ protected void doRollback(DefaultTransactionStatus status) { ++rollbacks; --inflight; } - + public void clear() { begun = commits = rollbacks = inflight = 0; } diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java index 6351d55d0d7c..f718e0938552 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2006 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ public class ClassWithPrivateAnnotatedMember { public void doSomething() { doInTransaction(); } - + @Transactional private void doInTransaction() {} } diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java index f681c81e844a..18763dcc7423 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2006 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ public class ClassWithProtectedAnnotatedMember { public void doSomething() { doInTransaction(); } - + @Transactional protected void doInTransaction() {} } diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java index 19a115ea2143..7e8ef63d1657 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/ITransactional.java @@ -4,7 +4,7 @@ @Transactional public interface ITransactional { - + Object echo(Throwable t) throws Throwable; } diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java index 22cc31ebc65c..437a1a4f07ce 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/MethodAnnotationOnClassWithNoInterface.java @@ -3,7 +3,7 @@ import org.springframework.transaction.annotation.Transactional; public class MethodAnnotationOnClassWithNoInterface { - + @Transactional(rollbackFor=InterruptedException.class) public Object echo(Throwable t) throws Throwable { if (t != null) { @@ -11,9 +11,9 @@ public Object echo(Throwable t) throws Throwable { } return t; } - + public void noTransactionAttribute() { - + } } diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java index 9449b2bcf707..407a5e2e9919 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java @@ -31,17 +31,17 @@ * @author Ramnivas Laddad */ public class TransactionAspectTests extends AbstractDependencyInjectionSpringContextTests { - + private TransactionAspectSupport transactionAspect; - + private CallCountingTransactionManager txManager; - + private TransactionalAnnotationOnlyOnClassWithNoInterface annotationOnlyOnClassWithNoInterface; - + private ClassWithProtectedAnnotatedMember beanWithAnnotatedProtectedMethod; private ClassWithPrivateAnnotatedMember beanWithAnnotatedPrivateMethod; - + private MethodAnnotationOnClassWithNoInterface methodAnnotationOnly = new MethodAnnotationOnClassWithNoInterface(); @@ -49,7 +49,7 @@ public void setAnnotationOnlyOnClassWithNoInterface( TransactionalAnnotationOnlyOnClassWithNoInterface annotationOnlyOnClassWithNoInterface) { this.annotationOnlyOnClassWithNoInterface = annotationOnlyOnClassWithNoInterface; } - + public void setClassWithAnnotatedProtectedMethod(ClassWithProtectedAnnotatedMember aBean) { this.beanWithAnnotatedProtectedMethod = aBean; } @@ -84,14 +84,14 @@ public void testCommitOnAnnotatedProtectedMethod() throws Throwable { txManager.clear(); assertEquals(0, txManager.begun); beanWithAnnotatedProtectedMethod.doInTransaction(); - assertEquals(1, txManager.commits); + assertEquals(1, txManager.commits); } public void testCommitOnAnnotatedPrivateMethod() throws Throwable { txManager.clear(); assertEquals(0, txManager.begun); beanWithAnnotatedPrivateMethod.doSomething(); - assertEquals(1, txManager.commits); + assertEquals(1, txManager.commits); } public void testNoCommitOnNonAnnotatedNonPublicMethodInTransactionalType() throws Throwable { @@ -100,28 +100,28 @@ public void testNoCommitOnNonAnnotatedNonPublicMethodInTransactionalType() throw annotationOnlyOnClassWithNoInterface.nonTransactionalMethod(); assertEquals(0,txManager.begun); } - + public void testCommitOnAnnotatedMethod() throws Throwable { txManager.clear(); assertEquals(0, txManager.begun); methodAnnotationOnly.echo(null); assertEquals(1, txManager.commits); } - - + + public static class NotTransactional { public void noop() { } } - + public void testNotTransactional() throws Throwable { txManager.clear(); assertEquals(0, txManager.begun); new NotTransactional().noop(); assertEquals(0, txManager.begun); } - - + + public void testDefaultCommitOnAnnotatedClass() throws Throwable { testRollback(new TransactionOperationCallback() { public Object performTransactionalOperation() throws Throwable { @@ -129,7 +129,7 @@ public Object performTransactionalOperation() throws Throwable { } }, false); } - + public void testDefaultRollbackOnAnnotatedClass() throws Throwable { testRollback(new TransactionOperationCallback() { public Object performTransactionalOperation() throws Throwable { @@ -137,11 +137,11 @@ public Object performTransactionalOperation() throws Throwable { } }, true); } - - + + public static class SubclassOfClassWithTransactionalAnnotation extends TransactionalAnnotationOnlyOnClassWithNoInterface { } - + public void testDefaultCommitOnSubclassOfAnnotatedClass() throws Throwable { testRollback(new TransactionOperationCallback() { public Object performTransactionalOperation() throws Throwable { @@ -149,10 +149,10 @@ public Object performTransactionalOperation() throws Throwable { } }, false); } - + public static class SubclassOfClassWithTransactionalMethodAnnotation extends MethodAnnotationOnClassWithNoInterface { } - + public void testDefaultCommitOnSubclassOfClassWithTransactionalMethodAnnotated() throws Throwable { testRollback(new TransactionOperationCallback() { public Object performTransactionalOperation() throws Throwable { @@ -160,7 +160,7 @@ public Object performTransactionalOperation() throws Throwable { } }, false); } - + public static class ImplementsAnnotatedInterface implements ITransactional { public Object echo(Throwable t) throws Throwable { if (t != null) { @@ -169,14 +169,14 @@ public Object echo(Throwable t) throws Throwable { return t; } } - + public void testDefaultCommitOnImplementationOfAnnotatedInterface() throws Throwable { // testRollback(new TransactionOperationCallback() { // public Object performTransactionalOperation() throws Throwable { // return new ImplementsAnnotatedInterface().echo(new Exception()); // } // }, false); - + final Exception ex = new Exception(); testNotTransactional(new TransactionOperationCallback() { public Object performTransactionalOperation() throws Throwable { @@ -184,7 +184,7 @@ public Object performTransactionalOperation() throws Throwable { } }, ex); } - + /** * Note: resolution does not occur. Thus we can't make a class transactional if * it implements a transactionally annotated interface. This behaviour could only @@ -198,15 +198,15 @@ public void testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotated TransactionAttribute ta = atas.getTransactionAttribute(m, ImplementsAnnotatedInterface.class); assertNull(ta); } - - + + public void testDefaultRollbackOnImplementationOfAnnotatedInterface() throws Throwable { // testRollback(new TransactionOperationCallback() { // public Object performTransactionalOperation() throws Throwable { // return new ImplementsAnnotatedInterface().echo(new RuntimeException()); // } // }, true); - + final Exception rollbackProvokingException = new RuntimeException(); testNotTransactional(new TransactionOperationCallback() { public Object performTransactionalOperation() throws Throwable { @@ -215,7 +215,7 @@ public Object performTransactionalOperation() throws Throwable { }, rollbackProvokingException); } - + protected void testRollback(TransactionOperationCallback toc, boolean rollback) throws Throwable { txManager.clear(); assertEquals(0, txManager.begun); @@ -228,13 +228,13 @@ protected void testRollback(TransactionOperationCallback toc, boolean rollback) return; } } - + if (rollback) { assertEquals(1, txManager.rollbacks); } assertEquals(1, txManager.begun); } - + protected void testNotTransactional(TransactionOperationCallback toc, Throwable expected) throws Throwable { txManager.clear(); assertEquals(0, txManager.begun); @@ -251,7 +251,7 @@ protected void testNotTransactional(TransactionOperationCallback toc, Throwable assertEquals(0, txManager.begun); } } - + private interface TransactionOperationCallback { diff --git a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java index 691506baa035..93bd225f7ca1 100644 --- a/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java +++ b/spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionalAnnotationOnlyOnClassWithNoInterface.java @@ -4,14 +4,14 @@ @Transactional public class TransactionalAnnotationOnlyOnClassWithNoInterface { - + public Object echo(Throwable t) throws Throwable { if (t != null) { throw t; } return t; } - + void nonTransactionalMethod() { // no-op } diff --git a/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java b/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java index c72277d2cf25..8febd8f010a8 100644 --- a/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java @@ -105,7 +105,7 @@ public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean // Redefined with public visibility. @Override - public Class getPropertyType(String propertyPath) { + public Class getPropertyType(String propertyPath) { return null; } diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java b/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java index 46e45ba1efd3..01e40c0faca4 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ */ public class BeanInstantiationException extends FatalBeanException { - private Class beanClass; + private Class beanClass; /** @@ -33,7 +33,7 @@ public class BeanInstantiationException extends FatalBeanException { * @param beanClass the offending bean class * @param msg the detail message */ - public BeanInstantiationException(Class beanClass, String msg) { + public BeanInstantiationException(Class beanClass, String msg) { this(beanClass, msg, null); } @@ -43,7 +43,7 @@ public BeanInstantiationException(Class beanClass, String msg) { * @param msg the detail message * @param cause the root cause */ - public BeanInstantiationException(Class beanClass, String msg, Throwable cause) { + public BeanInstantiationException(Class beanClass, String msg, Throwable cause) { super("Could not instantiate bean class [" + beanClass.getName() + "]: " + msg, cause); this.beanClass = beanClass; } @@ -51,7 +51,7 @@ public BeanInstantiationException(Class beanClass, String msg, Throwable cause) /** * Return the offending bean class. */ - public Class getBeanClass() { + public Class getBeanClass() { return beanClass; } diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java index aea348d6fdda..abd06723c22b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor { * @return the type of the wrapped bean instance, * or null if no wrapped object has been set */ - Class getWrappedClass(); + Class getWrappedClass(); /** * Obtain the PropertyDescriptors for the wrapped object diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index efe6fccbcc21..12ee9db4968a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -225,7 +225,7 @@ public final Object getWrappedInstance() { return this.object; } - public final Class getWrappedClass() { + public final Class getWrappedClass() { return (this.object != null ? this.object.getClass() : null); } @@ -248,7 +248,7 @@ public final Object getRootInstance() { * Return the class of the root object at the top of the path of this BeanWrapper. * @see #getNestedPath */ - public final Class getRootClass() { + public final Class getRootClass() { return (this.rootObject != null ? this.rootObject.getClass() : null); } @@ -306,7 +306,7 @@ public AccessControlContext getSecurityContext() { * Needs to be called when the target object changes. * @param clazz the class to introspect */ - protected void setIntrospectionClass(Class clazz) { + protected void setIntrospectionClass(Class clazz) { if (this.cachedIntrospectionResults != null && !clazz.equals(this.cachedIntrospectionResults.getBeanClass())) { this.cachedIntrospectionResults = null; @@ -354,7 +354,7 @@ protected PropertyDescriptor getPropertyDescriptorInternal(String propertyName) } @Override - public Class getPropertyType(String propertyName) throws BeansException { + public Class getPropertyType(String propertyName) throws BeansException { try { PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName); if (pd != null) { @@ -368,7 +368,7 @@ public Class getPropertyType(String propertyName) throws BeansException { } // Check to see if there is a custom editor, // which might give an indication on the desired target type. - Class editorType = guessPropertyTypeFromEditors(propertyName); + Class editorType = guessPropertyTypeFromEditors(propertyName); if (editorType != null) { return editorType; } @@ -559,7 +559,7 @@ private BeanWrapperImpl getNestedBeanWrapper(String nestedProperty) { propertyValue = setDefaultValue(tokens); } else { - throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + canonicalName); + throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + canonicalName); } } @@ -701,7 +701,8 @@ public Object getPropertyValue(String propertyName) throws BeansException { return nestedBw.getPropertyValue(tokens); } - private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException { + @SuppressWarnings("rawtypes") + private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException { String propertyName = tokens.canonicalName; String actualName = tokens.actualName; PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName); @@ -723,7 +724,7 @@ public Object run() { readMethod.setAccessible(true); } } - + Object value; if (System.getSecurityManager() != null) { try { @@ -738,10 +739,10 @@ public Object run() throws Exception { } } else { - value = readMethod.invoke(object, (Object[]) null); + value = readMethod.invoke(object, (Object[]) null); } - - if (tokens.keys != null) { + + if (tokens.keys != null) { if (value == null) { if (this.autoGrowNestedPaths) { value = setDefaultValue(tokens.actualName); @@ -749,9 +750,9 @@ public Object run() throws Exception { else { throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + propertyName, "Cannot access indexed value of property referenced in indexed " + - "property path '" + propertyName + "': returned null"); + "property path '" + propertyName + "': returned null"); } - } + } String indexedPropertyName = tokens.actualName; // apply indexes and map keys for (int i = 0; i < tokens.keys.length; i++) { @@ -759,7 +760,7 @@ public Object run() throws Exception { if (value == null) { throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + propertyName, "Cannot access indexed value of property referenced in indexed " + - "property path '" + propertyName + "': returned null"); + "property path '" + propertyName + "': returned null"); } else if (value.getClass().isArray()) { int index = Integer.parseInt(key); @@ -767,9 +768,9 @@ else if (value.getClass().isArray()) { value = Array.get(value, index); } else if (value instanceof List) { - int index = Integer.parseInt(key); + int index = Integer.parseInt(key); List list = (List) value; - growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1); + growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1); value = list.get(index); } else if (value instanceof Set) { @@ -804,7 +805,7 @@ else if (value instanceof Map) { "Property referenced in indexed property path '" + propertyName + "' is neither an array nor a List nor a Set nor a Map; returned value was [" + value + "]"); } - indexedPropertyName += PROPERTY_KEY_PREFIX + key + PROPERTY_KEY_SUFFIX; + indexedPropertyName += PROPERTY_KEY_PREFIX + key + PROPERTY_KEY_SUFFIX; } } return value; @@ -852,7 +853,7 @@ private Object growArrayIfNecessary(Object array, int index, String name) { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private void growCollectionIfNecessary( Collection collection, int index, String name, PropertyDescriptor pd, int nestingLevel) { @@ -861,7 +862,7 @@ private void growCollectionIfNecessary( } int size = collection.size(); if (index >= size && index < this.autoGrowCollectionLimit) { - Class elementType = GenericCollectionTypeResolver.getCollectionReturnType(pd.getReadMethod(), nestingLevel); + Class elementType = GenericCollectionTypeResolver.getCollectionReturnType(pd.getReadMethod(), nestingLevel); if (elementType != null) { for (int i = collection.size(); i < index + 1; i++) { collection.add(newValue(elementType, name)); @@ -908,7 +909,7 @@ public void setPropertyValue(PropertyValue pv) throws BeansException { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private void setPropertyValue(PropertyTokenHolder tokens, PropertyValue pv) throws BeansException { String propertyName = tokens.canonicalName; String actualName = tokens.actualName; @@ -965,7 +966,7 @@ private void setPropertyValue(PropertyTokenHolder tokens, PropertyValue pv) thro } else if (propValue instanceof List) { PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName); - Class requiredType = GenericCollectionTypeResolver.getCollectionReturnType( + Class requiredType = GenericCollectionTypeResolver.getCollectionReturnType( pd.getReadMethod(), tokens.keys.length); List list = (List) propValue; int index = Integer.parseInt(key); @@ -1002,9 +1003,9 @@ else if (propValue instanceof List) { } else if (propValue instanceof Map) { PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName); - Class mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType( + Class mapKeyType = GenericCollectionTypeResolver.getMapKeyReturnType( pd.getReadMethod(), tokens.keys.length); - Class mapValueType = GenericCollectionTypeResolver.getMapValueReturnType( + Class mapValueType = GenericCollectionTypeResolver.getMapValueReturnType( pd.getReadMethod(), tokens.keys.length); Map map = (Map) propValue; // IMPORTANT: Do not pass full property name in here - property editors diff --git a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java index 2e9dde90b883..3d250925da25 100644 --- a/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java +++ b/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java @@ -76,7 +76,7 @@ public class CachedIntrospectionResults { * Needs to be a WeakHashMap with WeakReferences as values to allow * for proper garbage collection in case of multiple class loaders. */ - static final Map classCache = new WeakHashMap(); + static final Map, Object> classCache = Collections.synchronizedMap(new WeakHashMap, Object>()); /** @@ -111,8 +111,8 @@ public static void clearClassLoader(ClassLoader classLoader) { return; } synchronized (classCache) { - for (Iterator it = classCache.keySet().iterator(); it.hasNext();) { - Class beanClass = it.next(); + for (Iterator> it = classCache.keySet().iterator(); it.hasNext();) { + Class beanClass = it.next(); if (isUnderneathClassLoader(beanClass.getClassLoader(), classLoader)) { it.remove(); } @@ -136,15 +136,16 @@ public static void clearClassLoader(ClassLoader classLoader) { * @return the corresponding CachedIntrospectionResults * @throws BeansException in case of introspection failure */ - static CachedIntrospectionResults forClass(Class beanClass) throws BeansException { + static CachedIntrospectionResults forClass(Class beanClass) throws BeansException { CachedIntrospectionResults results; Object value; synchronized (classCache) { value = classCache.get(beanClass); } if (value instanceof Reference) { - Reference ref = (Reference) value; - results = (CachedIntrospectionResults) ref.get(); + @SuppressWarnings("unchecked") + Reference ref = (Reference) value; + results = ref.get(); } else { results = (CachedIntrospectionResults) value; @@ -228,7 +229,7 @@ private static boolean isUnderneathClassLoader(ClassLoader candidate, ClassLoade * @param beanClass the bean class to analyze * @throws BeansException in case of introspection failure */ - private CachedIntrospectionResults(Class beanClass) throws BeansException { + private CachedIntrospectionResults(Class beanClass, boolean cacheFullMetadata) throws BeansException { try { if (logger.isTraceEnabled()) { logger.trace("Getting BeanInfo for class [" + beanClass.getName() + "]"); @@ -251,7 +252,7 @@ private CachedIntrospectionResults(Class beanClass) throws BeansException { // garbage collection on class loader shutdown - we cache it here anyway, // in a GC-friendly manner. In contrast to CachedIntrospectionResults, // Introspector does not use WeakReferences as values of its WeakHashMap! - Class classToFlush = beanClass; + Class classToFlush = beanClass; do { Introspector.flushFromCaches(classToFlush); classToFlush = classToFlush.getSuperclass(); @@ -289,7 +290,7 @@ BeanInfo getBeanInfo() { return this.beanInfo; } - Class getBeanClass() { + Class getBeanClass() { return this.beanInfo.getBeanDescriptor().getBeanClass(); } @@ -317,7 +318,7 @@ PropertyDescriptor[] getPropertyDescriptors() { return pds; } - private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class beanClass, PropertyDescriptor pd) { + private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class beanClass, PropertyDescriptor pd) { try { return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(), pd.getWriteMethod(), pd.getPropertyEditorClass()); diff --git a/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java b/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java index afd6a0fc0948..dcb29c8fa371 100644 --- a/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java +++ b/spring-beans/src/main/java/org/springframework/beans/ConversionNotSupportedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public class ConversionNotSupportedException extends TypeMismatchException { * @param requiredType the required target type (or null if not known) * @param cause the root cause (may be null) */ - public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) { + public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) { super(propertyChangeEvent, requiredType, cause); } @@ -43,7 +43,7 @@ public ConversionNotSupportedException(PropertyChangeEvent propertyChangeEvent, * @param requiredType the required target type (or null if not known) * @param cause the root cause (may be null) */ - public ConversionNotSupportedException(Object value, Class requiredType, Throwable cause) { + public ConversionNotSupportedException(Object value, Class requiredType, Throwable cause) { super(value, requiredType, cause); } diff --git a/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java b/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java index a2d5ee7af3f9..9cfd3c041004 100644 --- a/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java +++ b/spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,23 +40,23 @@ */ class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor { - private final Class beanClass; + private final Class beanClass; private final Method readMethod; private final Method writeMethod; - private final Class propertyEditorClass; + private final Class propertyEditorClass; private volatile Set ambiguousWriteMethods; - private Class propertyType; + private Class propertyType; private MethodParameter writeMethodParameter; - public GenericTypeAwarePropertyDescriptor(Class beanClass, String propertyName, - Method readMethod, Method writeMethod, Class propertyEditorClass) + public GenericTypeAwarePropertyDescriptor(Class beanClass, String propertyName, + Method readMethod, Method writeMethod, Class propertyEditorClass) throws IntrospectionException { super(propertyName, null, null); @@ -95,7 +95,7 @@ public GenericTypeAwarePropertyDescriptor(Class beanClass, String propertyName, public Class getBeanClass() { return this.beanClass; } - + @Override public Method getReadMethod() { return this.readMethod; @@ -118,12 +118,12 @@ public Method getWriteMethodForActualAccess() { } @Override - public Class getPropertyEditorClass() { + public Class getPropertyEditorClass() { return this.propertyEditorClass; } @Override - public synchronized Class getPropertyType() { + public synchronized Class getPropertyType() { if (this.propertyType == null) { if (this.readMethod != null) { this.propertyType = GenericTypeResolver.resolveReturnType(this.readMethod, this.beanClass); diff --git a/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java b/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java index d1c976a5a20b..44c22a06d386 100644 --- a/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java +++ b/spring-beans/src/main/java/org/springframework/beans/InvalidPropertyException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ */ public class InvalidPropertyException extends FatalBeanException { - private Class beanClass; + private Class beanClass; private String propertyName; @@ -36,7 +36,7 @@ public class InvalidPropertyException extends FatalBeanException { * @param propertyName the offending property * @param msg the detail message */ - public InvalidPropertyException(Class beanClass, String propertyName, String msg) { + public InvalidPropertyException(Class beanClass, String propertyName, String msg) { this(beanClass, propertyName, msg, null); } @@ -47,7 +47,7 @@ public InvalidPropertyException(Class beanClass, String propertyName, String msg * @param msg the detail message * @param cause the root cause */ - public InvalidPropertyException(Class beanClass, String propertyName, String msg, Throwable cause) { + public InvalidPropertyException(Class beanClass, String propertyName, String msg, Throwable cause) { super("Invalid property '" + propertyName + "' of bean class [" + beanClass.getName() + "]: " + msg, cause); this.beanClass = beanClass; this.propertyName = propertyName; @@ -56,7 +56,7 @@ public InvalidPropertyException(Class beanClass, String propertyName, String msg /** * Return the offending bean class. */ - public Class getBeanClass() { + public Class getBeanClass() { return beanClass; } diff --git a/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java b/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java index 6a9c0eac84a4..49d1398d7bcf 100644 --- a/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java +++ b/spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java @@ -30,7 +30,7 @@ public class MethodInvocationException extends PropertyAccessException { * Error code that a method invocation error will be registered with. */ public static final String ERROR_CODE = "methodInvocation"; - + /** * Create a new MethodInvocationException. diff --git a/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java b/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java index 470a705dd595..3d9f2236ebbd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java +++ b/spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public MutablePropertyValues(Map original) { // There is no replacement of existing property values. if (original != null) { this.propertyValueList = new ArrayList(original.size()); - for (Map.Entry entry : original.entrySet()) { + for (Map.Entry entry : original.entrySet()) { this.propertyValueList.add(new PropertyValue(entry.getKey().toString(), entry.getValue())); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java b/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java index 49ba7d795a33..acfe61d0e531 100644 --- a/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java +++ b/spring-beans/src/main/java/org/springframework/beans/NotReadablePropertyException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ public class NotReadablePropertyException extends InvalidPropertyException { * @param beanClass the offending bean class * @param propertyName the offending property */ - public NotReadablePropertyException(Class beanClass, String propertyName) { + public NotReadablePropertyException(Class beanClass, String propertyName) { super(beanClass, propertyName, "Bean property '" + propertyName + "' is not readable or has an invalid getter method: " + "Does the return type of the getter match the parameter type of the setter?"); @@ -42,7 +42,7 @@ public NotReadablePropertyException(Class beanClass, String propertyName) { * @param propertyName the offending property * @param msg the detail message */ - public NotReadablePropertyException(Class beanClass, String propertyName, String msg) { + public NotReadablePropertyException(Class beanClass, String propertyName, String msg) { super(beanClass, propertyName, msg); } diff --git a/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java b/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java index 73b607edb116..4d854ef8d5d5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java +++ b/spring-beans/src/main/java/org/springframework/beans/NotWritablePropertyException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public class NotWritablePropertyException extends InvalidPropertyException { * @param beanClass the offending bean class * @param propertyName the offending property name */ - public NotWritablePropertyException(Class beanClass, String propertyName) { + public NotWritablePropertyException(Class beanClass, String propertyName) { super(beanClass, propertyName, "Bean property '" + propertyName + "' is not writable or has an invalid setter method: " + "Does the return type of the getter match the parameter type of the setter?"); @@ -46,7 +46,7 @@ public NotWritablePropertyException(Class beanClass, String propertyName) { * @param propertyName the offending property name * @param msg the detail message */ - public NotWritablePropertyException(Class beanClass, String propertyName, String msg) { + public NotWritablePropertyException(Class beanClass, String propertyName, String msg) { super(beanClass, propertyName, msg); } @@ -57,7 +57,7 @@ public NotWritablePropertyException(Class beanClass, String propertyName, String * @param msg the detail message * @param cause the root cause */ - public NotWritablePropertyException(Class beanClass, String propertyName, String msg, Throwable cause) { + public NotWritablePropertyException(Class beanClass, String propertyName, String msg, Throwable cause) { super(beanClass, propertyName, msg, cause); } @@ -69,7 +69,7 @@ public NotWritablePropertyException(Class beanClass, String propertyName, String * @param possibleMatches suggestions for actual bean property names * that closely match the invalid property name */ - public NotWritablePropertyException(Class beanClass, String propertyName, String msg, String[] possibleMatches) { + public NotWritablePropertyException(Class beanClass, String propertyName, String msg, String[] possibleMatches) { super(beanClass, propertyName, msg); this.possibleMatches = possibleMatches; } diff --git a/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java b/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java index 40c593c4440a..6f8003f274df 100644 --- a/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java +++ b/spring-beans/src/main/java/org/springframework/beans/NullValueInNestedPathException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class NullValueInNestedPathException extends InvalidPropertyException { * @param beanClass the offending bean class * @param propertyName the offending property */ - public NullValueInNestedPathException(Class beanClass, String propertyName) { + public NullValueInNestedPathException(Class beanClass, String propertyName) { super(beanClass, propertyName, "Value of nested property '" + propertyName + "' is null"); } @@ -42,7 +42,7 @@ public NullValueInNestedPathException(Class beanClass, String propertyName) { * @param propertyName the offending property * @param msg the detail message */ - public NullValueInNestedPathException(Class beanClass, String propertyName, String msg) { + public NullValueInNestedPathException(Class beanClass, String propertyName, String msg) { super(beanClass, propertyName, msg); } diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java index 830ea5f40d06..cb17396c8c8f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessException.java @@ -30,7 +30,7 @@ public abstract class PropertyAccessException extends BeansException implements ErrorCoded { private transient PropertyChangeEvent propertyChangeEvent; - + /** * Create a new PropertyAccessException. diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java index c8b8edb63f75..06b54dfc0417 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ public interface PropertyAccessor { * @throws PropertyAccessException if the property was valid but the * accessor method failed */ - Class getPropertyType(String propertyName) throws BeansException; + Class getPropertyType(String propertyName) throws BeansException; /** * Return a type descriptor for the specified property: @@ -190,8 +190,7 @@ public interface PropertyAccessor { * successfully updated. * @see #setPropertyValues(PropertyValues, boolean, boolean) */ - void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) - throws BeansException; + void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException; /** * Perform a batch update with full control over behavior. @@ -213,6 +212,6 @@ void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) * successfully updated. */ void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) - throws BeansException; + throws BeansException; } diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java b/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java index d7a574cc433a..ad2b986f69ea 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyBatchUpdateException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,7 @@ public void printStackTrace(PrintWriter pw) { } @Override - public boolean contains(Class exType) { + public boolean contains(Class exType) { if (exType == null) { return false; } diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java index 9e141fde3a9f..56dddc4de56c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrar.java @@ -31,7 +31,7 @@ * @see java.beans.PropertyEditor */ public interface PropertyEditorRegistrar { - + /** * Register custom {@link java.beans.PropertyEditor PropertyEditors} with * the given PropertyEditorRegistry. diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java index 2b547c0edf6e..e92eeac34171 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyEditorRegistrySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java b/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java index 0c6829065090..0b72a72df846 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyMatches.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ final class PropertyMatches { * @param propertyName the name of the property to find possible matches for * @param beanClass the bean class to search for matches */ - public static PropertyMatches forProperty(String propertyName, Class beanClass) { + public static PropertyMatches forProperty(String propertyName, Class beanClass) { return forProperty(propertyName, beanClass, DEFAULT_MAX_DISTANCE); } @@ -59,7 +59,7 @@ public static PropertyMatches forProperty(String propertyName, Class beanClass) * @param beanClass the bean class to search for matches * @param maxDistance the maximum property distance allowed for matches */ - public static PropertyMatches forProperty(String propertyName, Class beanClass, int maxDistance) { + public static PropertyMatches forProperty(String propertyName, Class beanClass, int maxDistance) { return new PropertyMatches(propertyName, beanClass, maxDistance); } @@ -76,7 +76,7 @@ public static PropertyMatches forProperty(String propertyName, Class beanClass, /** * Create a new PropertyMatches instance for the given property. */ - private PropertyMatches(String propertyName, Class beanClass, int maxDistance) { + private PropertyMatches(String propertyName, Class beanClass, int maxDistance) { this.propertyName = propertyName; this.possibleMatches = calculateMatches(BeanUtils.getPropertyDescriptors(beanClass), maxDistance); } diff --git a/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java b/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java index e2180a077e79..008d630ffcaf 100644 --- a/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java +++ b/spring-beans/src/main/java/org/springframework/beans/PropertyValues.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,12 +26,12 @@ * @see PropertyValue */ public interface PropertyValues { - - /** + + /** * Return an array of the PropertyValue objects held in this object. */ - PropertyValue[] getPropertyValues(); - + PropertyValue[] getPropertyValues(); + /** * Return the property value with the given name, if any. * @param propertyName the name to search for diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java index 9b47e794439c..6d3d0db5baf3 100644 --- a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java +++ b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java @@ -140,7 +140,7 @@ public T convertIfNecessary( * @return the new value, possibly the result of type conversion * @throws IllegalArgumentException if type conversion failed */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public T convertIfNecessary(String propertyName, Object oldValue, Object newValue, Class requiredType, TypeDescriptor typeDescriptor) throws IllegalArgumentException { @@ -237,6 +237,7 @@ else if (convertedValue instanceof String && !requiredType.isInstance(convertedV // It's an empty enum identifier: reset the enum value to null. return null; } + convertedValue = attemptToConvertStringToEnum(requiredType, trimmedValue, convertedValue); standardConversion = true; } @@ -328,9 +329,9 @@ private Object attemptToConvertStringToEnum(Class requiredType, String trimme * @param requiredType the type to find an editor for * @return the corresponding editor, or null if none */ - private PropertyEditor findDefaultEditor(Class requiredType) { + protected PropertyEditor findDefaultEditor(Class requiredType, TypeDescriptor typeDescriptor) { PropertyEditor editor = null; - if (requiredType != null) { + if (editor == null && requiredType != null) { // No custom editor -> check BeanWrapperImpl's default editors. editor = this.propertyEditorRegistry.getDefaultEditor(requiredType); if (editor == null && !String.class.equals(requiredType)) { @@ -453,7 +454,8 @@ private Object doConvertTextValue(Object oldValue, String newTextValue, Property return editor.getValue(); } - private Object convertToTypedArray(Object input, String propertyName, Class componentType) { + @SuppressWarnings("rawtypes") + protected Object convertToTypedArray(Object input, String propertyName, Class componentType) { if (input instanceof Collection) { // Convert Collection elements to array elements. Collection coll = (Collection) input; @@ -491,8 +493,8 @@ else if (input.getClass().isArray()) { } } - @SuppressWarnings("unchecked") - private Collection convertToTypedCollection( + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected Collection convertToTypedCollection( Collection original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) { if (!Collection.class.isAssignableFrom(requiredType)) { @@ -573,8 +575,8 @@ private Collection convertToTypedCollection( return (originalAllowed ? original : convertedCopy); } - @SuppressWarnings("unchecked") - private Map convertToTypedMap( + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected Map convertToTypedMap( Map original, String propertyName, Class requiredType, TypeDescriptor typeDescriptor) { if (!Map.class.isAssignableFrom(requiredType)) { @@ -671,7 +673,7 @@ private String buildKeyedPropertyName(String propertyName, Object key) { null); } - private boolean canCreateCopy(Class requiredType) { + private boolean canCreateCopy(Class requiredType) { return (!requiredType.isInterface() && !Modifier.isAbstract(requiredType.getModifiers()) && Modifier.isPublic(requiredType.getModifiers()) && ClassUtils.hasConstructor(requiredType)); } diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java b/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java index f2d05a31f0fe..cc5d9cbcfd18 100644 --- a/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java +++ b/spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public class TypeMismatchException extends PropertyAccessException { private transient Object value; - private Class requiredType; + private Class requiredType; /** @@ -44,7 +44,7 @@ public class TypeMismatchException extends PropertyAccessException { * @param propertyChangeEvent the PropertyChangeEvent that resulted in the problem * @param requiredType the required target type */ - public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requiredType) { + public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requiredType) { this(propertyChangeEvent, requiredType, null); } @@ -54,7 +54,7 @@ public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requ * @param requiredType the required target type (or null if not known) * @param cause the root cause (may be null) */ - public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) { + public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requiredType, Throwable cause) { super(propertyChangeEvent, "Failed to convert property value of type '" + ClassUtils.getDescriptiveType(propertyChangeEvent.getNewValue()) + "'" + @@ -72,7 +72,7 @@ public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class requ * @param value the offending value that couldn't be converted (may be null) * @param requiredType the required target type (or null if not known) */ - public TypeMismatchException(Object value, Class requiredType) { + public TypeMismatchException(Object value, Class requiredType) { this(value, requiredType, null); } @@ -82,7 +82,7 @@ public TypeMismatchException(Object value, Class requiredType) { * @param requiredType the required target type (or null if not known) * @param cause the root cause (may be null) */ - public TypeMismatchException(Object value, Class requiredType, Throwable cause) { + public TypeMismatchException(Object value, Class requiredType, Throwable cause) { super("Failed to convert value of type '" + ClassUtils.getDescriptiveType(value) + "'" + (requiredType != null ? " to required type '" + ClassUtils.getQualifiedName(requiredType) + "'" : ""), cause); @@ -102,7 +102,7 @@ public Object getValue() { /** * Return the required target type, if any. */ - public Class getRequiredType() { + public Class getRequiredType() { return this.requiredType; } diff --git a/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java b/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java index db3c74965bd0..b73166ca2350 100644 --- a/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java @@ -45,21 +45,7 @@ public abstract class AnnotationBeanUtils { * @see org.springframework.beans.BeanWrapper */ public static void copyPropertiesToBean(Annotation ann, Object bean, String... excludedProperties) { - copyPropertiesToBean(ann, bean, null, excludedProperties); - } - - /** - * Copy the properties of the supplied {@link Annotation} to the supplied target bean. - * Any properties defined in excludedProperties will not be copied. - *

    A specified value resolver may resolve placeholders in property values, for example. - * @param ann the annotation to copy from - * @param bean the bean instance to copy to - * @param valueResolver a resolve to post-process String property values (may be null) - * @param excludedProperties the names of excluded properties, if any - * @see org.springframework.beans.BeanWrapper - */ - public static void copyPropertiesToBean(Annotation ann, Object bean, StringValueResolver valueResolver, String... excludedProperties) { - Set excluded = new HashSet(Arrays.asList(excludedProperties)); + Set excluded = new HashSet(Arrays.asList(excludedProperties)); Method[] annotationProperties = ann.annotationType().getDeclaredMethods(); BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(bean); for (Method annotationProperty : annotationProperties) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java b/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java index fb107425c36f..1b3f306b0c3e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/Aware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ /** * Marker superinterface indicating that a bean is eligible to be * notified by the Spring container of a particular framework object - * through a callback-style method. Actual method signature is + * through a callback-style method. Actual method signature is * determined by individual subinterfaces, but should typically * consist of just one void-returning method that accepts a single * argument. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java index 486f9248e7dd..17e539805587 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -184,7 +184,7 @@ public void printStackTrace(PrintWriter pw) { } @Override - public boolean contains(Class exClass) { + public boolean contains(Class exClass) { if (super.contains(exClass)) { return true; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java index ab2f2531b0df..1aff05da8a04 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanExpressionException.java @@ -44,4 +44,4 @@ public BeanExpressionException(String msg, Throwable cause) { super(msg, cause); } -} \ No newline at end of file +} diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java index 0e58200ad960..025185567121 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java @@ -115,7 +115,7 @@ public static String originalBeanName(String name) { public static int countBeansIncludingAncestors(ListableBeanFactory lbf) { return beanNamesIncludingAncestors(lbf).length; } - + /** * Return all bean names in the factory, including ancestor factories. * @param lbf the bean factory @@ -139,7 +139,7 @@ public static String[] beanNamesIncludingAncestors(ListableBeanFactory lbf) { * @param type the type that beans must match * @return the array of matching bean names, or an empty array if none */ - public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type) { + public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type) { Assert.notNull(lbf, "ListableBeanFactory must not be null"); String[] result = lbf.getBeanNamesForType(type); if (lbf instanceof HierarchicalBeanFactory) { @@ -181,7 +181,7 @@ public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lb * @return the array of matching bean names, or an empty array if none */ public static String[] beanNamesForTypeIncludingAncestors( - ListableBeanFactory lbf, Class type, boolean includeNonSingletons, boolean allowEagerInit) { + ListableBeanFactory lbf, Class type, boolean includeNonSingletons, boolean allowEagerInit) { Assert.notNull(lbf, "ListableBeanFactory must not be null"); String[] result = lbf.getBeanNamesForType(type, includeNonSingletons, allowEagerInit); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java index 7146ec7806ba..dfc8161010e0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanIsNotAFactoryException.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class BeanIsNotAFactoryException extends BeanNotOfRequiredTypeException { * @param actualType the actual type returned, which did not match * the expected type */ - public BeanIsNotAFactoryException(String name, Class actualType) { + public BeanIsNotAFactoryException(String name, Class actualType) { super(name, FactoryBean.class, actualType); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java b/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java index efdea3ab3d0b..3aac1008a4e5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/BeanNotOfRequiredTypeException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ public class BeanNotOfRequiredTypeException extends BeansException { private String beanName; /** The required type */ - private Class requiredType; + private Class requiredType; /** The offending type */ - private Class actualType; + private Class actualType; /** @@ -43,7 +43,7 @@ public class BeanNotOfRequiredTypeException extends BeansException { * @param actualType the actual type returned, which did not match * the expected type */ - public BeanNotOfRequiredTypeException(String beanName, Class requiredType, Class actualType) { + public BeanNotOfRequiredTypeException(String beanName, Class requiredType, Class actualType) { super("Bean named '" + beanName + "' must be of type [" + requiredType.getName() + "], but was actually of type [" + actualType.getName() + "]"); this.beanName = beanName; @@ -62,14 +62,14 @@ public String getBeanName() { /** * Return the expected type for the bean. */ - public Class getRequiredType() { + public Class getRequiredType() { return this.requiredType; } /** * Return the actual type of the instance found. */ - public Class getActualType() { + public Class getActualType() { return this.actualType; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java index 12fdeb853bc4..536c2e695c8a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/DisposableBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java index 20eb7845b3dc..f471915b0a55 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/HierarchicalBeanFactory.java @@ -30,7 +30,7 @@ * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory */ public interface HierarchicalBeanFactory extends BeanFactory { - + /** * Return the parent bean factory, or null if there is none. */ diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java index a21912d31ca3..420aefb2c0bd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/InitializingBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ * Interface to be implemented by beans that need to react once all their * properties have been set by a BeanFactory: for example, to perform custom * initialization, or merely to check that all mandatory properties have been set. - * + * *

    An alternative to implementing InitializingBean is specifying a custom * init-method, for example in an XML bean definition. * For a list of all bean lifecycle methods, see the BeanFactory javadocs. @@ -33,7 +33,7 @@ * @see org.springframework.context.ApplicationContextAware */ public interface InitializingBean { - + /** * Invoked by a BeanFactory after it has set all bean properties supplied * (and satisfied BeanFactoryAware and ApplicationContextAware). diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java index e7c08c2dc550..64e86dc2c4bf 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java @@ -84,7 +84,7 @@ public interface ListableBeanFactory extends BeanFactory { * or an empty array if none defined */ String[] getBeanDefinitionNames(); - + /** * Return the names of beans matching the given type (including subclasses), * judging from either bean definitions or the value of getObjectType diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java b/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java index 746208955669..0abda22dc47f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/NoSuchBeanDefinitionException.java @@ -32,7 +32,7 @@ public class NoSuchBeanDefinitionException extends BeansException { /** Name of the missing bean. */ private String beanName; - /** Required type of the missing bean. */ + /** Required bean type */ private Class beanType; @@ -73,7 +73,7 @@ public NoSuchBeanDefinitionException(Class type, String message) { super("No unique bean of type [" + type.getName() + "] is defined: " + message); this.beanType = type; } - + /** * Create a new {@code NoSuchBeanDefinitionException}. * @param type required type of the missing bean diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java b/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java index ae2cc0de0ae2..0cc75c8a8741 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ public UnsatisfiedDependencyException( * @param msg the detail message */ public UnsatisfiedDependencyException( - String resourceDescription, String beanName, int ctorArgIndex, Class ctorArgType, String msg) { + String resourceDescription, String beanName, int ctorArgIndex, Class ctorArgType, String msg) { super(resourceDescription, beanName, "Unsatisfied dependency expressed through constructor argument with index " + @@ -85,7 +85,7 @@ public UnsatisfiedDependencyException( * @param ex the bean creation exception that indicated the unsatisfied dependency */ public UnsatisfiedDependencyException( - String resourceDescription, String beanName, int ctorArgIndex, Class ctorArgType, BeansException ex) { + String resourceDescription, String beanName, int ctorArgIndex, Class ctorArgType, BeansException ex) { this(resourceDescription, beanName, ctorArgIndex, ctorArgType, (ex != null ? ": " + ex.getMessage() : "")); initCause(ex); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java index b502384d7039..9a607de3efd6 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/BootstrapException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java index 8425921237e6..61eea7a094a6 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.java @@ -40,7 +40,7 @@ * which accesses shared Spring {@link BeanFactory} instances.

    * *

    Please see the warning in BeanFactoryLocator's javadoc about appropriate usage - * of singleton style BeanFactoryLocator implementations. It is the opinion of the + * of singleton style BeanFactoryLocator implementations. It is the opinion of the * Spring team that the use of this class and similar classes is unnecessary except * (sometimes) for a small amount of glue code. Excessive usage will lead to code * that is more tightly coupled, and harder to modify or test.

    @@ -50,11 +50,11 @@ * searched for is 'classpath*:beanRefFactory.xml', with the Spring-standard * 'classpath*:' prefix ensuring that if the classpath contains multiple copies * of this file (perhaps one in each component jar) they will be combined. To - * override the default resource name, instead of using the no-arg + * override the default resource name, instead of using the no-arg * {@link #getInstance()} method, use the {@link #getInstance(String selector)} * variant, which will treat the 'selector' argument as the resource name to * search for.

    - * + * *

    The purpose of this 'outer' BeanFactory is to create and hold a copy of one * or more 'inner' BeanFactory or ApplicationContext instances, and allow those * to be obtained either directly or via an alias. As such, this class provides @@ -80,10 +80,10 @@ * or created as three hierarchical ApplicationContexts, by one piece of code * somewhere at application startup (perhaps a Servlet filter), from which all other * code in the application would flow, obtained as beans from the context(s). However - * when third party code enters into the picture, things can get problematic. If the + * when third party code enters into the picture, things can get problematic. If the * third party code needs to create user classes, which should normally be obtained * from a Spring BeanFactory/ApplicationContext, but can handle only newInstance() - * style object creation, then some extra work is required to actually access and + * style object creation, then some extra work is required to actually access and * use object from a BeanFactory/ApplicationContext. One solutions is to make the * class created by the third party code be just a stub or proxy, which gets the * real object from a BeanFactory/ApplicationContext, and delegates to it. However, @@ -101,7 +101,7 @@ * *

    Another use of SingletonBeanFactoryLocator, is to demand-load/use one or more * BeanFactories/ApplicationContexts. Because the definition can contain one of more - * BeanFactories/ApplicationContexts, which can be independent or in a hierarchy, if + * BeanFactories/ApplicationContexts, which can be independent or in a hierarchy, if * they are set to lazy-initialize, they will only be created when actually requested * for use. * @@ -111,9 +111,9 @@ * *

    <?xml version="1.0" encoding="UTF-8"?>
      * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    - * 
    + *
      * <beans>
    - * 
    + *
      *   <bean id="com.mycompany.myapp"
      *         class="org.springframework.context.support.ClassPathXmlApplicationContext">
      *     <constructor-arg>
    @@ -124,7 +124,7 @@
      *       </list>
      *     </constructor-arg>
      *   </bean>
    - * 
    + *
      * </beans>
      * 
    * @@ -133,7 +133,7 @@ *
      * BeanFactoryLocator bfl = SingletonBeanFactoryLocator.getInstance();
      * BeanFactoryReference bf = bfl.useBeanFactory("com.mycompany.myapp");
    - * // now use some bean from factory 
    + * // now use some bean from factory
      * MyClass zed = bf.getFactory().getBean("mybean");
      * 
    * @@ -141,16 +141,16 @@ * *
    <?xml version="1.0" encoding="UTF-8"?>
      * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    - * 
    + *
      * <beans>
    - * 
    + *
      *   <bean id="com.mycompany.myapp.util" lazy-init="true"
      *         class="org.springframework.context.support.ClassPathXmlApplicationContext">
      *     <constructor-arg>
      *       <value>com/mycompany/myapp/util/applicationContext.xml</value>
      *     </constructor-arg>
      *   </bean>
    - * 
    + *
      *   <!-- child of above -->
      *   <bean id="com.mycompany.myapp.dataaccess" lazy-init="true"
      *         class="org.springframework.context.support.ClassPathXmlApplicationContext">
    @@ -161,7 +161,7 @@
      *       <ref bean="com.mycompany.myapp.util"/>
      *     </constructor-arg>
      *   </bean>
    - * 
    + *
      *   <!-- child of above -->
      *   <bean id="com.mycompany.myapp.services" lazy-init="true"
      *         class="org.springframework.context.support.ClassPathXmlApplicationContext">
    @@ -172,7 +172,7 @@
      *       <ref bean="com.mycompany.myapp.dataaccess"/>
      *     </constructor-arg>
      *   </bean>
    - * 
    + *
      *   <!-- define an alias -->
      *   <bean id="com.mycompany.myapp.mypackage"
      *         class="java.lang.String">
    @@ -180,7 +180,7 @@
      *       <value>com.mycompany.myapp.services</value>
      *     </constructor-arg>
      *   </bean>
    - * 
    + *
      * </beans>
      * 
    * @@ -200,7 +200,7 @@ * *
    <?xml version="1.0" encoding="UTF-8"?>
      * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    - * 
    + *
      * <beans>
      *   <bean id="com.mycompany.myapp.util" lazy-init="true"
      *        class="org.springframework.context.support.ClassPathXmlApplicationContext">
    @@ -210,12 +210,12 @@
      *   </bean>
      * </beans>
      * 
    - * + * * beanRefFactory.xml file inside jar for data-access module:
    * *
    <?xml version="1.0" encoding="UTF-8"?>
      * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    - * 
    + *
      * <beans>
      *   <!-- child of util -->
      *   <bean id="com.mycompany.myapp.dataaccess" lazy-init="true"
    @@ -229,12 +229,12 @@
      *   </bean>
      * </beans>
      * 
    - * + * * beanRefFactory.xml file inside jar for services module: * *
    <?xml version="1.0" encoding="UTF-8"?>
      * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    - * 
    + *
      * <beans>
      *   <!-- child of data-access -->
      *   <bean id="com.mycompany.myapp.services" lazy-init="true"
    @@ -248,20 +248,20 @@
      *   </bean>
      * </beans>
      * 
    - * + * * beanRefFactory.xml file inside jar for mypackage module. This doesn't * create any of its own contexts, but allows the other ones to be referred to be * a name known to this module: * *
    <?xml version="1.0" encoding="UTF-8"?>
      * <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    - * 
    + *
      * <beans>
      *   <!-- define an alias for "com.mycompany.myapp.services" -->
      *   <alias name="com.mycompany.myapp.services" alias="com.mycompany.myapp.mypackage"/>
      * </beans>
      * 
    - * + * * @author Colin Sampaleanu * @author Juergen Hoeller * @see org.springframework.context.access.ContextSingletonBeanFactoryLocator @@ -362,7 +362,7 @@ public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansExcept logger.trace("Factory group with resource name [" + this.resourceLocation + "] requested. Creating new instance."); } - + // Create the BeanFactory but don't initialize it. BeanFactory groupContext = createDefinition(this.resourceLocation, factoryKey); @@ -446,7 +446,7 @@ protected BeanFactory createDefinition(String resourceLocation, String factoryKe return factory; } - + /** * Instantiate singletons and do any other normal initialization of the factory. * Subclasses that override {@link #createDefinition createDefinition()} should diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java index 73a86c078ceb..519888bf2abe 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/el/SpringBeanELResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java b/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java index 85e6b11a021e..7c4a159d5fa9 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/access/package-info.java @@ -2,7 +2,7 @@ /** * * Helper infrastructure to locate and access bean factories. - * + * *

    Note: This package is only relevant for special sharing of bean * factories, for example behind EJB facades. It is not used in a * typical web application or standalone application. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java index 4d0b8b5bbfbd..337a05b2b6a1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java @@ -70,10 +70,10 @@ * if available, as a direct alternative to Spring's own @Autowired. * *

    Only one constructor (at max) of any given bean class may carry this - * annotation with the 'required' parameter set to true, - * indicating the constructor to autowire when used as a Spring bean. - * If multiple non-required constructors carry the annotation, they - * will be considered as candidates for autowiring. The constructor with + * annotation with the 'required' parameter set to true, + * indicating the constructor to autowire when used as a Spring bean. + * If multiple non-required constructors carry the annotation, they + * will be considered as candidates for autowiring. The constructor with * the greatest number of dependencies that can be satisfied by matching * beans in the Spring container will be chosen. If none of the candidates * can be satisfied, then a default constructor (if present) will be used. @@ -109,9 +109,9 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean private final Set> autowiredAnnotationTypes = new LinkedHashSet>(); - + private String requiredParameterName = "required"; - + private boolean requiredParameterValue = true; private int order = Ordered.LOWEST_PRECEDENCE - 2; @@ -185,9 +185,9 @@ public void setRequiredParameterName(String requiredParameterName) { } /** - * Set the boolean value that marks a dependency as required - *

    For example if using 'required=true' (the default), - * this value should be true; but if using + * Set the boolean value that marks a dependency as required + *

    For example if using 'required=true' (the default), + * this value should be true; but if using * 'optional=false', this value should be false. * @see #setRequiredParameterName(String) */ @@ -196,11 +196,11 @@ public void setRequiredParameterValue(boolean requiredParameterValue) { } public void setOrder(int order) { - this.order = order; + this.order = order; } public int getOrder() { - return this.order; + return this.order; } public void setBeanFactory(BeanFactory beanFactory) throws BeansException { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java index 040a80981ccd..84102e70e904 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Configurable.java @@ -25,7 +25,7 @@ /** * Marks a class as being eligible for Spring-driven configuration. - * + * *

    Typically used with the AspectJ AnnotationBeanConfigurerAspect. * * @author Rod Johnson @@ -54,7 +54,7 @@ * Is dependency checking to be performed for configured objects? */ boolean dependencyCheck() default false; - + /** * Are dependencies to be injected prior to the construction of an object? */ diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java index 91bc3b5bfe36..0ba3e8742c66 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered - private Set customQualifierTypes; + private Set customQualifierTypes; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -77,7 +77,7 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) { * does not require explicit registration. * @param customQualifierTypes the custom types to register */ - public void setCustomQualifierTypes(Set customQualifierTypes) { + public void setCustomQualifierTypes(Set customQualifierTypes) { this.customQualifierTypes = customQualifierTypes; } @@ -96,9 +96,9 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) QualifierAnnotationAutowireCandidateResolver resolver = (QualifierAnnotationAutowireCandidateResolver) dlbf.getAutowireCandidateResolver(); for (Object value : this.customQualifierTypes) { - Class customType = null; + Class customType = null; if (value instanceof Class) { - customType = (Class) value; + customType = (Class) value; } else if (value instanceof String) { String className = (String) value; @@ -112,7 +112,7 @@ else if (value instanceof String) { throw new IllegalArgumentException( "Qualifier type [" + customType.getName() + "] needs to be annotation type"); } - resolver.addQualifierType(customType); + resolver.addQualifierType((Class)customType); } } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java index 74a5e59d240d..e1ae64ca50e4 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java @@ -109,14 +109,13 @@ public void setDestroyAnnotationType(Class destroyAnnotati } public void setOrder(int order) { - this.order = order; + this.order = order; } public int getOrder() { - return this.order; + return this.order; } - public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) { if (beanType != null) { LifecycleMetadata metadata = findLifecycleMetadata(beanType); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java index fe3e3b15efd7..fb2a6c9213f0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java @@ -55,9 +55,19 @@ public class InjectionMetadata { private volatile Set checkedElements; - public InjectionMetadata(Class targetClass, Collection elements) { - this.targetClass = targetClass; - this.injectedElements = elements; + public InjectionMetadata(Class targetClass, Collection elements) { + if (!elements.isEmpty()) { + this.injectedElements = Collections.synchronizedSet(new LinkedHashSet(elements.size())); + for (InjectedElement element : elements) { + if (logger.isDebugEnabled()) { + logger.debug("Found injected element on class [" + targetClass.getName() + "]: " + element); + } + this.injectedElements.add(element); + } + } + else { + this.injectedElements = Collections.emptySet(); + } } public void checkConfigMembers(RootBeanDefinition beanDefinition) { @@ -110,7 +120,7 @@ public final Member getMember() { return this.member; } - protected final Class getResourceType() { + protected final Class getResourceType() { if (this.isField) { return ((Field) this.member).getType(); } @@ -122,16 +132,16 @@ else if (this.pd != null) { } } - protected final void checkResourceType(Class resourceType) { + protected final void checkResourceType(Class resourceType) { if (this.isField) { - Class fieldType = ((Field) this.member).getType(); + Class fieldType = ((Field) this.member).getType(); if (!(resourceType.isAssignableFrom(fieldType) || fieldType.isAssignableFrom(resourceType))) { throw new IllegalStateException("Specified field type [" + fieldType + "] is incompatible with resource type [" + resourceType.getName() + "]"); } } else { - Class paramType = + Class paramType = (this.pd != null ? this.pd.getPropertyType() : ((Method) this.member).getParameterTypes()[0]); if (!(resourceType.isAssignableFrom(paramType) || paramType.isAssignableFrom(resourceType))) { throw new IllegalStateException("Specified parameter type [" + paramType + diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java index 91aff60e6fda..46ef046864fd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/Required.java @@ -24,7 +24,7 @@ /** * Marks a method (typically a JavaBean setter method) as being 'required': that is, * the setter method must be configured to be dependency-injected with a value. - * + * *

    Please do consult the javadoc for the {@link RequiredAnnotationBeanPostProcessor} * class (which, by default, checks for the presence of this annotation). * diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java index e4db17e1eb50..ac79076d79ba 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java @@ -123,11 +123,11 @@ public void setBeanFactory(BeanFactory beanFactory) { } public void setOrder(int order) { - this.order = order; + this.order = order; } public int getOrder() { - return this.order; + return this.order; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java index 67d52452787d..4ad3afbfb30e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ * this class will create the object that it creates exactly once * on initialization and subsequently return said singleton instance * on all calls to the {@link #getObject()} method. - * + * *

    Else, this class will create a new instance every time the * {@link #getObject()} method is invoked. Subclasses are responsible * for implementing the abstract {@link #createInstance()} template @@ -153,7 +153,7 @@ public final T getObject() throws Exception { */ @SuppressWarnings("unchecked") private T getEarlySingletonInstance() throws Exception { - Class[] ifcs = getEarlySingletonInterfaces(); + Class[] ifcs = getEarlySingletonInterfaces(); if (ifcs == null) { throw new FactoryBeanNotInitializedException( getClass().getName() + " does not support circular references"); @@ -218,8 +218,8 @@ public void destroy() throws Exception { * or null to indicate a FactoryBeanNotInitializedException * @see org.springframework.beans.factory.FactoryBeanNotInitializedException */ - protected Class[] getEarlySingletonInterfaces() { - Class type = getObjectType(); + protected Class[] getEarlySingletonInterfaces() { + Class type = getObjectType(); return (type != null && type.isInterface() ? new Class[] {type} : null); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java index 050ca889cae0..d15ecca5ee37 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -185,7 +185,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory { * @see #AUTOWIRE_BY_TYPE * @see #AUTOWIRE_CONSTRUCTOR */ - Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException; + T createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException; /** * Instantiate a new bean instance of the given class with the specified autowire @@ -213,7 +213,7 @@ public interface AutowireCapableBeanFactory extends BeanFactory { * @see #applyBeanPostProcessorsBeforeInitialization * @see #applyBeanPostProcessorsAfterInitialization */ - Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException; + T autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException; /** * Autowire the bean properties of the given bean instance by name or type. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java index 1619505c1f52..47db66447eb6 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanFactoryPostProcessor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java index 1a382a6324ea..cb979e8826f0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/BeanReferenceFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,8 +45,7 @@ * @deprecated as of Spring 3.2, in favor of using regular bean name aliases * (which support placeholder parsing since Spring 2.5) */ -@Deprecated -public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAware { +public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAware { private String targetBeanName; @@ -76,14 +75,15 @@ public void setBeanFactory(BeanFactory beanFactory) { } - public Object getObject() throws BeansException { + @SuppressWarnings("unchecked") + public T getObject() throws BeansException { if (this.beanFactory == null) { throw new FactoryBeanNotInitializedException(); } - return this.beanFactory.getBean(this.targetBeanName); + return (T) this.beanFactory.getBean(this.targetBeanName); } - public Class getObjectType() { + public Class getObjectType() { if (this.beanFactory == null) { return null; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java index 70b2e00508b2..d0e93c8b0c83 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CommonsLogFactoryBean.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java index 3a3aa9df176c..174322f1c4d8 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ConstructorArgumentValues.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,7 +146,7 @@ public boolean hasIndexedArgumentValue(int index) { * untyped values only) * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getIndexedArgumentValue(int index, Class requiredType) { + public ValueHolder getIndexedArgumentValue(int index, Class requiredType) { return getIndexedArgumentValue(index, requiredType, null); } @@ -159,7 +159,7 @@ public ValueHolder getIndexedArgumentValue(int index, Class requiredType) { * unnamed values only) * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getIndexedArgumentValue(int index, Class requiredType, String requiredName) { + public ValueHolder getIndexedArgumentValue(int index, Class requiredType, String requiredName) { Assert.isTrue(index >= 0, "Index must not be negative"); ValueHolder valueHolder = this.indexedArgumentValues.get(index); if (valueHolder != null && @@ -247,7 +247,7 @@ private void addOrMergeGenericArgumentValue(ValueHolder newValue) { * @param requiredType the type to match * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getGenericArgumentValue(Class requiredType) { + public ValueHolder getGenericArgumentValue(Class requiredType) { return getGenericArgumentValue(requiredType, null, null); } @@ -257,7 +257,7 @@ public ValueHolder getGenericArgumentValue(Class requiredType) { * @param requiredName the name to match * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getGenericArgumentValue(Class requiredType, String requiredName) { + public ValueHolder getGenericArgumentValue(Class requiredType, String requiredName) { return getGenericArgumentValue(requiredType, requiredName, null); } @@ -273,7 +273,7 @@ public ValueHolder getGenericArgumentValue(Class requiredType, String requiredNa * in the current resolution process and should therefore not be returned again * @return the ValueHolder for the argument, or null if none found */ - public ValueHolder getGenericArgumentValue(Class requiredType, String requiredName, Set usedValueHolders) { + public ValueHolder getGenericArgumentValue(Class requiredType, String requiredName, Set usedValueHolders) { for (ValueHolder valueHolder : this.genericArgumentValues) { if (usedValueHolders != null && usedValueHolders.contains(valueHolder)) { continue; @@ -312,7 +312,7 @@ public List getGenericArgumentValues() { * @param requiredType the type to match * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getArgumentValue(int index, Class requiredType) { + public ValueHolder getArgumentValue(int index, Class requiredType) { return getArgumentValue(index, requiredType, null, null); } @@ -324,7 +324,7 @@ public ValueHolder getArgumentValue(int index, Class requiredType) { * @param requiredName the name to match * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getArgumentValue(int index, Class requiredType, String requiredName) { + public ValueHolder getArgumentValue(int index, Class requiredType, String requiredName) { return getArgumentValue(index, requiredType, requiredName, null); } @@ -340,7 +340,7 @@ public ValueHolder getArgumentValue(int index, Class requiredType, String requir * in case of multiple generic argument values of the same type) * @return the ValueHolder for the argument, or null if none set */ - public ValueHolder getArgumentValue(int index, Class requiredType, String requiredName, Set usedValueHolders) { + public ValueHolder getArgumentValue(int index, Class requiredType, String requiredName, Set usedValueHolders) { Assert.isTrue(index >= 0, "Index must not be negative"); ValueHolder valueHolder = getIndexedArgumentValue(index, requiredType, requiredName); if (valueHolder == null) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java index 641f6c7f265d..6f758aae2eb9 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ /** * {@link BeanFactoryPostProcessor} implementation that allows for convenient * registration of custom {@link PropertyEditor property editors}. - * + * *

    * In case you want to register {@link PropertyEditor} instances, the * recommended usage as of Spring 2.0 is to use custom @@ -43,7 +43,7 @@ * desired editor instances on a given * {@link org.springframework.beans.PropertyEditorRegistry registry}. Each * PropertyEditorRegistrar can register any number of custom editors. - * + * *

      * <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      *   <property name="propertyEditorRegistrars">
    @@ -54,12 +54,12 @@
      *   </property>
      * </bean>
      * 
    - * + * *

    * It's perfectly fine to register {@link PropertyEditor} classes via * the {@code customEditors} property. Spring will create fresh instances of * them for each editing attempt then: - * + * *

      * <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      *   <property name="customEditors">
    @@ -70,7 +70,7 @@
      *   </property>
      * </bean>
      * 
    - * + * *

    * Note, that you shouldn't register {@link PropertyEditor} bean instances via * the {@code customEditors} property as {@link PropertyEditor}s are stateful @@ -78,7 +78,7 @@ * attempt. In case you need control over the instantiation process of * {@link PropertyEditor}s, use a {@link PropertyEditorRegistrar} to register * them. - * + * *

    * Also supports "java.lang.String[]"-style array class names and primitive * class names (e.g. "boolean"). Delegates to {@link ClassUtils} for actual @@ -116,11 +116,11 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla public void setOrder(int order) { - this.order = order; + this.order = order; } public int getOrder() { - return this.order; + return this.order; } /** @@ -178,7 +178,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) for (Map.Entry entry : this.customEditors.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); - Class requiredType = null; + Class requiredType = null; try { requiredType = ClassUtils.forName(key, this.beanClassLoader); @@ -192,10 +192,10 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) new SharedPropertyEditorRegistrar(requiredType, (PropertyEditor) value)); } else if (value instanceof Class) { - beanFactory.registerCustomEditor(requiredType, (Class) value); + beanFactory.registerCustomEditor(requiredType, (Class) value); } else if (value instanceof String) { - Class editorClass = ClassUtils.forName((String) value, this.beanClassLoader); + Class editorClass = ClassUtils.forName((String) value, this.beanClassLoader); Assert.isAssignable(PropertyEditor.class, editorClass); beanFactory.registerCustomEditor(requiredType, (Class) editorClass); } @@ -225,16 +225,17 @@ else if (value instanceof String) { */ private static class SharedPropertyEditorRegistrar implements PropertyEditorRegistrar { - private final Class requiredType; + private final Class requiredType; private final PropertyEditor sharedEditor; - public SharedPropertyEditorRegistrar(Class requiredType, PropertyEditor sharedEditor) { + public SharedPropertyEditorRegistrar(Class requiredType, PropertyEditor sharedEditor) { this.requiredType = requiredType; this.sharedEditor = sharedEditor; } - public void registerCustomEditors(PropertyEditorRegistry registry) { + @SuppressWarnings("deprecation") + public void registerCustomEditors(PropertyEditorRegistry registry) { if (!(registry instanceof PropertyEditorRegistrySupport)) { throw new IllegalArgumentException("Cannot registered shared editor " + "on non-PropertyEditorRegistrySupport registry: " + registry); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java index 130387e552a1..ec2bd5e4c4f5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomScopeConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,8 +73,6 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) { this.beanClassLoader = beanClassLoader; } - - @SuppressWarnings("unchecked") public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { if (this.scopes != null) { for (Map.Entry entry : this.scopes.entrySet()) { @@ -84,12 +82,12 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) beanFactory.registerScope(scopeKey, (Scope) value); } else if (value instanceof Class) { - Class scopeClass = (Class) value; + Class scopeClass = (Class) value; Assert.isAssignable(Scope.class, scopeClass); beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClass(scopeClass)); } else if (value instanceof String) { - Class scopeClass = ClassUtils.resolveClassName((String) value, this.beanClassLoader); + Class scopeClass = ClassUtils.resolveClassName((String) value, this.beanClassLoader); Assert.isAssignable(Scope.class, scopeClass); beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClass(scopeClass)); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java index ba38a85c4b7a..6af67a648d29 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java @@ -43,11 +43,11 @@ public class DependencyDescriptor implements Serializable { private transient Field field; - private Class declaringClass; + private Class declaringClass; private String methodName; - private Class[] parameterTypes; + private Class[] parameterTypes; private int parameterIndex; @@ -216,12 +216,12 @@ public Class getDependencyType() { if (type instanceof ParameterizedType) { Type arg = ((ParameterizedType) type).getActualTypeArguments()[0]; if (arg instanceof Class) { - return (Class) arg; + return (Class) arg; } else if (arg instanceof ParameterizedType) { arg = ((ParameterizedType) arg).getRawType(); if (arg instanceof Class) { - return (Class) arg; + return (Class) arg; } } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java index 7b3c5ea5df29..7aa79855ed45 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ /** * {@link FactoryBean} which retrieves a static or non-static field value. - * + * *

    Typically used for retrieving public static final constants. Usage example: * *

    // standard definition for exposing a static field, specifying the "staticField" property
    @@ -42,10 +42,10 @@
      * <bean id="java.sql.Connection.TRANSACTION_SERIALIZABLE"
      *       class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
    * - * + * *

    If you are using Spring 2.0, you can also use the following style of configuration for * public static fields. - * + * *

    <util:constant static-field="java.sql.Connection.TRANSACTION_SERIALIZABLE"/>
    * * @author Juergen Hoeller @@ -55,7 +55,7 @@ public class FieldRetrievingFactoryBean implements FactoryBean, BeanNameAware, BeanClassLoaderAware, InitializingBean { - private Class targetClass; + private Class targetClass; private Object targetObject; @@ -78,14 +78,14 @@ public class FieldRetrievingFactoryBean * @see #setTargetObject * @see #setTargetField */ - public void setTargetClass(Class targetClass) { + public void setTargetClass(Class targetClass) { this.targetClass = targetClass; } /** * Return the target class on which the field is defined. */ - public Class getTargetClass() { + public Class getTargetClass() { return targetClass; } @@ -186,11 +186,10 @@ else if (this.targetField == null) { } // Try to get the exact method first. - Class targetClass = (this.targetObject != null) ? this.targetObject.getClass() : this.targetClass; + Class targetClass = (this.targetObject != null) ? this.targetObject.getClass() : this.targetClass; this.fieldObject = targetClass.getField(this.targetField); } - public Object getObject() throws IllegalAccessException { if (this.fieldObject == null) { throw new FactoryBeanNotInitializedException(); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java index 7ceb21f7535f..870e9b76542a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ListFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,17 +32,17 @@ * @see SetFactoryBean * @see MapFactoryBean */ -public class ListFactoryBean extends AbstractFactoryBean { +public class ListFactoryBean extends AbstractFactoryBean> { - private List sourceList; + private List sourceList; - private Class targetListClass; + private Class> targetListClass; /** * Set the source List, typically populated via XML "list" elements. */ - public void setSourceList(List sourceList) { + public void setSourceList(List sourceList) { this.sourceList = sourceList; } @@ -52,36 +52,38 @@ public void setSourceList(List sourceList) { *

    Default is a java.util.ArrayList. * @see java.util.ArrayList */ - public void setTargetListClass(Class targetListClass) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void setTargetListClass(Class targetListClass) { if (targetListClass == null) { throw new IllegalArgumentException("'targetListClass' must not be null"); } if (!List.class.isAssignableFrom(targetListClass)) { throw new IllegalArgumentException("'targetListClass' must implement [java.util.List]"); } - this.targetListClass = targetListClass; + this.targetListClass = (Class>) targetListClass; } @Override - public Class getObjectType() { + public Class getObjectType() { return List.class; } @Override @SuppressWarnings("unchecked") - protected List createInstance() { + protected List createInstance() { if (this.sourceList == null) { throw new IllegalArgumentException("'sourceList' is required"); } + @SuppressWarnings("rawtypes") List result = null; if (this.targetListClass != null) { - result = (List) BeanUtils.instantiateClass(this.targetListClass); + result = BeanUtils.instantiateClass(this.targetListClass); } else { - result = new ArrayList(this.sourceList.size()); + result = new ArrayList(this.sourceList.size()); } - Class valueType = null; + Class valueType = null; if (this.targetListClass != null) { valueType = GenericCollectionTypeResolver.getCollectionType(this.targetListClass); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java index 436e20da9359..7e6772ccb01c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/MapFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,17 +32,17 @@ * @see SetFactoryBean * @see ListFactoryBean */ -public class MapFactoryBean extends AbstractFactoryBean { +public class MapFactoryBean extends AbstractFactoryBean> { private Map sourceMap; - private Class targetMapClass; + private Class> targetMapClass; /** * Set the source Map, typically populated via XML "map" elements. */ - public void setSourceMap(Map sourceMap) { + public void setSourceMap(Map sourceMap) { this.sourceMap = sourceMap; } @@ -52,44 +52,45 @@ public void setSourceMap(Map sourceMap) { *

    Default is a linked HashMap, keeping the registration order. * @see java.util.LinkedHashMap */ - public void setTargetMapClass(Class targetMapClass) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void setTargetMapClass(Class targetMapClass) { if (targetMapClass == null) { throw new IllegalArgumentException("'targetMapClass' must not be null"); } if (!Map.class.isAssignableFrom(targetMapClass)) { throw new IllegalArgumentException("'targetMapClass' must implement [java.util.Map]"); } - this.targetMapClass = targetMapClass; + this.targetMapClass = (Class>) targetMapClass; } @Override - public Class getObjectType() { + public Class getObjectType() { return Map.class; } @Override - @SuppressWarnings("unchecked") - protected Map createInstance() { + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected Map createInstance() { if (this.sourceMap == null) { throw new IllegalArgumentException("'sourceMap' is required"); } Map result = null; if (this.targetMapClass != null) { - result = (Map) BeanUtils.instantiateClass(this.targetMapClass); + result = BeanUtils.instantiateClass(this.targetMapClass); } else { result = new LinkedHashMap(this.sourceMap.size()); } - Class keyType = null; - Class valueType = null; + Class keyType = null; + Class valueType = null; if (this.targetMapClass != null) { keyType = GenericCollectionTypeResolver.getMapKeyType(this.targetMapClass); valueType = GenericCollectionTypeResolver.getMapValueType(this.targetMapClass); } if (keyType != null || valueType != null) { TypeConverter converter = getBeanTypeConverter(); - for (Map.Entry entry : this.sourceMap.entrySet()) { + for (Map.Entry entry : this.sourceMap.entrySet()) { Object convertedKey = converter.convertIfNecessary(entry.getKey(), keyType); Object convertedValue = converter.convertIfNecessary(entry.getValue(), valueType); result.put(convertedKey, convertedValue); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java index 51440d47dadc..e8188ae2d170 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ /** * {@link FactoryBean} which returns a value which is the result of a static or instance - * method invocation. For most use cases it is better to just use the container's + * method invocation. For most use cases it is better to just use the container's * built-in factory method support for the same purpose, since that is smarter at * converting arguments. This factory bean is still useful though when you need to * call a method which doesn't return any value (for example, a static class method @@ -55,7 +55,7 @@ * *

    This class depends on {@link #afterPropertiesSet()} being called once * all properties have been set, as per the InitializingBean contract. - * + * *

    An example (in an XML based bean factory definition) of a bean definition * which uses this class to call a static factory method: * @@ -82,7 +82,7 @@ * </list> * </property> * </bean> - * + * * @author Colin Sampaleanu * @author Juergen Hoeller * @since 21.11.2003 @@ -119,7 +119,7 @@ public void setBeanClassLoader(ClassLoader classLoader) { } @Override - protected Class resolveClassName(String className) throws ClassNotFoundException { + protected Class resolveClassName(String className) throws ClassNotFoundException { return ClassUtils.forName(className, this.beanClassLoader); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java index d2fc8ab2591e..92e417d0759c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBean.java @@ -94,7 +94,7 @@ * @see org.springframework.beans.factory.ObjectFactory * @see ServiceLocatorFactoryBean */ -public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean { +public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean> { private String targetBeanName; @@ -118,12 +118,12 @@ public void afterPropertiesSet() throws Exception { @Override - public Class getObjectType() { + public Class getObjectType() { return ObjectFactory.class; } @Override - protected ObjectFactory createInstance() { + protected ObjectFactory createInstance() { return new TargetBeanObjectFactory(getBeanFactory(), this.targetBeanName); } @@ -131,7 +131,7 @@ protected ObjectFactory createInstance() { /** * Independent inner class - for serialization purposes. */ - private static class TargetBeanObjectFactory implements ObjectFactory, Serializable { + private static class TargetBeanObjectFactory implements ObjectFactory, Serializable { private final BeanFactory beanFactory; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java index f025a941c1d4..612fbdca1979 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,9 +76,9 @@ public void setUserTreePath(String userTreePath) { */ public void afterPropertiesSet() { this.systemPrefs = (this.systemTreePath != null) ? - Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot(); + Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot(); this.userPrefs = (this.userTreePath != null) ? - Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot(); + Preferences.userRoot().node(this.userTreePath) : Preferences.userRoot(); } /** diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java index 736a7d14fd5e..a9da82207da5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java @@ -100,7 +100,7 @@ public void setIgnoreInvalidKeys(boolean ignoreInvalidKeys) { protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException { - for (Enumeration names = props.propertyNames(); names.hasMoreElements();) { + for (Enumeration names = props.propertyNames(); names.hasMoreElements();) { String key = (String) names.nextElement(); try { processKey(beanFactory, key, props.getProperty(key)); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java index 518ce93ff3b0..4015827ae7c7 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ /** * {@link FactoryBean} that evaluates a property path on a given target object. - * + * *

    The target object can be specified directly or via a bean name. * *

    Usage examples: @@ -64,12 +64,12 @@ * * <!-- will result in 10, which is the value of property 'age' of bean 'tb' --> * <bean id="tb.age" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/> - * + * *

    If you are using Spring 2.0 and XML Schema support in your configuration file(s), * you can also use the following style of configuration for property path access. * (See also the appendix entitled 'XML Schema-based configuration' in the Spring * reference manual for more examples.) - * + * *

     <!-- will result in 10, which is the value of property 'age' of bean 'tb' -->
      * <util:property-path id="name" path="testBean.age"/>
    * @@ -91,7 +91,7 @@ public class PropertyPathFactoryBean implements FactoryBean, BeanNameAwa private String propertyPath; - private Class resultType; + private Class resultType; private String beanName; @@ -137,7 +137,7 @@ public void setPropertyPath(String propertyPath) { * provided that you need matching by type (for example, for autowiring). * @param resultType the result type, for example "java.lang.Integer" */ - public void setResultType(Class resultType) { + public void setResultType(Class resultType) { this.resultType = resultType; } @@ -162,15 +162,15 @@ public void setBeanFactory(BeanFactory beanFactory) { if (this.targetBeanWrapper == null && this.targetBeanName == null) { if (this.propertyPath != null) { throw new IllegalArgumentException( - "Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'"); + "Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'"); } // No other properties specified: check bean name. int dotIndex = this.beanName.indexOf('.'); if (dotIndex == -1) { throw new IllegalArgumentException( - "Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " + - "bean name '" + this.beanName + "' does not follow 'beanName.property' syntax"); + "Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " + + "bean name '" + this.beanName + "' does not follow 'beanName.property' syntax"); } this.targetBeanName = this.beanName.substring(0, dotIndex); this.propertyPath = this.beanName.substring(dotIndex + 1); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java index 317defbe96fa..6d7024a33955 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ProviderCreatingFactoryBean.java @@ -39,7 +39,7 @@ * @see javax.inject.Provider * @see ObjectFactoryCreatingFactoryBean */ -public class ProviderCreatingFactoryBean extends AbstractFactoryBean { +public class ProviderCreatingFactoryBean extends AbstractFactoryBean> { private String targetBeanName; @@ -63,20 +63,20 @@ public void afterPropertiesSet() throws Exception { @Override - public Class getObjectType() { + public Class getObjectType() { return Provider.class; } @Override - protected Provider createInstance() { - return new TargetBeanProvider(getBeanFactory(), this.targetBeanName); + protected Provider createInstance() { + return new TargetBeanProvider(getBeanFactory(), this.targetBeanName); } /** * Independent inner class - for serialization purposes. */ - private static class TargetBeanProvider implements Provider, Serializable { + private static class TargetBeanProvider implements Provider, Serializable { private final BeanFactory beanFactory; @@ -87,8 +87,9 @@ public TargetBeanProvider(BeanFactory beanFactory, String targetBeanName) { this.targetBeanName = targetBeanName; } - public Object get() throws BeansException { - return this.beanFactory.getBean(this.targetBeanName); + @SuppressWarnings("unchecked") + public T get() throws BeansException { + return (T) this.beanFactory.getBean(this.targetBeanName); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java index 3df4a47c2714..1babf96e52d2 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanNameReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import org.springframework.util.Assert; -/** +/** * Immutable placeholder class used for a property value object when it's a * reference to another bean name in the factory, to be resolved at runtime. * @@ -29,7 +29,7 @@ * @see org.springframework.beans.factory.BeanFactory#getBean */ public class RuntimeBeanNameReference implements BeanReference { - + private final String beanName; private Object source; @@ -80,7 +80,7 @@ public int hashCode() { @Override public String toString() { - return '<' + getBeanName() + '>'; + return '<' + getBeanName() + '>'; } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java index 822d98c43cc2..4ebe01801f3a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/RuntimeBeanReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import org.springframework.util.Assert; -/** +/** * Immutable placeholder class used for a property value object when it's * a reference to another bean in the factory, to be resolved at runtime. * @@ -28,7 +28,7 @@ * @see org.springframework.beans.factory.BeanFactory#getBean */ public class RuntimeBeanReference implements BeanReference { - + private final String beanName; private final boolean toParent; @@ -107,7 +107,7 @@ public int hashCode() { @Override public String toString() { - return '<' + getBeanName() + '>'; + return '<' + getBeanName() + '>'; } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java index 192f6b7e6678..e172a0a7fab5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -187,17 +187,17 @@ * @see #setServiceMappings * @see ObjectFactoryCreatingFactoryBean */ -public class ServiceLocatorFactoryBean implements FactoryBean, BeanFactoryAware, InitializingBean { +public class ServiceLocatorFactoryBean implements FactoryBean, BeanFactoryAware, InitializingBean { - private Class serviceLocatorInterface; + private Class serviceLocatorInterface; - private Constructor serviceLocatorExceptionConstructor; + private Constructor serviceLocatorExceptionConstructor; private Properties serviceMappings; private ListableBeanFactory beanFactory; - private Object proxy; + private T proxy; /** @@ -207,7 +207,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean, BeanFacto * See the {@link ServiceLocatorFactoryBean class-level Javadoc} for * information on the semantics of such methods. */ - public void setServiceLocatorInterface(Class interfaceType) { + public void setServiceLocatorInterface(Class interfaceType) { this.serviceLocatorInterface = interfaceType; } @@ -223,7 +223,7 @@ public void setServiceLocatorInterface(Class interfaceType) { * @see #determineServiceLocatorExceptionConstructor * @see #createServiceLocatorException */ - public void setServiceLocatorExceptionClass(Class serviceLocatorExceptionClass) { + public void setServiceLocatorExceptionClass(Class serviceLocatorExceptionClass) { if (serviceLocatorExceptionClass != null && !Exception.class.isAssignableFrom(serviceLocatorExceptionClass)) { throw new IllegalArgumentException( "serviceLocatorException [" + serviceLocatorExceptionClass.getName() + "] is not a subclass of Exception"); @@ -254,13 +254,14 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = (ListableBeanFactory) beanFactory; } + @SuppressWarnings("unchecked") public void afterPropertiesSet() { if (this.serviceLocatorInterface == null) { throw new IllegalArgumentException("Property 'serviceLocatorInterface' is required"); } // Create service locator proxy. - this.proxy = Proxy.newProxyInstance( + this.proxy = (T)Proxy.newProxyInstance( this.serviceLocatorInterface.getClassLoader(), new Class[] {this.serviceLocatorInterface}, new ServiceLocatorInvocationHandler()); @@ -277,7 +278,7 @@ public void afterPropertiesSet() { * @return the constructor to use * @see #setServiceLocatorExceptionClass */ - protected Constructor determineServiceLocatorExceptionConstructor(Class exceptionClass) { + protected Constructor determineServiceLocatorExceptionConstructor(Class exceptionClass) { try { return exceptionClass.getConstructor(new Class[] {String.class, Throwable.class}); } @@ -308,8 +309,8 @@ protected Constructor determineServiceLocatorExceptionConstructor(Class exceptio * @return the service locator exception to throw * @see #setServiceLocatorExceptionClass */ - protected Exception createServiceLocatorException(Constructor exceptionConstructor, BeansException cause) { - Class[] paramTypes = exceptionConstructor.getParameterTypes(); + protected E createServiceLocatorException(Constructor exceptionConstructor, BeansException cause) { + Class[] paramTypes = exceptionConstructor.getParameterTypes(); Object[] args = new Object[paramTypes.length]; for (int i = 0; i < paramTypes.length; i++) { if (paramTypes[i].equals(String.class)) { @@ -319,11 +320,11 @@ else if (paramTypes[i].isInstance(cause)) { args[i] = cause; } } - return (Exception) BeanUtils.instantiateClass(exceptionConstructor, args); + return BeanUtils.instantiateClass(exceptionConstructor, args); } - public Object getObject() { + public T getObject() { return this.proxy; } @@ -358,9 +359,8 @@ else if (ReflectionUtils.isToStringMethod(method)) { } } - @SuppressWarnings("unchecked") private Object invokeServiceLocatorMethod(Method method, Object[] args) throws Exception { - Class serviceLocatorMethodReturnType = getServiceLocatorMethodReturnType(method); + Class serviceLocatorMethodReturnType = getServiceLocatorMethodReturnType(method); try { String beanName = tryGetBeanName(args); if (StringUtils.hasLength(beanName)) { @@ -398,10 +398,10 @@ private String tryGetBeanName(Object[] args) { return beanName; } - private Class getServiceLocatorMethodReturnType(Method method) throws NoSuchMethodException { - Class[] paramTypes = method.getParameterTypes(); + private Class getServiceLocatorMethodReturnType(Method method) throws NoSuchMethodException { + Class[] paramTypes = method.getParameterTypes(); Method interfaceMethod = serviceLocatorInterface.getMethod(method.getName(), paramTypes); - Class serviceLocatorReturnType = interfaceMethod.getReturnType(); + Class serviceLocatorReturnType = interfaceMethod.getReturnType(); // Check whether the method is a valid service locator. if (paramTypes.length > 1 || void.class.equals(serviceLocatorReturnType)) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java index e3b2ee9e21e5..7dfd0983a475 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/SetFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,17 +32,17 @@ * @see ListFactoryBean * @see MapFactoryBean */ -public class SetFactoryBean extends AbstractFactoryBean { +public class SetFactoryBean extends AbstractFactoryBean> { - private Set sourceSet; + private Set sourceSet; - private Class targetSetClass; + private Class> targetSetClass; /** * Set the source Set, typically populated via XML "set" elements. */ - public void setSourceSet(Set sourceSet) { + public void setSourceSet(Set sourceSet) { this.sourceSet = sourceSet; } @@ -52,36 +52,38 @@ public void setSourceSet(Set sourceSet) { *

    Default is a linked HashSet, keeping the registration order. * @see java.util.LinkedHashSet */ - public void setTargetSetClass(Class targetSetClass) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void setTargetSetClass(Class targetSetClass) { if (targetSetClass == null) { throw new IllegalArgumentException("'targetSetClass' must not be null"); } if (!Set.class.isAssignableFrom(targetSetClass)) { throw new IllegalArgumentException("'targetSetClass' must implement [java.util.Set]"); } - this.targetSetClass = targetSetClass; + this.targetSetClass = (Class>) targetSetClass; } @Override - public Class getObjectType() { + public Class getObjectType() { return Set.class; } @Override - @SuppressWarnings("unchecked") - protected Set createInstance() { + @SuppressWarnings({ "unchecked", "cast" }) + protected Set createInstance() { if (this.sourceSet == null) { throw new IllegalArgumentException("'sourceSet' is required"); } + @SuppressWarnings("rawtypes") Set result = null; if (this.targetSetClass != null) { - result = (Set) BeanUtils.instantiateClass(this.targetSetClass); + result = (Set) BeanUtils.instantiateClass(this.targetSetClass); } else { - result = new LinkedHashSet(this.sourceSet.size()); + result = new LinkedHashSet(this.sourceSet.size()); } - Class valueType = null; + Class valueType = null; if (this.targetSetClass != null) { valueType = GenericCollectionTypeResolver.getCollectionType(this.targetSetClass); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java index 01e7cb52e2fb..cedbedaf9b4c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/TypedStringValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ public TypedStringValue(String value) { * @param value the String value * @param targetType the type to convert to */ - public TypedStringValue(String value, Class targetType) { + public TypedStringValue(String value, Class targetType) { setValue(value); setTargetType(targetType); } @@ -101,7 +101,7 @@ public String getValue() { * for example in BeanFactoryPostProcessors. * @see PropertyPlaceholderConfigurer */ - public void setTargetType(Class targetType) { + public void setTargetType(Class targetType) { Assert.notNull(targetType, "'targetType' must not be null"); this.targetType = targetType; } @@ -109,12 +109,12 @@ public void setTargetType(Class targetType) { /** * Return the type to convert to. */ - public Class getTargetType() { + public Class getTargetType() { Object targetTypeValue = this.targetType; if (!(targetTypeValue instanceof Class)) { throw new IllegalStateException("Typed String value does not carry a resolved target type"); } - return (Class) targetTypeValue; + return (Class) targetTypeValue; } /** @@ -131,7 +131,7 @@ public void setTargetTypeName(String targetTypeName) { public String getTargetTypeName() { Object targetTypeValue = this.targetType; if (targetTypeValue instanceof Class) { - return ((Class) targetTypeValue).getName(); + return ((Class) targetTypeValue).getName(); } else { return (String) targetTypeValue; @@ -153,11 +153,11 @@ public boolean hasTargetType() { * @return the resolved type to convert to * @throws ClassNotFoundException if the type cannot be resolved */ - public Class resolveTargetType(ClassLoader classLoader) throws ClassNotFoundException { + public Class resolveTargetType(ClassLoader classLoader) throws ClassNotFoundException { if (this.targetType == null) { return null; } - Class resolvedClass = ClassUtils.forName(getTargetTypeName(), classLoader); + Class resolvedClass = ClassUtils.forName(getTargetTypeName(), classLoader); this.targetType = resolvedClass; return resolvedClass; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java b/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java index bae3c67c50e9..d4454c46ee6d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/package-info.java @@ -6,7 +6,7 @@ * Provides an alternative to the Singleton and Prototype design * patterns, including a consistent approach to configuration management. * Builds on the org.springframework.beans package. - * + * *

    This package and related packages are discussed in Chapter 11 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java index 9b3311f51276..97ce2d3dde20 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/FailFastProblemReporter.java @@ -22,7 +22,7 @@ /** * Simple {@link ProblemReporter} implementation that exhibits fail-fast * behavior when errors are encountered. - * + * *

    The first error encountered results in a {@link BeanDefinitionParsingException} * being thrown. * diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java index 7ef3254da7f1..969e4c449dac 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,22 +40,23 @@ public final class ParseState { /** * Internal {@link Stack} storage. */ - private final Stack state; + private final Stack state; /** * Create a new ParseState with an empty {@link Stack}. */ public ParseState() { - this.state = new Stack(); + this.state = new Stack(); } /** * Create a new ParseState whose {@link Stack} is a {@link Object#clone clone} * of that of the passed in ParseState. */ - private ParseState(ParseState other) { - this.state = (Stack) other.state.clone(); + @SuppressWarnings("unchecked") + private ParseState(ParseState other) { + this.state = (Stack) other.state.clone(); } @@ -78,7 +79,7 @@ public void pop() { * null if the {@link Stack} is empty. */ public Entry peek() { - return (Entry) (this.state.empty() ? null : this.state.peek()); + return (this.state.empty() ? null : this.state.peek()); } /** diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java index c1737e456ca5..18875d3af35f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java @@ -33,7 +33,7 @@ public class PropertyEntry implements ParseState.Entry { * Creates a new instance of the {@link PropertyEntry} class. * @param name the name of the JavaBean property represented by this instance * @throws IllegalArgumentException if the supplied name is null - * or consists wholly of whitespace + * or consists wholly of whitespace */ public PropertyEntry(String name) { if (!StringUtils.hasText(name)) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java index 2c80092fb15d..4da479b2341b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java @@ -20,7 +20,7 @@ /** * {@link ParseState} entry representing an autowire candidate qualifier. - * + * * @author Mark Fisher * @since 2.5 */ diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java index 27e72ce9e077..06b73d01147e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/AbstractServiceLoaderBasedFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,10 +31,10 @@ * @since 2.5 * @see java.util.ServiceLoader */ -public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFactoryBean +public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFactoryBean implements BeanClassLoaderAware { - private Class serviceType; + private Class serviceType; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -42,14 +42,14 @@ public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFact /** * Specify the desired service type (typically the service's public API). */ - public void setServiceType(Class serviceType) { + public void setServiceType(Class serviceType) { this.serviceType = serviceType; } /** * Return the desired service type. */ - public Class getServiceType() { + public Class getServiceType() { return this.serviceType; } @@ -64,7 +64,7 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) { * @return the object to expose */ @Override - protected Object createInstance() { + protected T createInstance() { Assert.notNull(getServiceType(), "Property 'serviceType' is required"); return getObjectToExpose(ServiceLoader.load(getServiceType(), this.beanClassLoader)); } @@ -75,6 +75,6 @@ protected Object createInstance() { * @param serviceLoader the ServiceLoader for the configured service class * @return the object to expose */ - protected abstract Object getObjectToExpose(ServiceLoader serviceLoader); + protected abstract T getObjectToExpose(ServiceLoader serviceLoader); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java index 5abbda9f2bc5..d79c6380a909 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,11 +30,11 @@ * @since 2.5 * @see java.util.ServiceLoader */ -public class ServiceFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware { +public class ServiceFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware { @Override - protected Object getObjectToExpose(ServiceLoader serviceLoader) { - Iterator it = serviceLoader.iterator(); + protected T getObjectToExpose(ServiceLoader serviceLoader) { + Iterator it = serviceLoader.iterator(); if (!it.hasNext()) { throw new IllegalStateException( "ServiceLoader could not find service for type [" + getServiceType() + "]"); @@ -43,7 +43,7 @@ protected Object getObjectToExpose(ServiceLoader serviceLoader) { } @Override - public Class getObjectType() { + public Class getObjectType() { return getServiceType(); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java index b23cd70ee0e1..4c4f3ecebaf1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceListFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,19 +31,19 @@ * @since 2.5 * @see java.util.ServiceLoader */ -public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware { +public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBean, T> implements BeanClassLoaderAware { @Override - protected Object getObjectToExpose(ServiceLoader serviceLoader) { - List result = new LinkedList(); - for (Object loaderObject : serviceLoader) { + protected List getObjectToExpose(ServiceLoader serviceLoader) { + List result = new LinkedList(); + for (T loaderObject : serviceLoader) { result.add(loaderObject); } return result; } @Override - public Class getObjectType() { + public Class getObjectType() { return List.class; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java index 34f3a1cf21cc..584f8c495363 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/serviceloader/ServiceLoaderFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,15 +28,15 @@ * @since 2.5 * @see java.util.ServiceLoader */ -public class ServiceLoaderFactoryBean extends AbstractServiceLoaderBasedFactoryBean implements BeanClassLoaderAware { +public class ServiceLoaderFactoryBean extends AbstractServiceLoaderBasedFactoryBean, S> implements BeanClassLoaderAware { @Override - protected Object getObjectToExpose(ServiceLoader serviceLoader) { + protected ServiceLoader getObjectToExpose(ServiceLoader serviceLoader) { return serviceLoader; } @Override - public Class getObjectType() { + public Class getObjectType() { return ServiceLoader.class; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java index 1cf82fc69047..7daa3b6329ef 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java @@ -135,21 +135,21 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac * Dependency types to ignore on dependency check and autowire, as Set of * Class objects: for example, String. Default is none. */ - private final Set ignoredDependencyTypes = new HashSet(); + private final Set> ignoredDependencyTypes = new HashSet>(); /** * Dependency interfaces to ignore on dependency check and autowire, as Set of * Class objects. By default, only the BeanFactory interface is ignored. */ - private final Set ignoredDependencyInterfaces = new HashSet(); + private final Set> ignoredDependencyInterfaces = new HashSet>(); /** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */ private final Map factoryBeanInstanceCache = new ConcurrentHashMap(16); /** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */ - private final Map filteredPropertyDescriptorsCache = - new ConcurrentHashMap(64); + private final Map, PropertyDescriptor[]> filteredPropertyDescriptorsCache = + new ConcurrentHashMap, PropertyDescriptor[]>(); /** @@ -243,7 +243,7 @@ public void setAllowRawInjectionDespiteWrapping(boolean allowRawInjectionDespite * Ignore the given dependency type for autowiring: * for example, String. Default is none. */ - public void ignoreDependencyType(Class type) { + public void ignoreDependencyType(Class type) { this.ignoredDependencyTypes.add(type); } @@ -257,7 +257,7 @@ public void ignoreDependencyType(Class type) { * @see org.springframework.beans.factory.BeanFactoryAware * @see org.springframework.context.ApplicationContextAware */ - public void ignoreDependencyInterface(Class ifc) { + public void ignoreDependencyInterface(Class ifc) { this.ignoredDependencyInterfaces.add(ifc); } @@ -329,36 +329,38 @@ public Object resolveDependency(DependencyDescriptor descriptor, String beanName // Specialized methods for fine-grained control over the bean lifecycle //------------------------------------------------------------------------- - public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException { + @SuppressWarnings("unchecked") + public T createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException { // Use non-singleton bean definition, to avoid registering bean as dependent bean. RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck); bd.setScope(BeanDefinition.SCOPE_PROTOTYPE); - return createBean(beanClass.getName(), bd, null); + return (T) createBean(beanClass.getName(), bd, null); } - public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException { + @SuppressWarnings("unchecked") + public T autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException { // Use non-singleton bean definition, to avoid registering bean as dependent bean. final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck); bd.setScope(BeanDefinition.SCOPE_PROTOTYPE); if (bd.getResolvedAutowireMode() == AUTOWIRE_CONSTRUCTOR) { - return autowireConstructor(beanClass.getName(), bd, null, null).getWrappedInstance(); + return (T) autowireConstructor(beanClass.getName(), bd, null, null).getWrappedInstance(); } else { - Object bean; + T bean; final BeanFactory parent = this; - + if (System.getSecurityManager() != null) { - bean = AccessController.doPrivileged(new PrivilegedAction() { - - public Object run() { - return getInstantiationStrategy().instantiate(bd, null, parent); + bean = AccessController.doPrivileged(new PrivilegedAction() { + + public T run() { + return (T) getInstantiationStrategy().instantiate(bd, null, parent); } }, getAccessControlContext()); } else { - bean = getInstantiationStrategy().instantiate(bd, null, parent); + bean = (T) getInstantiationStrategy().instantiate(bd, null, parent); } - + populateBean(beanClass.getName(), bd, new BeanWrapperImpl(bean)); return bean; } @@ -490,7 +492,7 @@ protected Object doCreateBean(final String beanName, final RootBeanDefinition mb instanceWrapper = createBeanInstance(beanName, mbd, args); } final Object bean = (instanceWrapper != null ? instanceWrapper.getWrappedInstance() : null); - Class beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null); + Class beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null); // Allow post-processors to modify the merged bean definition. synchronized (mbd.postProcessingLock) { @@ -509,7 +511,7 @@ protected Object doCreateBean(final String beanName, final RootBeanDefinition mb logger.debug("Eagerly caching bean '" + beanName + "' to allow for resolving potential circular references"); } - addSingletonFactory(beanName, new ObjectFactory() { + addSingletonFactory(beanName, new ObjectFactory() { public Object getObject() throws BeansException { return getEarlyBeanReference(beanName, mbd, bean); } @@ -572,8 +574,8 @@ else if (!this.allowRawInjectionDespiteWrapping && hasDependentBean(beanName)) { } @Override - protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class... typesToMatch) { - Class beanClass; + protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class... typesToMatch) { + Class beanClass; if (mbd.getFactoryMethodName() != null) { beanClass = getTypeForFactoryMethod(beanName, mbd, typesToMatch); } @@ -586,7 +588,7 @@ protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class.. for (BeanPostProcessor bp : getBeanPostProcessors()) { if (bp instanceof SmartInstantiationAwareBeanPostProcessor) { SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp; - Class processedType = ibp.predictBeanType(beanClass, beanName); + Class processedType = ibp.predictBeanType(beanClass, beanName); if (processedType != null) { return processedType; } @@ -610,8 +612,8 @@ protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class.. * @return the type for the bean if determinable, or null else * @see #createBean */ - protected Class getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd, Class[] typesToMatch) { - Class factoryClass; + protected Class getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd, Class[] typesToMatch) { + Class factoryClass; boolean isStatic = true; String factoryBeanName = mbd.getFactoryBeanName(); @@ -762,11 +764,11 @@ protected Object getEarlyBeanReference(String beanName, RootBeanDefinition mbd, * @return the FactoryBean instance, or null to indicate * that we couldn't obtain a shortcut FactoryBean instance */ - private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) { + private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) { synchronized (getSingletonMutex()) { BeanWrapper bw = this.factoryBeanInstanceCache.get(beanName); if (bw != null) { - return (FactoryBean) bw.getWrappedInstance(); + return (FactoryBean) bw.getWrappedInstance(); } if (isSingletonCurrentlyInCreation(beanName)) { return null; @@ -786,7 +788,7 @@ private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBea // Finished partial creation of this bean. afterSingletonCreation(beanName); } - FactoryBean fb = getFactoryBean(beanName, instance); + FactoryBean fb = getFactoryBean(beanName, instance); if (bw != null) { this.factoryBeanInstanceCache.put(beanName, bw); } @@ -803,7 +805,7 @@ private FactoryBean getSingletonFactoryBeanForTypeCheck(String beanName, RootBea * @return the FactoryBean instance, or null to indicate * that we couldn't obtain a shortcut FactoryBean instance */ - private FactoryBean getNonSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) { + private FactoryBean getNonSingletonFactoryBeanForTypeCheck(String beanName, RootBeanDefinition mbd) { if (isPrototypeCurrentlyInCreation(beanName)) { return null; } @@ -834,7 +836,7 @@ private FactoryBean getNonSingletonFactoryBeanForTypeCheck(String beanName, Root * @throws BeansException if any post-processing failed * @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition */ - protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class beanType, String beanName) + protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class beanType, String beanName) throws BeansException { try { @@ -885,7 +887,7 @@ protected Object resolveBeforeInstantiation(String beanName, RootBeanDefinition * @throws BeansException if any post-processing failed * @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation */ - protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, String beanName) + protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, String beanName) throws BeansException { for (BeanPostProcessor bp : getBeanPostProcessors()) { @@ -914,14 +916,14 @@ protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, Str */ protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd, Object[] args) { // Make sure bean class is actually resolved at this point. - Class beanClass = resolveBeanClass(mbd, beanName); + Class beanClass = resolveBeanClass(mbd, beanName); if (beanClass != null && !Modifier.isPublic(beanClass.getModifiers()) && !mbd.isNonPublicAccessAllowed()) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Bean class isn't public, and non-public access not allowed: " + beanClass.getName()); } - if (mbd.getFactoryMethodName() != null) { + if (mbd.getFactoryMethodName() != null) { return instantiateUsingFactoryMethod(beanName, mbd, args); } @@ -946,10 +948,10 @@ protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd } // Need to determine the constructor... - Constructor[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName); + Constructor[] ctors = determineConstructorsFromBeanPostProcessors(beanClass, beanName); if (ctors != null || mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR || - mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) { + mbd.hasConstructorArgumentValues() || !ObjectUtils.isEmpty(args)) { return autowireConstructor(beanName, mbd, ctors, args); } @@ -966,14 +968,14 @@ protected BeanWrapper createBeanInstance(String beanName, RootBeanDefinition mbd * @throws org.springframework.beans.BeansException in case of errors * @see org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor#determineCandidateConstructors */ - protected Constructor[] determineConstructorsFromBeanPostProcessors(Class beanClass, String beanName) + protected Constructor[] determineConstructorsFromBeanPostProcessors(Class beanClass, String beanName) throws BeansException { if (beanClass != null && hasInstantiationAwareBeanPostProcessors()) { for (BeanPostProcessor bp : getBeanPostProcessors()) { if (bp instanceof SmartInstantiationAwareBeanPostProcessor) { SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp; - Constructor[] ctors = ibp.determineCandidateConstructors(beanClass, beanName); + Constructor[] ctors = ibp.determineCandidateConstructors(beanClass, beanName); if (ctors != null) { return ctors; } @@ -1044,7 +1046,7 @@ protected BeanWrapper instantiateUsingFactoryMethod( * @return BeanWrapper for the new instance */ protected BeanWrapper autowireConstructor( - String beanName, RootBeanDefinition mbd, Constructor[] ctors, Object[] explicitArgs) { + String beanName, RootBeanDefinition mbd, Constructor[] ctors, Object[] explicitArgs) { return new ConstructorResolver(this).autowireConstructor(beanName, mbd, ctors, explicitArgs); } @@ -1346,7 +1348,7 @@ protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrap MutablePropertyValues mpvs = null; List original; - + if (System.getSecurityManager()!= null) { if (bw instanceof BeanWrapperImpl) { ((BeanWrapperImpl) bw).setSecurityContext(getAccessControlContext()); @@ -1473,7 +1475,7 @@ public Object run() { else { invokeAwareMethods(beanName, bean); } - + Object wrappedBean = bean; if (mbd == null || !mbd.isSynthetic()) { wrappedBean = applyBeanPostProcessorsBeforeInitialization(wrappedBean, beanName); @@ -1540,7 +1542,7 @@ public Object run() throws Exception { catch (PrivilegedActionException pae) { throw pae.getException(); } - } + } else { ((InitializingBean) bean).afterPropertiesSet(); } @@ -1583,9 +1585,9 @@ protected void invokeCustomInitMethod(String beanName, final Object bean, RootBe } if (logger.isDebugEnabled()) { - logger.debug("Invoking init method '" + initMethodName + "' on bean with name '" + beanName + "'"); + logger.debug("Invoking init method '" + initMethodName + "' on bean with name '" + beanName + "'"); } - + if (System.getSecurityManager() != null) { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { @@ -1610,7 +1612,7 @@ public Object run() throws Exception { try { ReflectionUtils.makeAccessible(initMethod); initMethod.invoke(bean); - } + } catch (InvocationTargetException ex) { throw ex.getTargetException(); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java index 652d45afb218..1eebd1731d79 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java @@ -382,7 +382,7 @@ public Class getBeanClass() throws IllegalStateException { throw new IllegalStateException( "Bean class name [" + beanClassObject + "] has not been resolved into an actual Class"); } - return (Class) beanClassObject; + return (Class) beanClassObject; } public void setBeanClassName(String beanClassName) { @@ -392,7 +392,7 @@ public void setBeanClassName(String beanClassName) { public String getBeanClassName() { Object beanClassObject = this.beanClass; if (beanClassObject instanceof Class) { - return ((Class) beanClassObject).getName(); + return ((Class) beanClassObject).getName(); } else { return (String) beanClassObject; @@ -407,12 +407,12 @@ public String getBeanClassName() { * @return the resolved bean class * @throws ClassNotFoundException if the class name could be resolved */ - public Class resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException { + public Class resolveBeanClass(ClassLoader classLoader) throws ClassNotFoundException { String className = getBeanClassName(); if (className == null) { return null; } - Class resolvedClass = ClassUtils.forName(className, classLoader); + Class resolvedClass = ClassUtils.forName(className, classLoader); this.beanClass = resolvedClass; return resolvedClass; } @@ -550,8 +550,8 @@ public int getResolvedAutowireMode() { // Work out whether to apply setter autowiring or constructor autowiring. // If it has a no-arg constructor it's deemed to be setter autowiring, // otherwise we'll try constructor autowiring. - Constructor[] constructors = getBeanClass().getConstructors(); - for (Constructor constructor : constructors) { + Constructor[] constructors = getBeanClass().getConstructors(); + for (Constructor constructor : constructors) { if (constructor.getParameterTypes().length == 0) { return AUTOWIRE_BY_TYPE; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java index d0f524ed7d1a..088b84499390 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java index 58c560c91790..c8c05e6c79f0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireCandidateQualifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ public class AutowireCandidateQualifier extends BeanMetadataAttributeAccessor { * given type. * @param type the annotation type */ - public AutowireCandidateQualifier(Class type) { + public AutowireCandidateQualifier(Class type) { this(type.getName()); } @@ -64,7 +64,7 @@ public AutowireCandidateQualifier(String typeName) { * @param type the annotation type * @param value the annotation value to match */ - public AutowireCandidateQualifier(Class type, Object value) { + public AutowireCandidateQualifier(Class type, Object value) { this(type.getName(), value); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java index cb1bce28eee8..de7849216160 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,9 +49,9 @@ abstract class AutowireUtils { * decreasing number of arguments. * @param constructors the constructor array to sort */ - public static void sortConstructors(Constructor[] constructors) { - Arrays.sort(constructors, new Comparator() { - public int compare(Constructor c1, Constructor c2) { + public static void sortConstructors(Constructor[] constructors) { + Arrays.sort(constructors, new Comparator>() { + public int compare(Constructor c1, Constructor c2) { boolean p1 = Modifier.isPublic(c1.getModifiers()); boolean p2 = Modifier.isPublic(c2.getModifiers()); if (p1 != p2) { @@ -103,7 +103,7 @@ public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) { } // It was declared by CGLIB, but we might still want to autowire it // if it was actually declared by the superclass. - Class superclass = wm.getDeclaringClass().getSuperclass(); + Class superclass = wm.getDeclaringClass().getSuperclass(); return !ClassUtils.hasMethod(superclass, wm.getName(), wm.getParameterTypes()); } @@ -114,11 +114,11 @@ public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) { * @param interfaces the Set of interfaces (Class objects) * @return whether the setter method is defined by an interface */ - public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set interfaces) { + public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set> interfaces) { Method setter = pd.getWriteMethod(); if (setter != null) { - Class targetClass = setter.getDeclaringClass(); - for (Class ifc : interfaces) { + Class targetClass = setter.getDeclaringClass(); + for (Class ifc : interfaces) { if (ifc.isAssignableFrom(targetClass) && ClassUtils.hasMethod(ifc, setter.getName(), setter.getParameterTypes())) { return true; @@ -135,9 +135,9 @@ public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set requiredType) { if (autowiringValue instanceof ObjectFactory && !requiredType.isInstance(autowiringValue)) { - ObjectFactory factory = (ObjectFactory) autowiringValue; + ObjectFactory factory = (ObjectFactory) autowiringValue; if (autowiringValue instanceof Serializable && requiredType.isInterface()) { autowiringValue = Proxy.newProxyInstance(requiredType.getClassLoader(), new Class[] {requiredType}, new ObjectFactoryDelegatingInvocationHandler(factory)); @@ -155,9 +155,9 @@ public static Object resolveAutowiringValue(Object autowiringValue, Class requir */ private static class ObjectFactoryDelegatingInvocationHandler implements InvocationHandler, Serializable { - private final ObjectFactory objectFactory; + private final ObjectFactory objectFactory; - public ObjectFactoryDelegatingInvocationHandler(ObjectFactory objectFactory) { + public ObjectFactoryDelegatingInvocationHandler(ObjectFactory objectFactory) { this.objectFactory = objectFactory; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java index 3b338d5b27b8..47fc6f0275b7 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ * @author Juergen Hoeller * @since 2.0 */ -public class BeanDefinitionBuilder { +public class BeanDefinitionBuilder { /** * Create a new BeanDefinitionBuilder used to construct a {@link GenericBeanDefinition}. @@ -45,7 +45,7 @@ public static BeanDefinitionBuilder genericBeanDefinition() { * Create a new BeanDefinitionBuilder used to construct a {@link GenericBeanDefinition}. * @param beanClass the Class of the bean that the definition is being created for */ - public static BeanDefinitionBuilder genericBeanDefinition(Class beanClass) { + public static BeanDefinitionBuilder genericBeanDefinition(Class beanClass) { BeanDefinitionBuilder builder = new BeanDefinitionBuilder(); builder.beanDefinition = new GenericBeanDefinition(); builder.beanDefinition.setBeanClass(beanClass); @@ -67,7 +67,7 @@ public static BeanDefinitionBuilder genericBeanDefinition(String beanClassName) * Create a new BeanDefinitionBuilder used to construct a {@link RootBeanDefinition}. * @param beanClass the Class of the bean that the definition is being created for */ - public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass) { + public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass) { return rootBeanDefinition(beanClass, null); } @@ -76,7 +76,7 @@ public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass) { * @param beanClass the Class of the bean that the definition is being created for * @param factoryMethodName the name of the method to use to construct the bean instance */ - public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass, String factoryMethodName) { + public static BeanDefinitionBuilder rootBeanDefinition(Class beanClass, String factoryMethodName) { BeanDefinitionBuilder builder = new BeanDefinitionBuilder(); builder.beanDefinition = new RootBeanDefinition(); builder.beanDefinition.setBeanClass(beanClass); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java index 382cc32069e1..00d5c0bbc0f4 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java @@ -20,7 +20,7 @@ /** * A simple holder for BeanDefinition property defaults. - * + * * @author Mark Fisher * @since 2.5 */ diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java index e5fb9c6afbe7..330b699096bf 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ public String getDescription() { @Override public boolean equals(Object obj) { return (obj == this || - (obj instanceof BeanDefinitionResource && + (obj instanceof BeanDefinitionResource && ((BeanDefinitionResource) obj).beanDefinition.equals(this.beanDefinition))); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java index d794b3a4efb0..011a7bb05e63 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionValueResolver.java @@ -128,7 +128,7 @@ else if (value instanceof BeanDefinition) { else if (value instanceof ManagedArray) { // May need to resolve contained runtime references. ManagedArray array = (ManagedArray) value; - Class elementType = array.resolvedElementType; + Class elementType = array.resolvedElementType; if (elementType == null) { String elementTypeName = array.getElementTypeName(); if (StringUtils.hasText(elementTypeName)) { @@ -164,7 +164,7 @@ else if (value instanceof ManagedMap) { else if (value instanceof ManagedProperties) { Properties original = (Properties) value; Properties copy = new Properties(); - for (Map.Entry propEntry : original.entrySet()) { + for (Map.Entry propEntry : original.entrySet()) { Object propKey = propEntry.getKey(); Object propValue = propEntry.getValue(); if (propKey instanceof TypedStringValue) { @@ -272,7 +272,7 @@ private Object resolveInnerBean(Object argName, String innerBeanName, BeanDefini this.beanFactory.registerContainedBean(actualInnerBeanName, this.beanName); if (innerBean instanceof FactoryBean) { boolean synthetic = (mbd != null && mbd.isSynthetic()); - return this.beanFactory.getObjectFromFactoryBean((FactoryBean) innerBean, actualInnerBeanName, !synthetic); + return this.beanFactory.getObjectFromFactoryBean((FactoryBean) innerBean, actualInnerBeanName, !synthetic); } else { return innerBean; @@ -335,11 +335,11 @@ private Object resolveReference(Object argName, RuntimeBeanReference ref) { /** * For each element in the managed array, resolve reference if necessary. */ - private Object resolveManagedArray(Object argName, List ml, Class elementType) { + private Object resolveManagedArray(Object argName, List ml, Class elementType) { Object resolved = Array.newInstance(elementType, ml.size()); for (int i = 0; i < ml.size(); i++) { Array.set(resolved, i, - resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i))); + resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i))); } return resolved; } @@ -347,11 +347,11 @@ private Object resolveManagedArray(Object argName, List ml, Class elementType /** * For each element in the managed list, resolve reference if necessary. */ - private List resolveManagedList(Object argName, List ml) { + private List resolveManagedList(Object argName, List ml) { List resolved = new ArrayList(ml.size()); for (int i = 0; i < ml.size(); i++) { resolved.add( - resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i))); + resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i))); } return resolved; } @@ -359,7 +359,7 @@ private List resolveManagedList(Object argName, List ml) { /** * For each element in the managed set, resolve reference if necessary. */ - private Set resolveManagedSet(Object argName, Set ms) { + private Set resolveManagedSet(Object argName, Set ms) { Set resolved = new LinkedHashSet(ms.size()); int i = 0; for (Object m : ms) { @@ -372,9 +372,9 @@ private Set resolveManagedSet(Object argName, Set ms) { /** * For each element in the managed map, resolve reference if necessary. */ - private Map resolveManagedMap(Object argName, Map mm) { + private Map resolveManagedMap(Object argName, Map mm) { Map resolved = new LinkedHashMap(mm.size()); - for (Map.Entry entry : mm.entrySet()) { + for (Map.Entry entry : mm.entrySet()) { Object resolvedKey = resolveValueIfNecessary(argName, entry.getKey()); Object resolvedValue = resolveValueIfNecessary( new KeyedArgName(argName, entry.getKey()), entry.getValue()); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java index 2d3ce41f37d5..98a1a75efbc8 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java @@ -53,7 +53,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt * be overridden to provide method lookup. */ private static final int LOOKUP_OVERRIDE = 1; - + /** * Index in the CGLIB callback array for a method that should * be overridden using generic Methodreplacer functionality. @@ -72,7 +72,7 @@ protected Object instantiateWithMethodInjection( @Override protected Object instantiateWithMethodInjection( RootBeanDefinition beanDefinition, String beanName, BeanFactory owner, - Constructor ctor, Object[] args) { + Constructor ctor, Object[] args) { return new CglibSubclassCreator(beanDefinition, owner).instantiate(ctor, args); } @@ -104,7 +104,7 @@ public CglibSubclassCreator(RootBeanDefinition beanDefinition, BeanFactory owner * Ignored if the ctor parameter is null. * @return new instance of the dynamically generated class */ - public Object instantiate(Constructor ctor, Object[] args) { + public Object instantiate(Constructor ctor, Object[] args) { Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(this.beanDefinition.getBeanClass()); enhancer.setCallbackFilter(new CallbackFilterImpl()); @@ -114,8 +114,8 @@ public Object instantiate(Constructor ctor, Object[] args) { new ReplaceOverrideMethodInterceptor() }); - return (ctor == null) ? - enhancer.create() : + return (ctor == null) ? + enhancer.create() : enhancer.create(ctor.getParameterTypes(), args); } @@ -123,7 +123,7 @@ public Object instantiate(Constructor ctor, Object[] args) { /** * Class providing hashCode and equals methods required by CGLIB to * ensure that CGLIB doesn't generate a distinct class per bean. - * Identity is based on class and bean definition. + * Identity is based on class and bean definition. */ private class CglibIdentitySupport { @@ -157,7 +157,7 @@ public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp // Cast is safe, as CallbackFilter filters are used selectively. LookupOverride lo = (LookupOverride) beanDefinition.getMethodOverrides().getOverride(method); return owner.getBean(lo.getBeanName()); - } + } } @@ -180,7 +180,7 @@ public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp * CGLIB object to filter method interception behavior. */ private class CallbackFilterImpl extends CglibIdentitySupport implements CallbackFilter { - + public int accept(Method method) { MethodOverride methodOverride = beanDefinition.getMethodOverrides().getOverride(method); if (logger.isTraceEnabled()) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ChildBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ChildBeanDefinition.java index 6effd4031e08..29408ab935be 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ChildBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ChildBeanDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,7 +97,7 @@ public ChildBeanDefinition( * @param pvs the property values to apply */ public ChildBeanDefinition( - String parentName, Class beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) { + String parentName, Class beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) { super(cargs, pvs); this.parentName = parentName; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java index 3a769c85d279..d0c721343b71 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,12 +103,12 @@ public ConstructorResolver(AbstractAutowireCapableBeanFactory beanFactory) { * @return a BeanWrapper for the new instance */ public BeanWrapper autowireConstructor( - final String beanName, final RootBeanDefinition mbd, Constructor[] chosenCtors, final Object[] explicitArgs) { + final String beanName, final RootBeanDefinition mbd, Constructor[] chosenCtors, final Object[] explicitArgs) { BeanWrapperImpl bw = new BeanWrapperImpl(); this.beanFactory.initBeanWrapper(bw); - Constructor constructorToUse = null; + Constructor constructorToUse = null; ArgumentsHolder argsHolderToUse = null; Object[] argsToUse = null; @@ -118,7 +118,7 @@ public BeanWrapper autowireConstructor( else { Object[] argsToResolve = null; synchronized (mbd.constructorArgumentLock) { - constructorToUse = (Constructor) mbd.resolvedConstructorOrFactoryMethod; + constructorToUse = (Constructor) mbd.resolvedConstructorOrFactoryMethod; if (constructorToUse != null && mbd.constructorArgumentsResolved) { // Found a cached constructor... argsToUse = mbd.resolvedConstructorArguments; @@ -149,9 +149,9 @@ public BeanWrapper autowireConstructor( } // Take specified constructors, if any. - Constructor[] candidates = chosenCtors; + Constructor[] candidates = chosenCtors; if (candidates == null) { - Class beanClass = mbd.getBeanClass(); + Class beanClass = mbd.getBeanClass(); try { candidates = (mbd.isNonPublicAccessAllowed() ? beanClass.getDeclaredConstructors() : beanClass.getConstructors()); @@ -164,12 +164,12 @@ public BeanWrapper autowireConstructor( } AutowireUtils.sortConstructors(candidates); int minTypeDiffWeight = Integer.MAX_VALUE; - Set ambiguousConstructors = null; + Set> ambiguousConstructors = null; List causes = null; for (int i = 0; i < candidates.length; i++) { Constructor candidate = candidates[i]; - Class[] paramTypes = candidate.getParameterTypes(); + Class[] paramTypes = candidate.getParameterTypes(); if (constructorToUse != null && argsToUse.length > paramTypes.length) { // Already found greedy constructor that can be satisfied -> @@ -239,7 +239,7 @@ public BeanWrapper autowireConstructor( } else if (constructorToUse != null && typeDiffWeight == minTypeDiffWeight) { if (ambiguousConstructors == null) { - ambiguousConstructors = new LinkedHashSet(); + ambiguousConstructors = new LinkedHashSet>(); ambiguousConstructors.add(constructorToUse); } ambiguousConstructors.add(candidate); @@ -267,7 +267,7 @@ else if (ambiguousConstructors != null && !mbd.isLenientConstructorResolution()) Object beanInstance; if (System.getSecurityManager() != null) { - final Constructor ctorToUse = constructorToUse; + final Constructor ctorToUse = constructorToUse; final Object[] argumentsToUse = argsToUse; beanInstance = AccessController.doPrivileged(new PrivilegedAction() { public Object run() { @@ -280,7 +280,7 @@ public Object run() { beanInstance = this.beanFactory.getInstantiationStrategy().instantiate( mbd, beanName, this.beanFactory, constructorToUse, argsToUse); } - + bw.setWrappedInstance(beanInstance); return bw; } @@ -295,7 +295,7 @@ public Object run() { * @param mbd the bean definition to check */ public void resolveFactoryMethodIfPossible(RootBeanDefinition mbd) { - Class factoryClass; + Class factoryClass; if (mbd.getFactoryBeanName() != null) { factoryClass = this.beanFactory.getType(mbd.getFactoryBeanName()); } @@ -341,7 +341,7 @@ public BeanWrapper instantiateUsingFactoryMethod(final String beanName, final Ro this.beanFactory.initBeanWrapper(bw); Object factoryBean; - Class factoryClass; + Class factoryClass; boolean isStatic; String factoryBeanName = mbd.getFactoryBeanName(); @@ -399,7 +399,7 @@ public BeanWrapper instantiateUsingFactoryMethod(final String beanName, final Ro factoryClass = ClassUtils.getUserClass(factoryClass); Method[] rawCandidates; - final Class factoryClazz = factoryClass; + final Class factoryClazz = factoryClass; if (System.getSecurityManager() != null) { rawCandidates = AccessController.doPrivileged(new PrivilegedAction() { public Method[] run() { @@ -412,7 +412,7 @@ public Method[] run() { rawCandidates = (mbd.isNonPublicAccessAllowed() ? ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods()); } - + List candidateSet = new ArrayList(); for (Method candidate : rawCandidates) { if (Modifier.isStatic(candidate.getModifiers()) == isStatic && @@ -445,7 +445,7 @@ public Method[] run() { for (int i = 0; i < candidates.length; i++) { Method candidate = candidates[i]; - Class[] paramTypes = candidate.getParameterTypes(); + Class[] paramTypes = candidate.getParameterTypes(); if (paramTypes.length >= minNrOfArgs) { ArgumentsHolder argsHolder; @@ -570,7 +570,7 @@ public Object run() { beanInstance = beanFactory.getInstantiationStrategy().instantiate( mbd, beanName, beanFactory, factoryBean, factoryMethodToUse, argsToUse); } - + if (beanInstance == null) { return null; } @@ -644,7 +644,7 @@ private int resolveConstructorArguments( */ private ArgumentsHolder createArgumentArray( String beanName, RootBeanDefinition mbd, ConstructorArgumentValues resolvedValues, - BeanWrapper bw, Class[] paramTypes, String[] paramNames, Object methodOrCtor, + BeanWrapper bw, Class[] paramTypes, String[] paramNames, Object methodOrCtor, boolean autowiring) throws UnsatisfiedDependencyException { String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method"); @@ -750,8 +750,8 @@ private ArgumentsHolder createArgumentArray( private Object[] resolvePreparedArguments( String beanName, RootBeanDefinition mbd, BeanWrapper bw, Member methodOrCtor, Object[] argsToResolve) { - Class[] paramTypes = (methodOrCtor instanceof Method ? - ((Method) methodOrCtor).getParameterTypes() : ((Constructor) methodOrCtor).getParameterTypes()); + Class[] paramTypes = (methodOrCtor instanceof Method ? + ((Method) methodOrCtor).getParameterTypes() : ((Constructor) methodOrCtor).getParameterTypes()); TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ? this.beanFactory.getCustomTypeConverter() : bw); BeanDefinitionValueResolver valueResolver = @@ -822,7 +822,7 @@ public ArgumentsHolder(Object[] args) { this.preparedArguments = args; } - public int getTypeDifferenceWeight(Class[] paramTypes) { + public int getTypeDifferenceWeight(Class[] paramTypes) { // If valid arguments found, determine type difference weight. // Try type difference weight on both the converted arguments and // the raw arguments. If the raw weight is better, use it. @@ -832,7 +832,7 @@ public int getTypeDifferenceWeight(Class[] paramTypes) { return (rawTypeDiffWeight < typeDiffWeight ? rawTypeDiffWeight : typeDiffWeight); } - public int getAssignabilityWeight(Class[] paramTypes) { + public int getAssignabilityWeight(Class[] paramTypes) { for (int i = 0; i < paramTypes.length; i++) { if (!ClassUtils.isAssignableValue(paramTypes[i], this.arguments[i])) { return Integer.MAX_VALUE; @@ -888,4 +888,4 @@ public static String[] evaluateAnnotation(Constructor candidate, int paramCou } } } -} \ No newline at end of file +} diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index 3dfa8e893e4d..669a00dba3b1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -127,7 +127,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto private AutowireCandidateResolver autowireCandidateResolver = new SimpleAutowireCandidateResolver(); /** Map from dependency type to corresponding autowired value */ - private final Map, Object> resolvableDependencies = new HashMap, Object>(16); + private final Map, Object> resolvableDependencies = new HashMap, Object>(); /** Map of bean definition objects, keyed by bean name */ private final Map beanDefinitionMap = new ConcurrentHashMap(64); @@ -304,21 +304,6 @@ public String[] getBeanNamesForType(Class type) { } public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean allowEagerInit) { - if (!isConfigurationFrozen() || type == null || !allowEagerInit) { - return doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit); - } - Map, String[]> cache = includeNonSingletons ? - this.nonSingletonBeanNamesByType : this.singletonBeanNamesByType; - String[] resolvedBeanNames = cache.get(type); - if (resolvedBeanNames != null) { - return resolvedBeanNames; - } - resolvedBeanNames = doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit); - cache.put(type, resolvedBeanNames); - return resolvedBeanNames; - } - - private String[] doGetBeanNamesForType(Class type, boolean includeNonSingletons, boolean allowEagerInit) { List result = new ArrayList(); // Check all bean definitions. @@ -580,20 +565,27 @@ public void preInstantiateSingletons() throws BeansException { synchronized (this.beanDefinitionMap) { // Iterate over a copy to allow for init methods which in turn register new bean definitions. // While this may not be part of the regular factory bootstrap, it does otherwise work fine. - beanNames = new ArrayList(this.beanDefinitionNames); - } - for (String beanName : beanNames) { - RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName); - if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) { - if (isFactoryBean(beanName)) { - final FactoryBean factory = (FactoryBean) getBean(FACTORY_BEAN_PREFIX + beanName); - boolean isEagerInit; - if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) { - isEagerInit = AccessController.doPrivileged(new PrivilegedAction() { - public Boolean run() { - return ((SmartFactoryBean) factory).isEagerInit(); - } - }, getAccessControlContext()); + List beanNames = new ArrayList(this.beanDefinitionNames); + for (String beanName : beanNames) { + RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName); + if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) { + if (isFactoryBean(beanName)) { + final FactoryBean factory = (FactoryBean) getBean(FACTORY_BEAN_PREFIX + beanName); + boolean isEagerInit; + if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) { + isEagerInit = AccessController.doPrivileged(new PrivilegedAction() { + public Boolean run() { + return ((SmartFactoryBean) factory).isEagerInit(); + } + }, getAccessControlContext()); + } + else { + isEagerInit = (factory instanceof SmartFactoryBean && + ((SmartFactoryBean) factory).isEagerInit()); + } + if (isEagerInit) { + getBean(beanName); + } } else { isEagerInit = (factory instanceof SmartFactoryBean && @@ -717,7 +709,7 @@ protected boolean allowAliasOverriding() { //--------------------------------------------------------------------- public Object resolveDependency(DependencyDescriptor descriptor, String beanName, - Set autowiredBeanNames, TypeConverter typeConverter) throws BeansException { + Set autowiredBeanNames, TypeConverter typeConverter) throws BeansException { descriptor.initParameterNameDiscovery(getParameterNameDiscoverer()); if (descriptor.getDependencyType().equals(ObjectFactory.class)) { @@ -732,7 +724,7 @@ else if (descriptor.getDependencyType().equals(javaxInjectProviderClass)) { } protected Object doResolveDependency(DependencyDescriptor descriptor, Class type, String beanName, - Set autowiredBeanNames, TypeConverter typeConverter) throws BeansException { + Set autowiredBeanNames, TypeConverter typeConverter) throws BeansException { Object value = getAutowireCandidateResolver().getSuggestedValue(descriptor); if (value != null) { @@ -1020,7 +1012,6 @@ private Object readResolve() { /** * Serializable ObjectFactory for lazy resolution of a dependency. */ - @SuppressWarnings("serial") private class DependencyObjectFactory implements ObjectFactory, Serializable { private final DependencyDescriptor descriptor; @@ -1042,7 +1033,6 @@ public Object getObject() throws BeansException { /** * Serializable ObjectFactory for lazy resolution of a dependency. */ - @SuppressWarnings("serial") private class DependencyProvider extends DependencyObjectFactory implements Provider { public DependencyProvider(DependencyDescriptor descriptor, String beanName) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java index 64346bd9f2c4..203e3847ca4e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java @@ -84,7 +84,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements private final Map singletonObjects = new ConcurrentHashMap(64); /** Cache of singleton factories: bean name --> ObjectFactory */ - private final Map singletonFactories = new HashMap(16); + private final Map> singletonFactories = new HashMap>(); /** Cache of early singleton objects: bean name --> bean instance */ private final Map earlySingletonObjects = new HashMap(16); @@ -152,7 +152,7 @@ protected void addSingleton(String beanName, Object singletonObject) { * @param beanName the name of the bean * @param singletonFactory the factory for the singleton object */ - protected void addSingletonFactory(String beanName, ObjectFactory singletonFactory) { + protected void addSingletonFactory(String beanName, ObjectFactory singletonFactory) { Assert.notNull(singletonFactory, "Singleton factory must not be null"); synchronized (this.singletonObjects) { if (!this.singletonObjects.containsKey(beanName)) { @@ -181,7 +181,7 @@ protected Object getSingleton(String beanName, boolean allowEarlyReference) { synchronized (this.singletonObjects) { singletonObject = this.earlySingletonObjects.get(beanName); if (singletonObject == null && allowEarlyReference) { - ObjectFactory singletonFactory = this.singletonFactories.get(beanName); + ObjectFactory singletonFactory = this.singletonFactories.get(beanName); if (singletonFactory != null) { singletonObject = singletonFactory.getObject(); this.earlySingletonObjects.put(beanName, singletonObject); @@ -201,7 +201,7 @@ protected Object getSingleton(String beanName, boolean allowEarlyReference) { * with, if necessary * @return the registered singleton object */ - public Object getSingleton(String beanName, ObjectFactory singletonFactory) { + public Object getSingleton(String beanName, ObjectFactory singletonFactory) { Assert.notNull(beanName, "'beanName' must not be null"); synchronized (this.singletonObjects) { Object singletonObject = this.singletonObjects.get(beanName); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java index 9517497ac9b6..3736b951523a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java @@ -52,11 +52,11 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg * @return the FactoryBean's object type, * or null if the type cannot be determined yet */ - protected Class getTypeForFactoryBean(final FactoryBean factoryBean) { + protected Class getTypeForFactoryBean(final FactoryBean factoryBean) { try { if (System.getSecurityManager() != null) { - return AccessController.doPrivileged(new PrivilegedAction() { - public Class run() { + return AccessController.doPrivileged(new PrivilegedAction>() { + public Class run() { return factoryBean.getObjectType(); } }, getAccessControlContext()); @@ -94,7 +94,7 @@ protected Object getCachedObjectForFactoryBean(String beanName) { * @throws BeanCreationException if FactoryBean object creation failed * @see org.springframework.beans.factory.FactoryBean#getObject() */ - protected Object getObjectFromFactoryBean(FactoryBean factory, String beanName, boolean shouldPostProcess) { + protected Object getObjectFromFactoryBean(FactoryBean factory, String beanName, boolean shouldPostProcess) { if (factory.isSingleton() && containsSingleton(beanName)) { synchronized (getSingletonMutex()) { Object object = this.factoryBeanObjectCache.get(beanName); @@ -120,7 +120,7 @@ protected Object getObjectFromFactoryBean(FactoryBean factory, String beanName, * @see org.springframework.beans.factory.FactoryBean#getObject() */ private Object doGetObjectFromFactoryBean( - final FactoryBean factory, final String beanName, final boolean shouldPostProcess) + final FactoryBean factory, final String beanName, final boolean shouldPostProcess) throws BeanCreationException { Object object; @@ -149,7 +149,7 @@ public Object run() throws Exception { throw new BeanCreationException(beanName, "FactoryBean threw exception on object creation", ex); } - + // Do not accept a null value for a FactoryBean that's not fully // initialized yet: Many FactoryBeans just return null then. if (object == null && isSingletonCurrentlyInCreation(beanName)) { @@ -190,12 +190,12 @@ protected Object postProcessObjectFromFactoryBean(Object object, String beanName * @return the bean instance as FactoryBean * @throws BeansException if the given bean cannot be exposed as a FactoryBean */ - protected FactoryBean getFactoryBean(String beanName, Object beanInstance) throws BeansException { + protected FactoryBean getFactoryBean(String beanName, Object beanInstance) throws BeansException { if (!(beanInstance instanceof FactoryBean)) { throw new BeanCreationException(beanName, "Bean instance of type [" + beanInstance.getClass() + "] is not a FactoryBean"); } - return (FactoryBean) beanInstance; + return (FactoryBean) beanInstance; } /** @@ -206,7 +206,7 @@ protected void removeSingleton(String beanName) { super.removeSingleton(beanName); this.factoryBeanObjectCache.remove(beanName); } - + /** * Returns the security context for this bean factory. If a security manager * is set, interaction with the user code will be executed using the privileged diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/LookupOverride.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/LookupOverride.java index 2a34093cf6ae..9c1e9292e298 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/LookupOverride.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/LookupOverride.java @@ -31,7 +31,7 @@ * @since 1.1 */ public class LookupOverride extends MethodOverride { - + private final String beanName; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedArray.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedArray.java index 2be0e4152d87..87ba5c351eea 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedArray.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedArray.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public class ManagedArray extends ManagedList { /** Resolved element type for runtime creation of the target array */ - volatile Class resolvedElementType; + volatile Class resolvedElementType; /** diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedList.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedList.java index 682e2a954872..143c1ca7742a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedList.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedList.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ public List merge(Object parent) { throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]"); } List merged = new ManagedList(); - merged.addAll((List) parent); + merged.addAll((List) parent); merged.addAll(this); return merged; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedMap.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedMap.java index ccf1e1641d9b..6e078f361da5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedMap.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,7 +113,7 @@ public Object merge(Object parent) { throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]"); } Map merged = new ManagedMap(); - merged.putAll((Map) parent); + merged.putAll((Map) parent); merged.putAll(this); return merged; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java index 70f53f05a8d1..48ff53dee7ac 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,7 +97,7 @@ public Set merge(Object parent) { throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]"); } Set merged = new ManagedSet(); - merged.addAll((Set) parent); + merged.addAll((Set) parent); merged.addAll(this); return merged; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java index a2b85bb2fe74..af32ccb07529 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverride.java @@ -34,7 +34,7 @@ * @since 1.1 */ public abstract class MethodOverride implements BeanMetadataElement { - + private final String methodName; private boolean overloaded = true; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverrides.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverrides.java index c8ba6e4b0705..72dd7fd4ca7e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverrides.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverrides.java @@ -82,7 +82,7 @@ public Set getOverrides() { public boolean isEmpty() { return this.overrides.isEmpty(); } - + /** * Return the override for the given method, if any. * @param method method to check for overrides for diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodReplacer.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodReplacer.java index 7e04f826d6b3..0fa1b59046f4 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodReplacer.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/MethodReplacer.java @@ -30,7 +30,7 @@ * @since 1.1 */ public interface MethodReplacer { - + /** * Reimplement the given method. * @param obj the instance we're reimplementing the method for diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java index 71b673c8d8e7..7667d48a2ce3 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ * ceo.$0(ref)=secretary // inject 'secretary' bean as 0th constructor arg * ceo.$1=1000000 // inject value '1000000' at 1st constructor arg * - * + * * @author Rod Johnson * @author Juergen Hoeller * @author Rob Harrop @@ -289,9 +289,9 @@ public int registerBeanDefinitions(ResourceBundle rb) throws BeanDefinitionStore public int registerBeanDefinitions(ResourceBundle rb, String prefix) throws BeanDefinitionStoreException { // Simply create a map and call overloaded method. Map map = new HashMap(); - Enumeration keys = rb.getKeys(); + Enumeration keys = rb.getKeys(); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); map.put(key, rb.getObject(key)); } return registerBeanDefinitions(map, prefix); @@ -308,7 +308,7 @@ public int registerBeanDefinitions(ResourceBundle rb, String prefix) throws Bean * @throws BeansException in case of loading or parsing errors * @see #registerBeanDefinitions(java.util.Map, String, String) */ - public int registerBeanDefinitions(Map map) throws BeansException { + public int registerBeanDefinitions(Map map) throws BeansException { return registerBeanDefinitions(map, null); } @@ -323,7 +323,7 @@ public int registerBeanDefinitions(Map map) throws BeansException { * @return the number of bean definitions found * @throws BeansException in case of loading or parsing errors */ - public int registerBeanDefinitions(Map map, String prefix) throws BeansException { + public int registerBeanDefinitions(Map map, String prefix) throws BeansException { return registerBeanDefinitions(map, prefix, "Map " + map); } @@ -341,7 +341,7 @@ public int registerBeanDefinitions(Map map, String prefix) throws BeansException * @throws BeansException in case of loading or parsing errors * @see #registerBeanDefinitions(Map, String) */ - public int registerBeanDefinitions(Map map, String prefix, String resourceDescription) + public int registerBeanDefinitions(Map map, String prefix, String resourceDescription) throws BeansException { if (prefix == null) { @@ -412,7 +412,7 @@ protected void registerBeanDefinition(String beanName, Map map, String pre ConstructorArgumentValues cas = new ConstructorArgumentValues(); MutablePropertyValues pvs = new MutablePropertyValues(); - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { String key = StringUtils.trimWhitespace((String) entry.getKey()); if (key.startsWith(prefix + SEPARATOR)) { String property = key.substring(prefix.length() + SEPARATOR.length()); @@ -501,7 +501,7 @@ else if (property.endsWith(REF_SUFFIX)) { * Reads the value of the entry. Correctly interprets bean references for * values that are prefixed with an asterisk. */ - private Object readValue(Map.Entry entry) { + private Object readValue(Map.Entry entry) { Object val = entry.getValue(); if (val instanceof String) { String strVal = (String) val; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java index 3faa967b2b99..261ccc041635 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/ReplaceOverride.java @@ -76,12 +76,12 @@ public boolean matches(Method method) { // It can't match. return false; } - + if (!isOverloaded()) { // No overloaded: don't worry about arg type matching. return true; } - + // If we get to here, we need to insist on precise argument matching. if (this.typeIdentifiers.size() != method.getParameterTypes().length) { return false; @@ -93,7 +93,7 @@ public boolean matches(Method method) { return false; } } - return true; + return true; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java index aaa65972758f..41ee250a87b7 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java @@ -104,7 +104,7 @@ public RootBeanDefinition() { * Create a new RootBeanDefinition for a singleton. * @param beanClass the class of the bean to instantiate */ - public RootBeanDefinition(Class beanClass) { + public RootBeanDefinition(Class beanClass) { super(); setBeanClass(beanClass); } @@ -116,7 +116,7 @@ public RootBeanDefinition(Class beanClass) { * @deprecated since Spring 2.5, in favor of {@link #setScope} */ @Deprecated - public RootBeanDefinition(Class beanClass, boolean singleton) { + public RootBeanDefinition(Class beanClass, boolean singleton) { super(); setBeanClass(beanClass); setSingleton(singleton); @@ -130,7 +130,7 @@ public RootBeanDefinition(Class beanClass, boolean singleton) { * @deprecated as of Spring 3.0, in favor of {@link #setAutowireMode} usage */ @Deprecated - public RootBeanDefinition(Class beanClass, int autowireMode) { + public RootBeanDefinition(Class beanClass, int autowireMode) { super(); setBeanClass(beanClass); setAutowireMode(autowireMode); @@ -144,7 +144,7 @@ public RootBeanDefinition(Class beanClass, int autowireMode) { * @param dependencyCheck whether to perform a dependency check for objects * (not applicable to autowiring a constructor, thus ignored there) */ - public RootBeanDefinition(Class beanClass, int autowireMode, boolean dependencyCheck) { + public RootBeanDefinition(Class beanClass, int autowireMode, boolean dependencyCheck) { super(); setBeanClass(beanClass); setAutowireMode(autowireMode); @@ -158,10 +158,10 @@ public RootBeanDefinition(Class beanClass, int autowireMode, boolean dependencyC * providing property values. * @param beanClass the class of the bean to instantiate * @param pvs the property values to apply - * @deprecated as of Spring 3.0, in favor of {@link #getPropertyValues} usage + * @deprecated as of Spring 3.0, in favor of {@link #setPropertyValues} usage */ @Deprecated - public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs) { + public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs) { super(null, pvs); setBeanClass(beanClass); } @@ -175,7 +175,7 @@ public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs) { * @deprecated since Spring 2.5, in favor of {@link #setScope} */ @Deprecated - public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs, boolean singleton) { + public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs, boolean singleton) { super(null, pvs); setBeanClass(beanClass); setSingleton(singleton); @@ -188,7 +188,7 @@ public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs, boolean si * @param cargs the constructor argument values to apply * @param pvs the property values to apply */ - public RootBeanDefinition(Class beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) { + public RootBeanDefinition(Class beanClass, ConstructorArgumentValues cargs, MutablePropertyValues pvs) { super(cargs, pvs); setBeanClass(beanClass); } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/SecurityContextProvider.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/SecurityContextProvider.java index 0403b8900f05..6efe58e1e1fe 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/SecurityContextProvider.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/SecurityContextProvider.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java index b06904221f1e..0312f42b4d63 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleInstantiationStrategy.java @@ -62,14 +62,14 @@ public Object instantiate(RootBeanDefinition beanDefinition, String beanName, Be synchronized (beanDefinition.constructorArgumentLock) { constructorToUse = (Constructor) beanDefinition.resolvedConstructorOrFactoryMethod; if (constructorToUse == null) { - final Class clazz = beanDefinition.getBeanClass(); + final Class clazz = beanDefinition.getBeanClass(); if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "Specified class is an interface"); } try { if (System.getSecurityManager() != null) { - constructorToUse = AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Constructor run() throws Exception { + constructorToUse = AccessController.doPrivileged(new PrivilegedExceptionAction>() { + public Constructor run() throws Exception { return clazz.getDeclaredConstructor((Class[]) null); } }); @@ -132,7 +132,7 @@ public Object run() { * Instantiation should use the given constructor and parameters. */ protected Object instantiateWithMethodInjection(RootBeanDefinition beanDefinition, - String beanName, BeanFactory owner, Constructor ctor, Object[] args) { + String beanName, BeanFactory owner, Constructor ctor, Object[] args) { throw new UnsupportedOperationException( "Method Injection not supported in SimpleInstantiationStrategy"); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleSecurityContextProvider.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleSecurityContextProvider.java index 78b62938da57..dbc12b05fcad 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleSecurityContextProvider.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/SimpleSecurityContextProvider.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +21,7 @@ /** * Simple {@link SecurityContextProvider} implementation. - * + * * @author Costin Leau * @since 3.0 */ diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java index 3e8784b18176..e62b3d9c276c 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ public Object getBean(String name) throws BeansException { if (bean instanceof FactoryBean && !BeanFactoryUtils.isFactoryDereference(name)) { try { - return ((FactoryBean) bean).getObject(); + return ((FactoryBean) bean).getObject(); } catch (Exception ex) { throw new BeanCreationException(beanName, "FactoryBean threw exception on object creation", ex); @@ -137,18 +137,18 @@ public boolean containsBean(String name) { public boolean isSingleton(String name) throws NoSuchBeanDefinitionException { Object bean = getBean(name); // In case of FactoryBean, return singleton status of created object. - return (bean instanceof FactoryBean && ((FactoryBean) bean).isSingleton()); + return (bean instanceof FactoryBean && ((FactoryBean) bean).isSingleton()); } public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { Object bean = getBean(name); // In case of FactoryBean, return prototype status of created object. - return ((bean instanceof SmartFactoryBean && ((SmartFactoryBean) bean).isPrototype()) || - (bean instanceof FactoryBean && !((FactoryBean) bean).isSingleton())); + return ((bean instanceof SmartFactoryBean && ((SmartFactoryBean) bean).isPrototype()) || + (bean instanceof FactoryBean && !((FactoryBean) bean).isSingleton())); } - public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException { - Class type = getType(name); + public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException { + Class type = getType(name); return (targetType == null || (type != null && targetType.isAssignableFrom(type))); } @@ -163,7 +163,7 @@ public Class getType(String name) throws NoSuchBeanDefinitionException { if (bean instanceof FactoryBean && !BeanFactoryUtils.isFactoryDereference(name)) { // If it's a FactoryBean, we want to look at what it creates, not the factory class. - return ((FactoryBean) bean).getObjectType(); + return ((FactoryBean) bean).getObjectType(); } return bean.getClass(); } @@ -189,18 +189,18 @@ public String[] getBeanDefinitionNames() { return StringUtils.toStringArray(this.beans.keySet()); } - public String[] getBeanNamesForType(Class type) { + public String[] getBeanNamesForType(Class type) { return getBeanNamesForType(type, true, true); } - public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean includeFactoryBeans) { + public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean includeFactoryBeans) { boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type)); List matches = new ArrayList(); for (String name : this.beans.keySet()) { Object beanInstance = this.beans.get(name); if (beanInstance instanceof FactoryBean && !isFactoryType) { if (includeFactoryBeans) { - Class objectType = ((FactoryBean) beanInstance).getObjectType(); + Class objectType = ((FactoryBean) beanInstance).getObjectType(); if (objectType != null && (type == null || type.isAssignableFrom(objectType))) { matches.add(name); } @@ -233,8 +233,8 @@ public Map getBeansOfType(Class type, boolean includeNonSingle if (beanInstance instanceof FactoryBean && !isFactoryType) { if (includeFactoryBeans) { // Match object created by FactoryBean. - FactoryBean factory = (FactoryBean) beanInstance; - Class objectType = factory.getObjectType(); + FactoryBean factory = (FactoryBean) beanInstance; + Class objectType = factory.getObjectType(); if ((includeNonSingletons || factory.isSingleton()) && objectType != null && (type == null || type.isAssignableFrom(objectType))) { matches.put(beanName, getBean(beanName, type)); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/package-info.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/package-info.java index 71a483e483f6..2523fc71fd40 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/package-info.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/package-info.java @@ -3,7 +3,7 @@ * * Classes supporting the org.springframework.beans.factory package. * Contains abstract base classes for BeanFactory implementations. - * + * * */ package org.springframework.beans.factory.support; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java b/spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java index 6bc42d013734..003ce318d130 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/wiring/BeanConfigurerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ * @see #setBeanWiringInfoResolver * @see ClassNameBeanWiringInfoResolver */ -public class BeanConfigurerSupport implements BeanFactoryAware, InitializingBean, DisposableBean { +public class BeanConfigurerSupport implements BeanFactoryAware, InitializingBean, DisposableBean { /** Logger available to subclasses */ protected final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java index d624b2331e3a..ce8a97d2189e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,7 +125,7 @@ protected String resolveId(Element element, AbstractBeanDefinition definition, P * parameter is false, because one typically does not want inner beans * to be registered as top level beans. * @param definition the bean definition to be registered - * @param registry the registry that the bean is to be registered with + * @param registry the registry that the bean is to be registered with * @see BeanDefinitionReaderUtils#registerBeanDefinition(BeanDefinitionHolder, BeanDefinitionRegistry) */ protected void registerBeanDefinition(BeanDefinitionHolder definition, BeanDefinitionRegistry registry) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java index 20c96bba6866..e6618a4c6e10 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSimpleBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,11 +40,11 @@ * class immediately clear. Consider the following class definition: * *
    public class SimpleCache implements Cache {
    - * 
    + *
      *     public void setName(String name) {...}
      *     public void setTimeout(int timeout) {...}
      *     public void setEvictionPolicy(EvictionPolicy policy) {...}
    - * 
    + *
      *     // remaining class definition elided for clarity...
      * }
    * @@ -62,7 +62,7 @@ * protected Class getBeanClass(Element element) { * return SimpleCache.class; * } - * } + * } * *

    Please note that the AbstractSimpleBeanDefinitionParser * is limited to populating the created bean definition with property values. @@ -121,7 +121,7 @@ public abstract class AbstractSimpleBeanDefinitionParser extends AbstractSingleB * property. * @param element the XML element being parsed * @param builder used to define the BeanDefinition - * @see #extractPropertyName(String) + * @see #extractPropertyName(String) */ @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSingleBeanDefinitionParser.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSingleBeanDefinitionParser.java index 1c32c4f22de0..db3aa6a5b2e1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSingleBeanDefinitionParser.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/AbstractSingleBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDecorator.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDecorator.java index b1a1d2c9e676..46e7b1f3efed 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDecorator.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java index ec161a06843c..b4d5b4b67b1a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionDocumentReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParser.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParser.java index 2c92ecd47754..a950e363bc8b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParser.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java index 1109ed3b8cd9..dc5b2dc6a1aa 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java @@ -112,6 +112,11 @@ public class BeanDefinitionParserDelegate { public static final String AUTOWIRE_CONSTRUCTOR_VALUE = "constructor"; + /** + * @deprecated as of Spring 3.0: If you are using mixed autowiring strategies, use annotation-based autowiring for + * clearer demarcation of autowiring needs. + */ + @Deprecated public static final String AUTOWIRE_AUTODETECT_VALUE = "autodetect"; public static final String DEPENDENCY_CHECK_ALL_ATTRIBUTE_VALUE = "all"; @@ -714,6 +719,7 @@ public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attribu } } + @SuppressWarnings("deprecation") public int getAutowireMode(String attValue) { String att = attValue; if (DEFAULT_VALUE.equals(att)) { @@ -1192,7 +1198,7 @@ public Object parseArrayElement(Element arrayEle, BeanDefinition bd) { /** * Parse a list element. */ - public List parseListElement(Element collectionEle, BeanDefinition bd) { + public List parseListElement(Element collectionEle, BeanDefinition bd) { String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE); NodeList nl = collectionEle.getChildNodes(); ManagedList target = new ManagedList(nl.getLength()); @@ -1206,7 +1212,7 @@ public List parseListElement(Element collectionEle, BeanDefinition bd) { /** * Parse a set element. */ - public Set parseSetElement(Element collectionEle, BeanDefinition bd) { + public Set parseSetElement(Element collectionEle, BeanDefinition bd) { String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE); NodeList nl = collectionEle.getChildNodes(); ManagedSet target = new ManagedSet(nl.getLength()); @@ -1231,7 +1237,7 @@ protected void parseCollectionElements( /** * Parse a map element. */ - public Map parseMapElement(Element mapEle, BeanDefinition bd) { + public Map parseMapElement(Element mapEle, BeanDefinition bd) { String defaultKeyType = mapEle.getAttribute(KEY_TYPE_ATTRIBUTE); String defaultValueType = mapEle.getAttribute(VALUE_TYPE_ATTRIBUTE); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java index fcf9af900136..d7fcfc9e4d9b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ * @see ResourceEntityResolver */ public class BeansDtdResolver implements EntityResolver { - + private static final String DTD_EXTENSION = ".dtd"; private static final String[] DTD_NAMES = {"spring-beans-2.0", "spring-beans"}; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java index 4bcc94a22a3f..c6565b5b9f4a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -223,7 +223,7 @@ protected void importBeanDefinitionResource(Element ele) { Set actualResources = new LinkedHashSet(4); - // Discover whether the location is an absolute or relative URI + // Discover whether the location is an absolute or relative URI boolean absoluteLocation = false; try { absoluteLocation = ResourcePatternUtils.isUrl(location) || ResourceUtils.toURI(location).isAbsolute(); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java index d057cf7e51aa..f800eba8b11f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DelegatingEntityResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DelegatingEntityResolver.java index cd33ef1476b6..4d8e7b48ef99 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DelegatingEntityResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DelegatingEntityResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ else if (systemId.endsWith(XSD_SUFFIX)) { @Override public String toString() { return "EntityResolver delegating " + XSD_SUFFIX + " to " + this.schemaResolver + - " and " + DTD_SUFFIX + " to " + this.dtdResolver; + " and " + DTD_SUFFIX + " to " + this.dtdResolver; } } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandler.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandler.java index a6553b1ce4bd..76c1bbaa79ab 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandler.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ public interface NamespaceHandler { /** * Invoked by the {@link DefaultBeanDefinitionDocumentReader} after * construction but before any custom elements are parsed. - * @see NamespaceHandlerSupport#registerBeanDefinitionParser(String, BeanDefinitionParser) + * @see NamespaceHandlerSupport#registerBeanDefinitionParser(String, BeanDefinitionParser) */ void init(); @@ -66,7 +66,7 @@ public interface NamespaceHandler { * not be used in a nested scenario. * @param element the element that is to be parsed into one or more BeanDefinitions * @param parserContext the object encapsulating the current state of the parsing process - * @return the primary BeanDefinition (can be null as explained above) + * @return the primary BeanDefinition (can be null as explained above) */ BeanDefinition parse(Element element, ParserContext parserContext); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java index 1ad13daf0916..ae992c27b2c0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java index 63e5a39f2d16..5c684d98da4d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java index a3656ec8bb9a..f5a5119d9023 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java @@ -1,12 +1,12 @@ /* * Copyright 2010 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,24 +33,24 @@ * attributes directly through to bean properties. An important point to note is * that this NamespaceHandler does not have a corresponding schema * since there is no way to know in advance all possible attribute names. - * + * *

    * An example of the usage of this NamespaceHandler is shown below: - * + * *

      * <bean id="author" class="..TestBean" c:name="Enescu" c:work-ref="compositions"/>
      * 
    - * + * * Here the 'c:name' corresponds directly to the 'name * ' argument declared on the constructor of class 'TestBean'. The * 'c:work-ref' attributes corresponds to the 'work' * argument and, rather than being the concrete value, it contains the name of * the bean that will be considered as a parameter. - * + * * Note: This implementation supports only named parameters - there is no * support for indexes or types. Further more, the names are used as hints by * the container which, by default, does type introspection. - * + * * @see SimplePropertyNamespaceHandler * @author Costin Leau */ @@ -90,7 +90,7 @@ public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, if (argName.startsWith(DELIMITER_PREFIX)) { String arg = argName.substring(1).trim(); - // fast default check + // fast default check if (!StringUtils.hasText(arg)) { cvs.addGenericArgumentValue(valueHolder); } @@ -107,13 +107,13 @@ public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, parserContext.getReaderContext().error( "Constructor argument '" + argName + "' specifies a negative index", attr); } - + if (cvs.hasIndexedArgumentValue(index)){ parserContext.getReaderContext().error( "Constructor argument '" + argName + "' with index "+ index+" already defined using ." + " Only one approach may be used per argument.", attr); } - + cvs.addIndexedArgumentValue(index, valueHolder); } } @@ -139,7 +139,7 @@ private boolean containsArgWithName(String name, ConstructorArgumentValues cvs) return true; } - + private boolean checkName(String name, Collection values) { for (ValueHolder holder : values) { if (name.equals(holder.getName())) { @@ -148,4 +148,4 @@ private boolean checkName(String name, Collection values) { } return false; } -} \ No newline at end of file +} diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandler.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandler.java index ee8101b46e5b..da04db0fba5f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandler.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/UtilNamespaceHandler.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/UtilNamespaceHandler.java index 128da8a46fe0..289c921d2c81 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/UtilNamespaceHandler.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/UtilNamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public void init() { private static class ConstantBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return FieldRetrievingFactoryBean.class; } @@ -76,7 +76,7 @@ protected String resolveId(Element element, AbstractBeanDefinition definition, P private static class PropertyPathBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return PropertyPathFactoryBean.class; } @@ -113,14 +113,14 @@ protected String resolveId(Element element, AbstractBeanDefinition definition, P private static class ListBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return ListFactoryBean.class; } @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String listClass = element.getAttribute("list-class"); - List parsedList = parserContext.getDelegate().parseListElement(element, builder.getRawBeanDefinition()); + List parsedList = parserContext.getDelegate().parseListElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceList", parsedList); if (StringUtils.hasText(listClass)) { builder.addPropertyValue("targetListClass", listClass); @@ -136,14 +136,14 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit private static class SetBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return SetFactoryBean.class; } @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String setClass = element.getAttribute("set-class"); - Set parsedSet = parserContext.getDelegate().parseSetElement(element, builder.getRawBeanDefinition()); + Set parsedSet = parserContext.getDelegate().parseSetElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceSet", parsedSet); if (StringUtils.hasText(setClass)) { builder.addPropertyValue("targetSetClass", setClass); @@ -159,14 +159,14 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit private static class MapBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return MapFactoryBean.class; } @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String mapClass = element.getAttribute("map-class"); - Map parsedMap = parserContext.getDelegate().parseMapElement(element, builder.getRawBeanDefinition()); + Map parsedMap = parserContext.getDelegate().parseMapElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceMap", parsedMap); if (StringUtils.hasText(mapClass)) { builder.addPropertyValue("targetMapClass", mapClass); @@ -182,7 +182,7 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit private static class PropertiesBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return PropertiesFactoryBean.class; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java index d858fe4defa2..670f73178b07 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionStoreException.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionStoreException.java index 87c4617c4ded..7b331817aec1 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionStoreException.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionStoreException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/package-info.java b/spring-beans/src/main/java/org/springframework/beans/package-info.java index 1af0af89568a..11d8730cd96f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/package-info.java +++ b/spring-beans/src/main/java/org/springframework/beans/package-info.java @@ -3,10 +3,10 @@ * * This package contains interfaces and classes for manipulating Java beans. * It is used by most other Spring packages. - * + * *

    A BeanWrapper object may be used to set and get bean properties, * singly or in bulk. - * + * *

    The classes in this package are discussed in Chapter 11 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CharacterEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CharacterEditor.java index bf20a7544c15..5cdcb1d50017 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CharacterEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CharacterEditor.java @@ -28,7 +28,7 @@ * {@link java.beans.PropertyEditor property editor} for char! * {@link org.springframework.beans.BeanWrapperImpl} will register this * editor by default. - * + * *

    Also supports conversion from a Unicode character sequence; e.g. * u0041 ('A'). * diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java index 4db48197f8ef..b81809f89611 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public ClassArrayEditor(ClassLoader classLoader) { public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.hasText(text)) { String[] classNames = StringUtils.commaDelimitedListToStringArray(text); - Class[] classes = new Class[classNames.length]; + Class[] classes = new Class[classNames.length]; for (int i = 0; i < classNames.length; i++) { String className = classNames[i].trim(); classes[i] = ClassUtils.resolveClassName(className, this.classLoader); @@ -76,7 +76,7 @@ public void setAsText(String text) throws IllegalArgumentException { @Override public String getAsText() { - Class[] classes = (Class[]) getValue(); + Class[] classes = (Class[]) getValue(); if (ObjectUtils.isEmpty(classes)) { return ""; } diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java index 4f5fffce4669..4f9f720342ba 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ public void setAsText(String text) throws IllegalArgumentException { @Override public String getAsText() { - Class clazz = (Class) getValue(); + Class clazz = (Class) getValue(); if (clazz != null) { return ClassUtils.getQualifiedName(clazz); } diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java index a355ffcb7a66..cec6cddd03fa 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomCollectionEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,8 @@ */ public class CustomCollectionEditor extends PropertyEditorSupport { - private final Class collectionType; + @SuppressWarnings("rawtypes") + private final Class collectionType; private final boolean nullAsEmptyCollection; @@ -57,7 +58,7 @@ public class CustomCollectionEditor extends PropertyEditorSupport { * @see java.util.TreeSet * @see java.util.LinkedHashSet */ - public CustomCollectionEditor(Class collectionType) { + public CustomCollectionEditor(@SuppressWarnings("rawtypes") Class collectionType) { this(collectionType, false); } @@ -79,7 +80,7 @@ public CustomCollectionEditor(Class collectionType) { * @see java.util.TreeSet * @see java.util.LinkedHashSet */ - public CustomCollectionEditor(Class collectionType, boolean nullAsEmptyCollection) { + public CustomCollectionEditor(@SuppressWarnings("rawtypes") Class collectionType, boolean nullAsEmptyCollection) { if (collectionType == null) { throw new IllegalArgumentException("Collection type is required"); } @@ -115,8 +116,8 @@ else if (value == null || (this.collectionType.isInstance(value) && !alwaysCreat } else if (value instanceof Collection) { // Convert Collection elements. - Collection source = (Collection) value; - Collection target = createCollection(this.collectionType, source.size()); + Collection source = (Collection) value; + Collection target = createCollection(this.collectionType, source.size()); for (Object elem : source) { target.add(convertElement(elem)); } @@ -125,7 +126,7 @@ else if (value instanceof Collection) { else if (value.getClass().isArray()) { // Convert array elements to Collection elements. int length = Array.getLength(value); - Collection target = createCollection(this.collectionType, length); + Collection target = createCollection(this.collectionType, length); for (int i = 0; i < length; i++) { target.add(convertElement(Array.get(value, i))); } @@ -133,7 +134,7 @@ else if (value.getClass().isArray()) { } else { // A plain value: convert it to a Collection with a single element. - Collection target = createCollection(this.collectionType, 1); + Collection target = createCollection(this.collectionType, 1); target.add(convertElement(value)); super.setValue(target); } @@ -146,10 +147,11 @@ else if (value.getClass().isArray()) { * @param initialCapacity the initial capacity * @return the new Collection instance */ - protected Collection createCollection(Class collectionType, int initialCapacity) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected > T createCollection(Class collectionType, int initialCapacity) { if (!collectionType.isInterface()) { try { - return (Collection) collectionType.newInstance(); + return collectionType.newInstance(); } catch (Exception ex) { throw new IllegalArgumentException( @@ -157,13 +159,13 @@ protected Collection createCollection(Class collectionType, int initialCapacity) } } else if (List.class.equals(collectionType)) { - return new ArrayList(initialCapacity); + return (T) new ArrayList(initialCapacity); } else if (SortedSet.class.equals(collectionType)) { - return new TreeSet(); + return (T) new TreeSet(); } else { - return new LinkedHashSet(initialCapacity); + return (T) new LinkedHashSet(initialCapacity); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java index d66eca4f17c3..6768ea347237 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomMapEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,8 @@ */ public class CustomMapEditor extends PropertyEditorSupport { - private final Class mapType; + @SuppressWarnings("rawtypes") + private final Class mapType; private final boolean nullAsEmptyMap; @@ -48,7 +49,7 @@ public class CustomMapEditor extends PropertyEditorSupport { * @see java.util.TreeMap * @see java.util.LinkedHashMap */ - public CustomMapEditor(Class mapType) { + public CustomMapEditor(@SuppressWarnings("rawtypes") Class mapType) { this(mapType, false); } @@ -69,7 +70,7 @@ public CustomMapEditor(Class mapType) { * @see java.util.TreeMap * @see java.util.LinkedHashMap */ - public CustomMapEditor(Class mapType, boolean nullAsEmptyMap) { + public CustomMapEditor(@SuppressWarnings("rawtypes") Class mapType, boolean nullAsEmptyMap) { if (mapType == null) { throw new IllegalArgumentException("Map type is required"); } @@ -104,9 +105,9 @@ else if (value == null || (this.mapType.isInstance(value) && !alwaysCreateNewMap } else if (value instanceof Map) { // Convert Map elements. - Map source = (Map) value; - Map target = createMap(this.mapType, source.size()); - for (Map.Entry entry : source.entrySet()) { + Map source = (Map) value; + Map target = createMap(this.mapType, source.size()); + for (Map.Entry entry : source.entrySet()) { target.put(convertKey(entry.getKey()), convertValue(entry.getValue())); } super.setValue(target); @@ -123,10 +124,12 @@ else if (value instanceof Map) { * @param initialCapacity the initial capacity * @return the new Map instance */ - protected Map createMap(Class mapType, int initialCapacity) { + @SuppressWarnings({ "cast", "unchecked" }) + protected Map createMap( + @SuppressWarnings("rawtypes") Class mapType, int initialCapacity) { if (!mapType.isInterface()) { try { - return (Map) mapType.newInstance(); + return (Map) mapType.newInstance(); } catch (Exception ex) { throw new IllegalArgumentException( @@ -134,10 +137,10 @@ protected Map createMap(Class mapType, int initialCapacity) { } } else if (SortedMap.class.equals(mapType)) { - return new TreeMap(); + return new TreeMap(); } else { - return new LinkedHashMap(initialCapacity); + return new LinkedHashMap(initialCapacity); } } diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomNumberEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomNumberEditor.java index b1d960bbfc25..98a8ca055b5f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomNumberEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/CustomNumberEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,8 +85,8 @@ public CustomNumberEditor(Class numberClass, boolean allowEmpt * @see java.text.NumberFormat#parse * @see java.text.NumberFormat#format */ - public CustomNumberEditor(Class numberClass, NumberFormat numberFormat, boolean allowEmpty) - throws IllegalArgumentException { + public CustomNumberEditor(Class numberClass, + NumberFormat numberFormat, boolean allowEmpty) throws IllegalArgumentException { if (numberClass == null || !Number.class.isAssignableFrom(numberClass)) { throw new IllegalArgumentException("Property class must be a subclass of Number"); diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/InputSourceEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/InputSourceEditor.java index 3701b55cc3d2..873971186fdd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/InputSourceEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/InputSourceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/LocaleEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/LocaleEditor.java index 49df57916803..9e0944662c18 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/LocaleEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/LocaleEditor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PropertiesEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PropertiesEditor.java index 7f5f291b70d4..a2b4e7155407 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PropertiesEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PropertiesEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ public void setAsText(String text) throws IllegalArgumentException { public void setValue(Object value) { if (!(value instanceof Properties) && value instanceof Map) { Properties props = new Properties(); - props.putAll((Map) value); + props.putAll((Map) value); super.setValue(props); } else { diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java index 4f0f404d82c1..24467400faca 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,13 +26,13 @@ /** * {@link java.beans.PropertyEditor} implementation for * {@link java.util.ResourceBundle ResourceBundles}. - * + * *

    Only supports conversion from a String, but not * to a String. - * - * Find below some examples of using this class in a + * + * Find below some examples of using this class in a * (properly configured) Spring container using XML-based metadata: - * + * *

     <bean id="errorDialog" class="...">
      *    <!--
      *        the 'messages' property is of type java.util.ResourceBundle.
    @@ -40,18 +40,18 @@
      *    -->
      *    <property name="messages" value="DialogMessages"/>
      * </bean>
    - * + * *
     <bean id="errorDialog" class="...">
      *    <!--
      *        the 'DialogMessages.properties' file exists in the 'com/messages' package
      *    -->
      *    <property name="messages" value="com/messages/DialogMessages"/>
      * </bean>
    - * + * *

    A 'properly configured' Spring {@link org.springframework.context.ApplicationContext container} * might contain a {@link org.springframework.beans.factory.config.CustomEditorConfigurer} * definition such that the conversion can be effected transparently: - * + * *

     <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      *    <property name="customEditors">
      *        <map>
    @@ -61,10 +61,10 @@
      *        </map>
      *    </property>
      * </bean>
    - * + * *

    Please note that this {@link java.beans.PropertyEditor} is * not registered by default with any of the Spring infrastructure. - * + * *

    Thanks to David Leal Valmana for the suggestion and initial prototype. * * @author Rick Evans diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringArrayPropertyEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringArrayPropertyEditor.java index c715f61e4c8a..5bcecaf97389 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringArrayPropertyEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringArrayPropertyEditor.java @@ -46,7 +46,7 @@ public class StringArrayPropertyEditor extends PropertyEditorSupport { private final String charsToDelete; private final boolean emptyArrayAsNull; - + private final boolean trimValues; @@ -83,7 +83,7 @@ public StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull) { * @param separator the separator to use for splitting a {@link String} * @param emptyArrayAsNull true if an empty String array * is to be transformed into null - * @param trimValues true if the values in the parsed arrays + * @param trimValues true if the values in the parsed arrays * are to be be trimmed of whitespace (default is true). */ public StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull, boolean trimValues) { @@ -111,7 +111,7 @@ public StringArrayPropertyEditor(String separator, String charsToDelete, boolean * e.g. "\r\n\f" will delete all new lines and line feeds in a String. * @param emptyArrayAsNull true if an empty String array * is to be transformed into null - * @param trimValues true if the values in the parsed arrays + * @param trimValues true if the values in the parsed arrays * are to be be trimmed of whitespace (default is true). */ public StringArrayPropertyEditor(String separator, String charsToDelete, boolean emptyArrayAsNull, boolean trimValues) { diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/package-info.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/package-info.java index 40aa76e11e71..376e3c6d3f4b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/package-info.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/package-info.java @@ -3,7 +3,7 @@ * * Properties editors used to convert from String values to object * types such as java.util.Properties. - * + * *

    Some of these editors are registered automatically by BeanWrapperImpl. * "CustomXxxEditor" classes are intended for manual registration in * specific binding processes, as they are localized or the like. diff --git a/spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java b/spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java index 36c185f91904..cda696e96902 100644 --- a/spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java +++ b/spring-beans/src/main/java/org/springframework/beans/support/ArgumentConvertingMethodInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ protected TypeConverter getDefaultTypeConverter() { * @see #setTypeConverter * @see org.springframework.beans.PropertyEditorRegistry#registerCustomEditor */ - public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor) { + public void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor) { TypeConverter converter = getTypeConverter(); if (!(converter instanceof PropertyEditorRegistry)) { throw new IllegalStateException( @@ -139,7 +139,7 @@ protected Method doFindMatchingMethod(Object[] arguments) { for (Method candidate : candidates) { if (candidate.getName().equals(targetMethod)) { // Check if the inspected method has the correct number of parameters. - Class[] paramTypes = candidate.getParameterTypes(); + Class[] paramTypes = candidate.getParameterTypes(); if (paramTypes.length == argCount) { Object[] convertedArguments = new Object[argCount]; boolean match = true; diff --git a/spring-beans/src/main/java/org/springframework/beans/support/MutableSortDefinition.java b/spring-beans/src/main/java/org/springframework/beans/support/MutableSortDefinition.java index e227dd59afa4..3a873f0767aa 100644 --- a/spring-beans/src/main/java/org/springframework/beans/support/MutableSortDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/support/MutableSortDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -159,7 +159,7 @@ public boolean equals(Object other) { } SortDefinition otherSd = (SortDefinition) other; return (getProperty().equals(otherSd.getProperty()) && - isAscending() == otherSd.isAscending() && isIgnoreCase() == otherSd.isIgnoreCase()); + isAscending() == otherSd.isAscending() && isIgnoreCase() == otherSd.isIgnoreCase()); } @Override diff --git a/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java b/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java index d9f9a95bbb23..34f070ee567e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java +++ b/spring-beans/src/main/java/org/springframework/beans/support/PropertyComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,6 +72,7 @@ public final SortDefinition getSortDefinition() { } + @SuppressWarnings({ "unchecked", "rawtypes" }) public int compare(Object o1, Object o2) { Object v1 = getPropertyValue(o1); Object v2 = getPropertyValue(o2); @@ -81,7 +82,7 @@ public int compare(Object o1, Object o2) { } int result; - + // Put an object with null property at the end of the sort result. try { if (v1 != null) { @@ -129,7 +130,7 @@ private Object getPropertyValue(Object obj) { * @param sortDefinition the parameters to sort by * @throws java.lang.IllegalArgumentException in case of a missing propertyName */ - public static void sort(List source, SortDefinition sortDefinition) throws BeansException { + public static void sort(List source, SortDefinition sortDefinition) throws BeansException { if (StringUtils.hasText(sortDefinition.getProperty())) { Collections.sort(source, new PropertyComparator(sortDefinition)); } @@ -143,7 +144,7 @@ public static void sort(List source, SortDefinition sortDefinition) throws Beans * @param sortDefinition the parameters to sort by * @throws java.lang.IllegalArgumentException in case of a missing propertyName */ - public static void sort(Object[] source, SortDefinition sortDefinition) throws BeansException { + public static void sort(T[] source, SortDefinition sortDefinition) throws BeansException { if (StringUtils.hasText(sortDefinition.getProperty())) { Arrays.sort(source, new PropertyComparator(sortDefinition)); } diff --git a/spring-beans/src/main/java/org/springframework/beans/support/SortDefinition.java b/spring-beans/src/main/java/org/springframework/beans/support/SortDefinition.java index 869701bc5983..9ad02dade067 100644 --- a/spring-beans/src/main/java/org/springframework/beans/support/SortDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/support/SortDefinition.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java b/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java index aec54454ece8..3b950dc71083 100644 --- a/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java +++ b/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java @@ -1,12 +1,12 @@ /* - * Copyright 2006-2010 the original author or authors. - * + * Copyright 2006-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,8 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; import static org.junit.Assert.*; @@ -31,12 +32,13 @@ */ public class ComponentBeanDefinitionParserTest { - private static XmlBeanFactory bf; + private static DefaultListableBeanFactory bf; @BeforeClass public static void setUpBeforeClass() throws Exception { - bf = new XmlBeanFactory(new ClassPathResource( - "com/foo/component-config.xml")); + bf = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf); + reader.loadBeanDefinitions(new ClassPathResource("com/foo/component-config.xml")); } @AfterClass @@ -71,4 +73,4 @@ public void testBionicSecondLevenChildren() throws Exception { assertThat("Karate-1", equalTo(components.get(0).getName())); assertThat("Sport-1", equalTo(components.get(1).getName())); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java b/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java index f85c45233d91..91606f4a3570 100644 --- a/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyValuesTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,7 +25,7 @@ * @author Rod Johnson * @author Chris Beams */ -public abstract class AbstractPropertyValuesTests { +public abstract class AbstractPropertyValuesTests { /** * Must contain: forname=Tony surname=Blair age=50 @@ -52,4 +52,4 @@ protected void doTestTony(PropertyValues pvs) throws Exception { assertTrue("Map size is 0", m.size() == 0); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java index a8abdd95f293..620ab566a8b1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ /** * Unit tests for {@link BeanUtils}. - * + * * @author Juergen Hoeller * @author Rob Harrop * @author Chris Beams @@ -250,24 +250,24 @@ public void testResolveSignatureWithArray() throws Exception { } @Test - public void testSPR6063() { - PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class); - - PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value"); - assertEquals(String.class, keyDescr.getPropertyType()); - for (PropertyDescriptor propertyDescriptor : descrs) { - if (propertyDescriptor.getName().equals(keyDescr.getName())) { - assertEquals(propertyDescriptor.getName() + " has unexpected type", keyDescr.getPropertyType(), propertyDescriptor.getPropertyType()); - } - } - } + public void testSPR6063() { + PropertyDescriptor[] descrs = BeanUtils.getPropertyDescriptors(Bean.class); + PropertyDescriptor keyDescr = BeanUtils.getPropertyDescriptor(Bean.class, "value"); + assertEquals(String.class, keyDescr.getPropertyType()); + for (PropertyDescriptor propertyDescriptor : descrs) { + if (propertyDescriptor.getName().equals(keyDescr.getName())) { + assertEquals(propertyDescriptor.getName() + " has unexpected type", + keyDescr.getPropertyType(), propertyDescriptor.getPropertyType()); + } + } + } private void assertSignatureEquals(Method desiredMethod, String signature) { assertEquals(desiredMethod, BeanUtils.resolveSignature(signature, MethodSignatureBean.class)); } - private static class NameAndSpecialProperty { + public static class NameAndSpecialProperty { private String name; @@ -291,7 +291,7 @@ public int getSpecialProperty() { } - private static class ContainerBean { + public static class ContainerBean { private ContainedBean[] containedBeans; @@ -305,7 +305,7 @@ public void setContainedBeans(ContainedBean[] containedBeans) { } - private static class ContainedBean { + public static class ContainedBean { private String name; @@ -319,7 +319,7 @@ public void setName(String name) { } - private static class MethodSignatureBean { + public static class MethodSignatureBean { public void doSomething() { } @@ -343,7 +343,7 @@ public void doSomethingWithAMultiDimensionalArray(String[][] strings) { } } - private interface MapEntry { + public interface MapEntry { K getKey(); @@ -354,7 +354,7 @@ private interface MapEntry { void setValue(V value); } - private static class Bean implements MapEntry { + public static class Bean implements MapEntry { private String key; diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java index 469b22cdafc3..296a860fc985 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,6 +56,7 @@ public void getPropertyValueNullValueInNestedPathNoDefaultConstructor() { } @Test + @SuppressWarnings("cast") public void getPropertyValueAutoGrowArray() { assertNotNull(wrapper.getPropertyValue("array[0]")); assertEquals(1, bean.getArray().length); @@ -69,14 +70,15 @@ public void setPropertyValueAutoGrowArray() { } @Test + @SuppressWarnings("cast") public void getPropertyValueAutoGrowArrayBySeveralElements() { assertNotNull(wrapper.getPropertyValue("array[4]")); - assertEquals(5, bean.getArray().length); - assertTrue(bean.getArray()[0] instanceof Bean); - assertTrue(bean.getArray()[1] instanceof Bean); - assertTrue(bean.getArray()[2] instanceof Bean); - assertTrue(bean.getArray()[3] instanceof Bean); - assertTrue(bean.getArray()[4] instanceof Bean); + assertEquals(5, bean.getArray().length); + assertTrue(bean.getArray()[0] instanceof Bean); + assertTrue(bean.getArray()[1] instanceof Bean); + assertTrue(bean.getArray()[2] instanceof Bean); + assertTrue(bean.getArray()[3] instanceof Bean); + assertTrue(bean.getArray()[4] instanceof Bean); assertNotNull(wrapper.getPropertyValue("array[0]")); assertNotNull(wrapper.getPropertyValue("array[1]")); assertNotNull(wrapper.getPropertyValue("array[2]")); @@ -84,6 +86,7 @@ public void getPropertyValueAutoGrowArrayBySeveralElements() { } @Test + @SuppressWarnings("cast") public void getPropertyValueAutoGrowMultiDimensionalArray() { assertNotNull(wrapper.getPropertyValue("multiArray[0][0]")); assertEquals(1, bean.getMultiArray()[0].length); @@ -91,10 +94,11 @@ public void getPropertyValueAutoGrowMultiDimensionalArray() { } @Test + @SuppressWarnings("cast") public void getPropertyValueAutoGrowList() { assertNotNull(wrapper.getPropertyValue("list[0]")); assertEquals(1, bean.getList().size()); - assertTrue(bean.getList().get(0) instanceof Bean); + assertTrue(bean.getList().get(0) instanceof Bean); } @Test @@ -104,14 +108,15 @@ public void setPropertyValueAutoGrowList() { } @Test + @SuppressWarnings("cast") public void getPropertyValueAutoGrowListBySeveralElements() { assertNotNull(wrapper.getPropertyValue("list[4]")); assertEquals(5, bean.getList().size()); - assertTrue(bean.getList().get(0) instanceof Bean); - assertTrue(bean.getList().get(1) instanceof Bean); - assertTrue(bean.getList().get(2) instanceof Bean); - assertTrue(bean.getList().get(3) instanceof Bean); - assertTrue(bean.getList().get(4) instanceof Bean); + assertTrue(bean.getList().get(0) instanceof Bean); + assertTrue(bean.getList().get(1) instanceof Bean); + assertTrue(bean.getList().get(2) instanceof Bean); + assertTrue(bean.getList().get(3) instanceof Bean); + assertTrue(bean.getList().get(4) instanceof Bean); assertNotNull(wrapper.getPropertyValue("list[0]")); assertNotNull(wrapper.getPropertyValue("list[1]")); assertNotNull(wrapper.getPropertyValue("list[2]")); @@ -132,6 +137,7 @@ public void getPropertyValueAutoGrowListFailsAgainstLimit() { } @Test + @SuppressWarnings("cast") public void getPropertyValueAutoGrowMultiDimensionalList() { assertNotNull(wrapper.getPropertyValue("multiList[0][0]")); assertEquals(1, bean.getMultiList().get(0).size()); @@ -144,12 +150,14 @@ public void getPropertyValueAutoGrowListNotParameterized() { } @Test + @SuppressWarnings("cast") public void setPropertyValueAutoGrowMap() { wrapper.setPropertyValue("map[A]", new Bean()); assertTrue(bean.getMap().get("A") instanceof Bean); } @Test + @SuppressWarnings("cast") public void setNestedPropertyValueAutoGrowMap() { wrapper.setPropertyValue("map[A].nested", new Bean()); assertTrue(bean.getMap().get("A").getNested() instanceof Bean); @@ -167,11 +175,12 @@ public static class Bean { private Bean[] array; private Bean[][] multiArray; - + private List list; - + private List> multiList; + @SuppressWarnings("rawtypes") private List listNotParameterized; private Map map; @@ -215,7 +224,7 @@ public List getList() { public void setList(List list) { this.list = list; } - + public List> getMultiList() { return multiList; } @@ -232,10 +241,12 @@ public void setNestedNoConstructor(NestedNoDefaultConstructor nestedNoConstructo this.nestedNoConstructor = nestedNoConstructor; } + @SuppressWarnings("rawtypes") public List getListNotParameterized() { return listNotParameterized; } + @SuppressWarnings("rawtypes") public void setListNotParameterized(List listNotParameterized) { this.listNotParameterized = listNotParameterized; } diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java index c1f3b5e3acc7..6eece3ddb137 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -157,8 +157,7 @@ public void testGenericMapWithCollectionValue() { GenericBean gb = new GenericBean(); BeanWrapper bw = new BeanWrapperImpl(gb); bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false)); - @SuppressWarnings("unchecked") - Map input = new HashMap(); + Map> input = new HashMap>(); HashSet value1 = new HashSet(); value1.add(new Integer(1)); input.put("1", value1); @@ -487,7 +486,7 @@ public void testSettingLongPropertyWithGenericInterface() { } - private static abstract class BaseGenericCollectionBean { + public static abstract class BaseGenericCollectionBean { public abstract Object getMapOfInteger(); @@ -497,7 +496,7 @@ private static abstract class BaseGenericCollectionBean { } - private static class NestedGenericCollectionBean extends BaseGenericCollectionBean { + public static class NestedGenericCollectionBean extends BaseGenericCollectionBean { private Map mapOfInteger; @@ -541,7 +540,7 @@ public void setMapOfListOfListOfInteger(Map>> mapOfLi } - private static class ComplexMapHolder { + public static class ComplexMapHolder { private Map, List> genericMap; @@ -603,23 +602,22 @@ public void setVersion(Double theDouble) { public interface ObjectWithId> { - T getId(); + T getId(); - void setId(T aId); + void setId(T aId); } - public class Promotion implements ObjectWithId { - private Long id; + private Long id; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long aId) { - this.id = aId; - } + public void setId(Long aId) { + this.id = aId; + } } } diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java index b584e4a51ea5..713f207ced6c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java @@ -94,14 +94,27 @@ public void testNullNestedTypeDescriptor2() { assertEquals(map, foo.list.get(0)); } - @Test - public void testNullNestedTypeDescriptorWithNoConversionService() { - Foo foo = new Foo(); - BeanWrapperImpl wrapper = new BeanWrapperImpl(foo); - wrapper.setAutoGrowNestedPaths(true); - wrapper.setPropertyValue("listOfMaps[0]['luckyNumber']", "9"); - assertEquals("9", foo.listOfMaps.get(0).get("luckyNumber")); - } + static class Foo { + + private List list; + + private List> listOfMaps; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public List> getListOfMaps() { + return listOfMaps; + } + + public void setListOfMaps(List> listOfMaps) { + this.listOfMaps = listOfMaps; + } @Test public void testNullNestedTypeDescriptorWithBadConversionService() { @@ -995,15 +1008,15 @@ public void testIndexedPropertiesWithDirectAccess() { bw.setPropertyValues(pvs); assertEquals(tb5, bean.getArray()[0]); assertEquals(tb4, bean.getArray()[1]); - assertEquals(tb3, ((TestBean) bean.getList().get(0))); - assertEquals(tb2, ((TestBean) bean.getList().get(1))); - assertEquals(tb0, ((TestBean) bean.getList().get(2))); - assertEquals(null, ((TestBean) bean.getList().get(3))); - assertEquals(tb1, ((TestBean) bean.getList().get(4))); - assertEquals(tb1, ((TestBean) bean.getMap().get("key1"))); - assertEquals(tb0, ((TestBean) bean.getMap().get("key2"))); - assertEquals(tb4, ((TestBean) bean.getMap().get("key5"))); - assertEquals(tb5, ((TestBean) bean.getMap().get("key9"))); + assertEquals(tb3, bean.getList().get(0)); + assertEquals(tb2, bean.getList().get(1)); + assertEquals(tb0, bean.getList().get(2)); + assertEquals(null, bean.getList().get(3)); + assertEquals(tb1, bean.getList().get(4)); + assertEquals(tb1, bean.getMap().get("key1")); + assertEquals(tb0, bean.getMap().get("key2")); + assertEquals(tb4, bean.getMap().get("key5")); + assertEquals(tb5, bean.getMap().get("key9")); assertEquals(tb5, bw.getPropertyValue("array[0]")); assertEquals(tb4, bw.getPropertyValue("array[1]")); assertEquals(tb3, bw.getPropertyValue("list[0]")); @@ -1090,13 +1103,13 @@ public void setAsText(String text) throws IllegalArgumentException { inputMap.put(new Integer(1), "rod"); inputMap.put(new Integer(2), "rob"); MutablePropertyValues pvs = new MutablePropertyValues(); - pvs.add("map", new ReadOnlyMap(inputMap)); + pvs.add("map", new ReadOnlyMap(inputMap)); bw.setPropertyValues(pvs); assertEquals("rod", ((TestBean) bean.getMap().get(new Integer(1))).getName()); assertEquals("rob", ((TestBean) bean.getMap().get(new Integer(2))).getName()); } - @SuppressWarnings("unchecked") // must work with raw map in this test + @SuppressWarnings({ "unchecked", "rawtypes" }) // must work with raw map in this test @Test public void testRawMapAccessWithNoEditorRegistered() { IndexedTestBean bean = new IndexedTestBean(); @@ -1571,14 +1584,14 @@ private static class DifferentTestBean extends TestBean { } - private static class NoRead { + public static class NoRead { public void setAge(int age) { } } - private static class EnumTester { + public static class EnumTester { private Autowire autowire; @@ -1592,7 +1605,7 @@ public Autowire getAutowire() { } - private static class PropsTester { + public static class PropsTester { private Properties props; @@ -1620,7 +1633,7 @@ public void setIntArray(int[] intArray) { } - private static class GetterBean { + public static class GetterBean { private String name; @@ -1637,7 +1650,7 @@ public String getName() { } - private static class ThrowsException { + public static class ThrowsException { public void doSomething(Throwable t) throws Throwable { throw t; @@ -1645,7 +1658,7 @@ public void doSomething(Throwable t) throws Throwable { } - private static class PrimitiveArrayBean { + public static class PrimitiveArrayBean { private int[] array; @@ -1659,7 +1672,7 @@ public void setArray(int[] array) { } - private static class NumberPropertyBean { + public static class NumberPropertyBean { private byte myPrimitiveByte; private Byte myByte; @@ -1777,7 +1790,7 @@ public void setMyDouble(Double myDouble) { } - private static class IntelliBean { + public static class IntelliBean { public void setName(String name) {} @@ -1791,7 +1804,7 @@ public void setMyStringss(String string) {} } - private static class Employee extends TestBean { + public static class Employee extends TestBean { private String co; diff --git a/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java index 4866cc101b6e..d00ef05d4843 100644 --- a/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -50,7 +50,7 @@ public void testSingleThread() { performSet(); } } - + @Test public void testConcurrent() { for (int i = 0; i < 10; i++) { @@ -134,7 +134,7 @@ public void run() { } - private static class TestBean { + public static class TestBean { private Properties properties; diff --git a/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java b/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java index 8eeb96e36cba..bc53e02ae2fd 100644 --- a/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public void testValid() throws Exception { pvs.addPropertyValue(new PropertyValue("surname", "Blair")); pvs.addPropertyValue(new PropertyValue("age", "50")); doTestTony(pvs); - + MutablePropertyValues deepCopy = new MutablePropertyValues(pvs); doTestTony(deepCopy); deepCopy.setPropertyValueAt(new PropertyValue("name", "Gordon"), 0); diff --git a/spring-beans/src/test/java/org/springframework/beans/PropertyAccessorUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/PropertyAccessorUtilsTests.java index be5e85890347..2e301540b42b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/PropertyAccessorUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/PropertyAccessorUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/annotation/AnnotationBeanWiringInfoResolverTests.java b/spring-beans/src/test/java/org/springframework/beans/annotation/AnnotationBeanWiringInfoResolverTests.java index b623750f363b..b7d4e9b3eeea 100644 --- a/spring-beans/src/test/java/org/springframework/beans/annotation/AnnotationBeanWiringInfoResolverTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/annotation/AnnotationBeanWiringInfoResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/annotation/RequiredAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/annotation/RequiredAnnotationBeanPostProcessorTests.java index dd52eea7b82a..34729124ef18 100644 --- a/spring-beans/src/test/java/org/springframework/beans/annotation/RequiredAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/annotation/RequiredAnnotationBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java index 4094dd39747f..f2bab8cee229 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java @@ -16,6 +16,9 @@ package org.springframework.beans.factory; +import static org.junit.Assert.*; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; + import java.util.Arrays; import java.util.List; import java.util.Map; @@ -24,10 +27,8 @@ import org.junit.Test; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.StaticListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.cglib.proxy.NoOp; -import org.springframework.core.io.Resource; import org.springframework.util.ObjectUtils; import test.beans.DummyFactory; @@ -45,12 +46,6 @@ * @since 04.07.2003 */ public final class BeanFactoryUtilsTests { - - private static final Class CLASS = BeanFactoryUtilsTests.class; - private static final Resource ROOT_CONTEXT = qualifiedResource(CLASS, "root.xml"); - private static final Resource MIDDLE_CONTEXT = qualifiedResource(CLASS, "middle.xml"); - private static final Resource LEAF_CONTEXT = qualifiedResource(CLASS, "leaf.xml"); - private static final Resource DEPENDENT_BEANS_CONTEXT = qualifiedResource(CLASS, "dependentBeans.xml"); private ConfigurableListableBeanFactory listableBeanFactory; @@ -59,11 +54,10 @@ public final class BeanFactoryUtilsTests { @Before public void setUp() { // Interesting hierarchical factory to test counts. - // Slow to read so we cache it. - XmlBeanFactory grandParent = new XmlBeanFactory(ROOT_CONTEXT); - XmlBeanFactory parent = new XmlBeanFactory(MIDDLE_CONTEXT, grandParent); - XmlBeanFactory child = new XmlBeanFactory(LEAF_CONTEXT, parent); - this.dependentBeansBF = new XmlBeanFactory(DEPENDENT_BEANS_CONTEXT); + DefaultListableBeanFactory grandParent = beanFactoryFromQualifiedResource(getClass(), "root.xml"); + DefaultListableBeanFactory parent = beanFactoryFromQualifiedResource(getClass(), "middle.xml", grandParent); + DefaultListableBeanFactory child = beanFactoryFromQualifiedResource(getClass(), "leaf.xml", parent); + this.dependentBeansBF = beanFactoryFromQualifiedResource(getClass(), "dependentBeans.xml"); dependentBeansBF.preInstantiateSingletons(); this.listableBeanFactory = child; } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java index 563b56fca8c8..aaaf68df6286 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package org.springframework.beans.factory; import static org.junit.Assert.*; -import static test.util.TestResourceUtils.qualifiedResource; +import static test.util.TestResourceUtils.beanFactoryFromQualifiedResource; import java.text.DateFormat; import java.text.ParseException; @@ -34,9 +34,8 @@ import org.junit.Test; import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.PropertyEditorRegistry; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.propertyeditors.CustomDateEditor; -import org.springframework.core.io.Resource; /** * @author Guillaume Poirier @@ -47,8 +46,7 @@ public final class ConcurrentBeanFactoryTests { private static final Log logger = LogFactory.getLog(ConcurrentBeanFactoryTests.class); - private static final Resource CONTEXT = qualifiedResource(ConcurrentBeanFactoryTests.class, "context.xml"); - + private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd"); private static final Date DATE_1, DATE_2; @@ -70,7 +68,7 @@ public final class ConcurrentBeanFactoryTests { @Before public void setUp() throws Exception { - XmlBeanFactory factory = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory factory = beanFactoryFromQualifiedResource(getClass(), "context.xml"); factory.addPropertyEditorRegistrar(new PropertyEditorRegistrar() { public void registerCustomEditors(PropertyEditorRegistry registry) { registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false)); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java index 1acfc0a504b3..130c018893a0 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java @@ -96,6 +96,7 @@ public class DefaultListableBeanFactoryTests { private static final Log factoryLog = LogFactory.getLog(DefaultListableBeanFactory.class); + //FIXME s/r beanDefinition @Test public void testUnreferencedSingletonWasInstantiated() { @@ -497,7 +498,7 @@ public void testSimpleReference() { int count = (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p, PREFIX); assertTrue("2 beans registered, not " + count, count == 2); - TestBean kerry = (TestBean) lbf.getBean("kerry", TestBean.class); + TestBean kerry = lbf.getBean("kerry", TestBean.class); assertTrue("Kerry name is Kerry", "Kerry".equals(kerry.getName())); ITestBean spouse = kerry.getSpouse(); assertTrue("Kerry spouse is non null", spouse != null); @@ -516,7 +517,7 @@ public void testPropertiesWithDotsInKey() { assertTrue("1 beans registered, not " + count, count == 1); assertEquals(1, lbf.getBeanDefinitionCount()); - TestBean tb = (TestBean) lbf.getBean("tb", TestBean.class); + TestBean tb = lbf.getBean("tb", TestBean.class); assertEquals("my.value", tb.getSomeMap().get("my.key")); } @@ -547,7 +548,9 @@ public void testSelfReference() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("spouse", new RuntimeBeanReference("self")); - lbf.registerBeanDefinition("self", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("self", bd); TestBean self = (TestBean) lbf.getBean("self"); assertEquals(self, self.getSpouse()); } @@ -558,7 +561,9 @@ public void testPossibleMatches() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("ag", "foobar"); - lbf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("tb", bd); lbf.getBean("tb"); fail("Should throw exception on invalid property"); } @@ -843,7 +848,9 @@ public void registerCustomEditors(PropertyEditorRegistry registry) { }); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("myFloat", "1,1"); - lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("testBean", bd); TestBean testBean = (TestBean) lbf.getBean("testBean"); assertTrue(testBean.getMyFloat().floatValue() == 1.1f); } @@ -866,7 +873,9 @@ public Float convert(String source) { lbf.setConversionService(conversionService); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("myFloat", "1,1"); - lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("testBean", bd); TestBean testBean = (TestBean) lbf.getBean("testBean"); assertTrue(testBean.getMyFloat().floatValue() == 1.1f); } @@ -882,7 +891,9 @@ public void registerCustomEditors(PropertyEditorRegistry registry) { }); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("myFloat", new RuntimeBeanReference("myFloat")); - lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("testBean", bd); lbf.registerSingleton("myFloat", "1,1"); TestBean testBean = (TestBean) lbf.getBean("testBean"); assertTrue(testBean.getMyFloat().floatValue() == 1.1f); @@ -970,7 +981,7 @@ public void testRegisterExistingSingletonWithNameOverriding() { assertEquals(singletonObject, lbf.getBean("singletonObject")); assertEquals(singletonObject, test.getSpouse()); - Map beansOfType = lbf.getBeansOfType(TestBean.class, false, true); + Map beansOfType = lbf.getBeansOfType(TestBean.class, false, true); assertEquals(2, beansOfType.size()); assertTrue(beansOfType.containsValue(test)); assertTrue(beansOfType.containsValue(singletonObject)); @@ -985,7 +996,8 @@ public void testRegisterExistingSingletonWithAutowire() { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("name", "Tony"); pvs.add("age", "48"); - RootBeanDefinition bd = new RootBeanDefinition(DependenciesBean.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(DependenciesBean.class); + bd.setPropertyValues(pvs); bd.setDependencyCheck(RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS); bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); lbf.registerBeanDefinition("test", bd); @@ -1034,7 +1046,8 @@ public void testArrayPropertyWithAutowiring() throws MalformedURLException { bf.registerSingleton("resource1", new UrlResource("http://localhost:8080")); bf.registerSingleton("resource2", new UrlResource("http://localhost:9090")); - RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); bf.registerBeanDefinition("arrayBean", rbd); ArrayBean ab = (ArrayBean) bf.getBean("arrayBean"); @@ -1046,7 +1059,8 @@ public void testArrayPropertyWithAutowiring() throws MalformedURLException { public void testArrayPropertyWithOptionalAutowiring() throws MalformedURLException { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); - RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); bf.registerBeanDefinition("arrayBean", rbd); ArrayBean ab = (ArrayBean) bf.getBean("arrayBean"); @@ -1059,7 +1073,8 @@ public void testArrayConstructorWithAutowiring() { bf.registerSingleton("integer1", new Integer(4)); bf.registerSingleton("integer2", new Integer(5)); - RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("arrayBean", rbd); ArrayBean ab = (ArrayBean) bf.getBean("arrayBean"); @@ -1071,7 +1086,8 @@ public void testArrayConstructorWithAutowiring() { public void testArrayConstructorWithOptionalAutowiring() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); - RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("arrayBean", rbd); ArrayBean ab = (ArrayBean) bf.getBean("arrayBean"); @@ -1086,7 +1102,8 @@ public void testDoubleArrayConstructorWithAutowiring() throws MalformedURLExcept bf.registerSingleton("resource1", new UrlResource("http://localhost:8080")); bf.registerSingleton("resource2", new UrlResource("http://localhost:9090")); - RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("arrayBean", rbd); ArrayBean ab = (ArrayBean) bf.getBean("arrayBean"); @@ -1102,7 +1119,8 @@ public void testDoubleArrayConstructorWithOptionalAutowiring() throws MalformedU bf.registerSingleton("resource1", new UrlResource("http://localhost:8080")); bf.registerSingleton("resource2", new UrlResource("http://localhost:9090")); - RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("arrayBean", rbd); ArrayBean ab = (ArrayBean) bf.getBean("arrayBean"); @@ -1111,6 +1129,7 @@ public void testDoubleArrayConstructorWithOptionalAutowiring() throws MalformedU } @Test + @SuppressWarnings("deprecation") public void testAutowireWithNoDependencies() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); @@ -1122,11 +1141,13 @@ public void testAutowireWithNoDependencies() { } @Test + @SuppressWarnings("deprecation") public void testAutowireWithSatisfiedJavaBeanDependency() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("name", "Rod"); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); lbf.registerBeanDefinition("rod", bd); assertEquals(1, lbf.getBeanDefinitionCount()); // Depends on age, name and spouse (TestBean) @@ -1138,14 +1159,17 @@ public void testAutowireWithSatisfiedJavaBeanDependency() { } @Test + @SuppressWarnings("deprecation") public void testAutowireWithSatisfiedConstructorDependency() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("name", "Rod"); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); lbf.registerBeanDefinition("rod", bd); assertEquals(1, lbf.getBeanDefinitionCount()); - Object registered = lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false); + Object registered = lbf.autowire(ConstructorDependency.class, + AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false); assertEquals(1, lbf.getBeanDefinitionCount()); ConstructorDependency kerry = (ConstructorDependency) registered; TestBean rod = (TestBean) lbf.getBean("rod"); @@ -1153,6 +1177,7 @@ public void testAutowireWithSatisfiedConstructorDependency() { } @Test + @SuppressWarnings("deprecation") public void testAutowireWithTwoMatchesForConstructorDependency() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); @@ -1171,11 +1196,13 @@ public void testAutowireWithTwoMatchesForConstructorDependency() { } @Test + @SuppressWarnings("deprecation") public void testAutowireWithUnsatisfiedConstructorDependency() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("name", "Rod")); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); lbf.registerBeanDefinition("rod", bd); assertEquals(1, lbf.getBeanDefinitionCount()); try { @@ -1192,8 +1219,7 @@ public void testAutowireConstructor() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); lbf.registerBeanDefinition("spouse", bd); - ConstructorDependenciesBean bean = (ConstructorDependenciesBean) - lbf.autowire(ConstructorDependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, true); + ConstructorDependenciesBean bean = lbf.autowire(ConstructorDependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, true); Object spouse = lbf.getBean("spouse"); assertTrue(bean.getSpouse1() == spouse); assertTrue(BeanFactoryUtils.beanOfType(lbf, TestBean.class) == spouse); @@ -1204,8 +1230,7 @@ public void testAutowireBeanByName() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); lbf.registerBeanDefinition("spouse", bd); - DependenciesBean bean = (DependenciesBean) - lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, true); + DependenciesBean bean = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, true); TestBean spouse = (TestBean) lbf.getBean("spouse"); assertEquals(spouse, bean.getSpouse()); assertTrue(BeanFactoryUtils.beanOfType(lbf, TestBean.class) == spouse); @@ -1230,8 +1255,7 @@ public void testAutowireBeanByNameWithNoDependencyCheck() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); lbf.registerBeanDefinition("spous", bd); - DependenciesBean bean = (DependenciesBean) - lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false); + DependenciesBean bean = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false); assertNull(bean.getSpouse()); } @@ -1272,8 +1296,7 @@ public void testAutowireBeanByType() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); lbf.registerBeanDefinition("test", bd); - DependenciesBean bean = (DependenciesBean) - lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true); + DependenciesBean bean = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true); TestBean test = (TestBean) lbf.getBean("test"); assertEquals(test, bean.getSpouse()); } @@ -1291,7 +1314,7 @@ public void testAutowireBeanWithFactoryBeanByType() { lbf.registerBeanDefinition("factoryBean", bd); LazyInitFactory factoryBean = (LazyInitFactory) lbf.getBean("&factoryBean"); assertNotNull("The FactoryBean should have been registered.", factoryBean); - FactoryBeanDependentBean bean = (FactoryBeanDependentBean) lbf.autowire(FactoryBeanDependentBean.class, + FactoryBeanDependentBean bean = lbf.autowire(FactoryBeanDependentBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true); assertEquals("The FactoryBeanDependentBean should have been autowired 'by type' with the LazyInitFactory.", factoryBean, bean.getFactoryBean()); @@ -1373,8 +1396,7 @@ public void testAutowireBeanByTypeWithDependencyCheck() { @Test public void testAutowireBeanByTypeWithNoDependencyCheck() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); - DependenciesBean bean = (DependenciesBean) - lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false); + DependenciesBean bean = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false); assertNull(bean.getSpouse()); } @@ -1462,7 +1484,9 @@ public void testApplyBeanPropertyValues() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("age", "99"); - lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("test", bd); TestBean tb = new TestBean(); assertEquals(0, tb.getAge()); lbf.applyBeanPropertyValues(tb, "test"); @@ -1474,7 +1498,9 @@ public void testApplyBeanPropertyValuesWithIncompleteDefinition() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("age", "99"); - lbf.registerBeanDefinition("test", new RootBeanDefinition(null, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("test", bd); TestBean tb = new TestBean(); assertEquals(0, tb.getAge()); lbf.applyBeanPropertyValues(tb, "test"); @@ -1488,7 +1514,9 @@ public void testConfigureBean() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("age", "99"); - lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + lbf.registerBeanDefinition("test", bd); TestBean tb = new TestBean(); assertEquals(0, tb.getAge()); lbf.configureBean(tb, "test"); @@ -1504,7 +1532,9 @@ public void testConfigureBeanWithAutowiring() { lbf.registerBeanDefinition("spouse", bd); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("age", "99"); - lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_NAME)); + RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class); + bd2.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_NAME); + lbf.registerBeanDefinition("test", bd2); TestBean tb = new TestBean(); lbf.configureBean(tb, "test"); assertSame(lbf, tb.getBeanFactory()); @@ -1517,8 +1547,10 @@ public void testExtensiveCircularReference() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); for (int i = 0; i < 1000; i++) { MutablePropertyValues pvs = new MutablePropertyValues(); - pvs.addPropertyValue(new PropertyValue("spouse", new RuntimeBeanReference("bean" + (i < 99 ? i + 1 : 0)))); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs); + pvs.addPropertyValue(new PropertyValue("spouse", new RuntimeBeanReference( + "bean" + (i < 99 ? i + 1 : 0)))); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); lbf.registerBeanDefinition("bean" + i, bd); } lbf.preInstantiateSingletons(); @@ -1532,7 +1564,9 @@ public void testExtensiveCircularReference() { @Test public void testCircularReferenceThroughAutowiring() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); - lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR)); + RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyBean.class); + bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + lbf.registerBeanDefinition("test", bd); try { lbf.preInstantiateSingletons(); fail("Should have thrown UnsatisfiedDependencyException"); @@ -1544,7 +1578,9 @@ public void testCircularReferenceThroughAutowiring() { @Test public void testCircularReferenceThroughFactoryBeanAutowiring() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); - lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyFactoryBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR)); + RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyFactoryBean.class); + bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + lbf.registerBeanDefinition("test", bd); try { lbf.preInstantiateSingletons(); fail("Should have thrown UnsatisfiedDependencyException"); @@ -1556,7 +1592,10 @@ public void testCircularReferenceThroughFactoryBeanAutowiring() { @Test public void testCircularReferenceThroughFactoryBeanTypeCheck() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); - lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyFactoryBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR)); + RootBeanDefinition bd = new RootBeanDefinition( + ConstructorDependencyFactoryBean.class); + bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + lbf.registerBeanDefinition("test", bd); try { lbf.getBeansOfType(String.class); fail("Should have thrown UnsatisfiedDependencyException"); @@ -1568,9 +1607,13 @@ public void testCircularReferenceThroughFactoryBeanTypeCheck() { @Test public void testAvoidCircularReferenceThroughAutowiring() { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); - lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyFactoryBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR)); - lbf.registerBeanDefinition("string", - new RootBeanDefinition(String.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR)); + RootBeanDefinition factoryBeanDefinition = new RootBeanDefinition( + ConstructorDependencyFactoryBean.class); + factoryBeanDefinition.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition stringBeanDefinition = new RootBeanDefinition(String.class); + stringBeanDefinition.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + lbf.registerBeanDefinition("test", factoryBeanDefinition); + lbf.registerBeanDefinition("string", stringBeanDefinition); lbf.preInstantiateSingletons(); } @@ -1754,7 +1797,7 @@ public void testPrototypeCreationWithDependencyCheckIsFastEnough() { */ @Test - @Ignore // TODO re-enable when ConstructorResolver TODO sorted out + @Ignore // TODO re-enable when ConstructorResolver TODO sorted out public void testPrototypeCreationWithConstructorArgumentsIsFastEnough() { if (factoryLog.isTraceEnabled() || factoryLog.isDebugEnabled()) { // Skip this test: Trace logging blows the time limit. @@ -2108,7 +2151,6 @@ public void testFieldSettingWithInstantiationAwarePostProcessorWithShortCircuit( doTestFieldSettingWithInstantiationAwarePostProcessor(true); } - @SuppressWarnings("unchecked") private void doTestFieldSettingWithInstantiationAwarePostProcessor(final boolean skipPropertyPopulation) { DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); @@ -2143,7 +2185,6 @@ public boolean postProcessAfterInstantiation(Object bean, String beanName) throw } } - @SuppressWarnings("unchecked") @Test public void testInitSecurityAwarePrototypeBean() { final DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); @@ -2155,7 +2196,7 @@ public void testInitSecurityAwarePrototypeBean() { subject.getPrincipals().add(new TestPrincipal("user1")); TestSecuredBean bean = (TestSecuredBean) Subject.doAsPrivileged(subject, - new PrivilegedAction() { + new PrivilegedAction() { public Object run() { return lbf.getBean("test"); } @@ -2219,6 +2260,7 @@ public ConstructorDependency(TestBean spouse) { this.spouse = spouse; } + @SuppressWarnings("unused") private ConstructorDependency(TestBean spouse, TestBean otherSpouse) { throw new IllegalArgumentException("Should never be called"); } @@ -2429,7 +2471,7 @@ public Resource[] getResourceArray() { /** * Bean with a dependency on a {@link FactoryBean}. */ - private static class FactoryBeanDependentBean { + public static class FactoryBeanDependentBean { private FactoryBean factoryBean; @@ -2452,21 +2494,25 @@ public CustomTypeConverter(NumberFormat numberFormat) { this.numberFormat = numberFormat; } + public T convertIfNecessary(Object value, Class requiredType) { + return convertIfNecessary(value, requiredType, null); + } + @SuppressWarnings("unchecked") - public Object convertIfNecessary(Object value, Class requiredType) { + public T convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) { if (value instanceof String && Float.class.isAssignableFrom(requiredType)) { try { - return new Float(this.numberFormat.parse((String) value).floatValue()); + return (T) new Float(this.numberFormat.parse((String) value).floatValue()); } catch (ParseException ex) { throw new TypeMismatchException(value, requiredType, ex); } } else if (value instanceof String && int.class.isAssignableFrom(requiredType)) { - return new Integer(5); + return (T) new Integer(5); } else { - return value; + return (T) value; } } @@ -2511,7 +2557,7 @@ public int hashCode() { } - private static class TestSecuredBean { + public static class TestSecuredBean { private String userName; @@ -2539,38 +2585,38 @@ public String getUserName() { return this.userName; } } - + /** * Bean that changes state on a business invocation, so that * we can check whether it's been invoked * @author Rod Johnson */ - private static class SideEffectBean { - + public static class SideEffectBean { + private int count; - + public void setCount(int count) { this.count = count; } - + public int getCount() { return this.count; } - + public void doWork() { ++count; } } - - private static class KnowsIfInstantiated { - + + public static class KnowsIfInstantiated { + private static boolean instantiated; - + public static void clearInstantiationRecord() { instantiated = false; } - + public static boolean wasInstantiated() { return instantiated; } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java index 127b16211014..836957af28fe 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,9 @@ import org.junit.Before; import org.junit.Test; -import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.AbstractFactoryBean; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; /** @@ -33,38 +33,41 @@ * @author Chris Beams */ public class FactoryBeanLookupTests { - private BeanFactory beanFactory; + + private DefaultListableBeanFactory beanFactory; @Before public void setUp() { - beanFactory = new XmlBeanFactory( - new ClassPathResource("FactoryBeanLookupTests-context.xml", this.getClass())); + beanFactory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); + reader.loadBeanDefinitions(new ClassPathResource( + "FactoryBeanLookupTests-context.xml", this.getClass())); } - + @Test public void factoryBeanLookupByNameDereferencing() { Object fooFactory = beanFactory.getBean("&fooFactory"); assertThat(fooFactory, instanceOf(FooFactoryBean.class)); } - + @Test public void factoryBeanLookupByType() { FooFactoryBean fooFactory = beanFactory.getBean(FooFactoryBean.class); assertNotNull(fooFactory); } - + @Test public void factoryBeanLookupByTypeAndNameDereference() { FooFactoryBean fooFactory = beanFactory.getBean("&fooFactory", FooFactoryBean.class); assertNotNull(fooFactory); } - + @Test public void factoryBeanObjectLookupByName() { Object fooFactory = beanFactory.getBean("fooFactory"); assertThat(fooFactory, instanceOf(Foo.class)); } - + @Test public void factoryBeanObjectLookupByNameAndType() { Foo foo = beanFactory.getBean("fooFactory", Foo.class); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java index 9d1123fe1c3f..8590978ea678 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,8 @@ import org.junit.Test; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import org.springframework.util.Assert; @@ -33,23 +34,27 @@ public final class FactoryBeanTests { private static final Class CLASS = FactoryBeanTests.class; - private static final Resource RETURNS_NULL_CONTEXT = qualifiedResource(CLASS, "returnsNull.xml"); - private static final Resource WITH_AUTOWIRING_CONTEXT = qualifiedResource(CLASS, "withAutowiring.xml"); - + private static final Resource RETURNS_NULL_CONTEXT = qualifiedResource(CLASS, "returnsNull.xml"); + private static final Resource WITH_AUTOWIRING_CONTEXT = qualifiedResource(CLASS, "withAutowiring.xml"); + @Test public void testFactoryBeanReturnsNull() throws Exception { - XmlBeanFactory factory = new XmlBeanFactory(RETURNS_NULL_CONTEXT); + DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); + reader.loadBeanDefinitions(RETURNS_NULL_CONTEXT); Object result = factory.getBean("factoryBean"); assertNull(result); } @Test public void testFactoryBeansWithAutowiring() throws Exception { - XmlBeanFactory factory = new XmlBeanFactory(WITH_AUTOWIRING_CONTEXT); - + DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); + reader.loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT); + BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer"); ppc.postProcessBeanFactory(factory); - + Alpha alpha = (Alpha) factory.getBean("alpha"); Beta beta = (Beta) factory.getBean("beta"); Gamma gamma = (Gamma) factory.getBean("gamma"); @@ -62,11 +67,13 @@ public void testFactoryBeansWithAutowiring() throws Exception { @Test public void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() throws Exception { - XmlBeanFactory factory = new XmlBeanFactory(WITH_AUTOWIRING_CONTEXT); - + DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); + reader.loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT); + BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer"); ppc.postProcessBeanFactory(factory); - + Beta beta = (Beta) factory.getBean("beta"); Alpha alpha = (Alpha) factory.getBean("alpha"); Gamma gamma = (Gamma) factory.getBean("gamma"); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java index 15dd2bcf93ae..c99113fdb5a8 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/SharedBeanRegistryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java index ff63ff84d59d..e8a106019a03 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java @@ -26,7 +26,7 @@ /** * Unit tests for {@link SingletonBeanFactoryLocator}. - * + * * @author Colin Sampaleanu * @author Chris Beams */ @@ -38,7 +38,7 @@ public final class SingletonBeanFactoryLocatorTests { public void testBasicFunctionality() { SingletonBeanFactoryLocator facLoc = new SingletonBeanFactoryLocator( "classpath*:" + ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML)); - + basicFunctionalityTest(facLoc); } @@ -81,7 +81,7 @@ public void testGetInstance() { BeanFactoryLocator facLoc = SingletonBeanFactoryLocator.getInstance( ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML)); getInstanceTest1(facLoc); - + facLoc = SingletonBeanFactoryLocator.getInstance( "classpath*:/" + ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML)); getInstanceTest2(facLoc); @@ -90,7 +90,7 @@ public void testGetInstance() { facLoc = SingletonBeanFactoryLocator.getInstance( "classpath:" + ClassUtils.addResourcePathToPackagePath(CLASS, REF1_XML)); getInstanceTest3(facLoc); - + } /** @@ -109,12 +109,12 @@ protected void getInstanceTest1(BeanFactoryLocator facLoc) { fac = bfr3.getFactory(); tb = (TestBean) fac.getBean("beans1.bean1"); assertTrue(tb.getName().equals("was beans1.bean1")); - + BeanFactoryReference bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias"); fac = bfr4.getFactory(); tb = (TestBean) fac.getBean("beans1.bean1"); assertTrue(tb.getName().equals("was beans1.bean1")); - + bfr.release(); bfr3.release(); bfr2.release(); @@ -152,7 +152,7 @@ protected void getInstanceTest2(BeanFactoryLocator facLoc) { bfr4.release(); bfr3.release(); } - + /** * Worker method so subclass can use it too */ diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java index 0e798b9e413f..f906f20f66ff 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java @@ -45,7 +45,7 @@ /** * Unit tests for {@link AutowiredAnnotationBeanPostProcessor}. - * + * * @author Juergen Hoeller * @author Mark Fisher * @author Sam Brannen @@ -994,12 +994,14 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } + @SuppressWarnings("unused") @Autowired private void inject(ITestBean testBean4, T nestedTestBean) { this.testBean4 = testBean4; this.nestedTestBean = nestedTestBean; } + @SuppressWarnings("unused") @Autowired private void inject(ITestBean testBean4) { this.baseInjected = true; @@ -1047,6 +1049,7 @@ protected void initBeanFactory(BeanFactory beanFactory) { this.beanFactory = beanFactory; } + @SuppressWarnings("unused") @Autowired private void inject(ITestBean testBean4) { this.subInjected = true; @@ -1073,6 +1076,7 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } + @SuppressWarnings("unused") @Autowired(required = false) private void inject(ITestBean testBean4, NestedTestBean[] nestedTestBeans, IndexedTestBean indexedTestBean) { this.testBean4 = testBean4; @@ -1119,6 +1123,7 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } + @SuppressWarnings("unused") @Autowired(required = false) private void inject(ITestBean testBean4, List nestedTestBeans, IndexedTestBean indexedTestBean) { this.testBean4 = testBean4; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java index 6beb38ada187..4f96efc8d3c4 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java @@ -30,7 +30,7 @@ /** * Unit tests for {@link CustomAutowireConfigurer}. - * + * * @author Mark Fisher * @author Juergen Hoeller * @author Chris Beams diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java index 7ef18579bffc..67edaf77bbfb 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java @@ -614,6 +614,7 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } + @SuppressWarnings("unused") @Inject private void inject(ITestBean testBean4, T nestedTestBean) { this.testBean4 = testBean4; @@ -667,6 +668,7 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } + @SuppressWarnings("unused") @Inject private void inject(ITestBean testBean4, NestedTestBean[] nestedTestBeans, IndexedTestBean indexedTestBean) { this.testBean4 = testBean4; @@ -713,6 +715,7 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } + @SuppressWarnings("unused") @Inject private void inject(ITestBean testBean4, List nestedTestBeans, IndexedTestBean indexedTestBean) { this.testBean4 = testBean4; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java index e92f28b8169a..d8f339b9b852 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java index c7870b3236ba..3d4534562510 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ /** * Unit tests for {@link CustomEditorConfigurer}. - * + * * @author Juergen Hoeller * @author Chris Beams * @since 31.07.2004 @@ -61,10 +61,14 @@ public void registerCustomEditors(PropertyEditorRegistry registry) { MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("date", "2.12.1975"); - bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd1 = new RootBeanDefinition(TestBean.class); + bd1.setPropertyValues(pvs); + bf.registerBeanDefinition("tb1", bd1); pvs = new MutablePropertyValues(); pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class)); - bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class); + bd2.setPropertyValues(pvs); + bf.registerBeanDefinition("tb2", bd2); TestBean tb1 = (TestBean) bf.getBean("tb1"); assertEquals(df.parse("2.12.1975"), tb1.getDate()); @@ -84,10 +88,14 @@ public void testCustomEditorConfigurerWithEditorInstance() throws ParseException MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("date", "2.12.1975"); - bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd1 = new RootBeanDefinition(TestBean.class); + bd1.setPropertyValues(pvs); + bf.registerBeanDefinition("tb1", bd1); pvs = new MutablePropertyValues(); pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class)); - bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class); + bd2.setPropertyValues(pvs); + bf.registerBeanDefinition("tb2", bd2); TestBean tb1 = (TestBean) bf.getBean("tb1"); assertEquals(df.parse("2.12.1975"), tb1.getDate()); @@ -106,7 +114,9 @@ public void testCustomEditorConfigurerWithEditorClassName() throws ParseExceptio MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("date", "2.12.1975"); - bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + bf.registerBeanDefinition("tb", bd); TestBean tb = (TestBean) bf.getBean("tb"); DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN); @@ -117,14 +127,16 @@ public void testCustomEditorConfigurerWithEditorClassName() throws ParseExceptio public void testCustomEditorConfigurerWithEditorAsClass() throws ParseException { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); CustomEditorConfigurer cec = new CustomEditorConfigurer(); - Map editors = new HashMap(); + Map> editors = new HashMap>(); editors.put(Date.class.getName(), MyDateEditor.class); cec.setCustomEditors(editors); cec.postProcessBeanFactory(bf); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("date", "2.12.1975"); - bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + bf.registerBeanDefinition("tb", bd); TestBean tb = (TestBean) bf.getBean("tb"); DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN); @@ -142,7 +154,9 @@ public void testCustomEditorConfigurerWithRequiredTypeArray() throws ParseExcept MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("stringArray", "xxx"); - bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); + bf.registerBeanDefinition("tb", bd); TestBean tb = (TestBean) bf.getBean("tb"); assertTrue(tb.getStringArray() != null && tb.getStringArray().length == 1); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java index 0e31d83c101e..ac1dbb59a29e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,7 +103,7 @@ public void testWhereScopeMapHasNonScopeInstanceInEntrySet() throws Exception { figurer.postProcessBeanFactory(factory); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test(expected=ClassCastException.class) public void testWhereScopeMapHasNonStringTypedScopeNameInKeySet() throws Exception { Map scopes = new HashMap(); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java index 6ae7cf74005f..552c55331d30 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java @@ -36,7 +36,7 @@ public class DeprecatedBeanWarnerTests { private DeprecatedBeanWarner warner; - + @SuppressWarnings("deprecation") @Test public void postProcess() { beanFactory = new DefaultListableBeanFactory(); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java index 29aa612110ff..0c328ce481dc 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java @@ -30,13 +30,13 @@ /** * Unit tests for {@link FieldRetrievingFactoryBean}. - * + * * @author Juergen Hoeller * @author Chris Beams * @since 31.07.2004 */ public final class FieldRetrievingFactoryBeanTests { - + private static final Resource CONTEXT = qualifiedResource(FieldRetrievingFactoryBeanTests.class, "context.xml"); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/MethodInvokingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/MethodInvokingFactoryBeanTests.java index bd11117a4ab1..a35b1e2948e6 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/MethodInvokingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/MethodInvokingFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ /** * Unit tests for {@link MethodInvokingFactoryBean}. - * + * * @author Colin Sampaleanu * @author Juergen Hoeller * @author Chris Beams diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java index 41c9ce811f1a..9352ec8c86cc 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2010 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,8 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ObjectFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import org.springframework.util.SerializationTestUtils; @@ -42,12 +43,14 @@ public class ObjectFactoryCreatingFactoryBeanTests { private static final Resource CONTEXT = qualifiedResource(ObjectFactoryCreatingFactoryBeanTests.class, "context.xml"); - - private XmlBeanFactory beanFactory; + + private DefaultListableBeanFactory beanFactory; @Before public void setUp() { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); + reader.loadBeanDefinitions(CONTEXT); this.beanFactory.setSerializationId("test"); } @@ -66,6 +69,7 @@ public void testFactoryOperation() throws Exception { assertTrue(date1 != date2); } + @SuppressWarnings("rawtypes") @Test public void testFactorySerialization() throws Exception { FactoryTestBean testBean = beanFactory.getBean("factoryTestBean", FactoryTestBean.class); @@ -88,6 +92,7 @@ public void testProviderOperation() throws Exception { assertTrue(date1 != date2); } + @SuppressWarnings("rawtypes") @Test public void testProviderSerialization() throws Exception { ProviderTestBean testBean = beanFactory.getBean("providerTestBean", ProviderTestBean.class); @@ -113,10 +118,10 @@ public void testDoesNotComplainWhenTargetBeanNameRefersToSingleton() throws Exce factory.setTargetBeanName(targetBeanName); factory.setBeanFactory(beanFactory); factory.afterPropertiesSet(); - ObjectFactory objectFactory = (ObjectFactory) factory.getObject(); + ObjectFactory objectFactory = factory.getObject(); Object actualSingleton = objectFactory.getObject(); assertSame(expectedSingleton, actualSingleton); - + verify(beanFactory); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java index ca972f349aae..409e3f8325d0 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,13 +26,13 @@ /** * Unit tests for {@link PropertiesFactoryBean}. - * + * * @author Juergen Hoeller * @author Chris Beams * @since 01.11.2003 */ public final class PropertiesFactoryBeanTests { - + private static final Class CLASS = PropertiesFactoryBeanTests.class; private static final Resource TEST_PROPS = qualifiedResource(CLASS, "test.properties"); private static final Resource TEST_PROPS_XML = qualifiedResource(CLASS, "test.properties.xml"); @@ -42,7 +42,7 @@ public void testWithPropertiesFile() throws Exception { PropertiesFactoryBean pfb = new PropertiesFactoryBean(); pfb.setLocation(TEST_PROPS); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("99", props.getProperty("tb.array[0].age")); } @@ -51,7 +51,7 @@ public void testWithPropertiesXmlFile() throws Exception { PropertiesFactoryBean pfb = new PropertiesFactoryBean(); pfb.setLocation(TEST_PROPS_XML); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("99", props.getProperty("tb.array[0].age")); } @@ -62,7 +62,7 @@ public void testWithLocalProperties() throws Exception { localProps.setProperty("key2", "value2"); pfb.setProperties(localProps); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("value2", props.getProperty("key2")); } @@ -75,7 +75,7 @@ public void testWithPropertiesFileAndLocalProperties() throws Exception { localProps.setProperty("tb.array[0].age", "0"); pfb.setProperties(localProps); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("99", props.getProperty("tb.array[0].age")); assertEquals("value2", props.getProperty("key2")); } @@ -100,7 +100,7 @@ public void testWithPropertiesFileAndMultipleLocalProperties() throws Exception pfb.setPropertiesArray(new Properties[] {props1, props2, props3}); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("99", props.getProperty("tb.array[0].age")); assertEquals("value2", props.getProperty("key2")); assertEquals("framework", props.getProperty("spring")); @@ -119,7 +119,7 @@ public void testWithPropertiesFileAndLocalPropertiesAndLocalOverride() throws Ex pfb.setProperties(localProps); pfb.setLocalOverride(true); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("0", props.getProperty("tb.array[0].age")); assertEquals("value2", props.getProperty("key2")); } @@ -133,10 +133,10 @@ public void testWithPrototype() throws Exception { localProps.setProperty("key2", "value2"); pfb.setProperties(localProps); pfb.afterPropertiesSet(); - Properties props = (Properties) pfb.getObject(); + Properties props = pfb.getObject(); assertEquals("99", props.getProperty("tb.array[0].age")); assertEquals("value2", props.getProperty("key2")); - Properties newProps = (Properties) pfb.getObject(); + Properties newProps = pfb.getObject(); assertTrue(props != newProps); assertEquals("99", newProps.getProperty("tb.array[0].age")); assertEquals("value2", newProps.getProperty("key2")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java index fd3891bf9987..c65ece988f8a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,10 @@ import static org.junit.Assert.*; import static test.util.TestResourceUtils.qualifiedResource; +import org.junit.Before; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.beans.ITestBean; @@ -28,24 +30,32 @@ /** * Unit tests for {@link PropertyPathFactoryBean}. - * + * * @author Juergen Hoeller * @author Chris Beams * @since 04.10.2004 */ public class PropertyPathFactoryBeanTests { - + private static final Resource CONTEXT = qualifiedResource(PropertyPathFactoryBeanTests.class, "context.xml"); + private DefaultListableBeanFactory bf; + + @Before + public void setup() { + this.bf = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf); + reader.loadBeanDefinitions(CONTEXT); + } + @Test public void testPropertyPathFactoryBeanWithSingletonResult() { - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); - assertEquals(new Integer(12), xbf.getBean("propertyPath1")); - assertEquals(new Integer(11), xbf.getBean("propertyPath2")); - assertEquals(new Integer(10), xbf.getBean("tb.age")); - assertEquals(ITestBean.class, xbf.getType("otb.spouse")); - Object result1 = xbf.getBean("otb.spouse"); - Object result2 = xbf.getBean("otb.spouse"); + assertEquals(new Integer(12), bf.getBean("propertyPath1")); + assertEquals(new Integer(11), bf.getBean("propertyPath2")); + assertEquals(new Integer(10), bf.getBean("tb.age")); + assertEquals(ITestBean.class, bf.getType("otb.spouse")); + Object result1 = bf.getBean("otb.spouse"); + Object result2 = bf.getBean("otb.spouse"); assertTrue(result1 instanceof TestBean); assertTrue(result1 == result2); assertEquals(99, ((TestBean) result1).getAge()); @@ -53,12 +63,11 @@ public void testPropertyPathFactoryBeanWithSingletonResult() { @Test public void testPropertyPathFactoryBeanWithPrototypeResult() { - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); - assertNull(xbf.getType("tb.spouse")); - assertEquals(TestBean.class, xbf.getType("propertyPath3")); - Object result1 = xbf.getBean("tb.spouse"); - Object result2 = xbf.getBean("propertyPath3"); - Object result3 = xbf.getBean("propertyPath3"); + assertNull(bf.getType("tb.spouse")); + assertEquals(TestBean.class, bf.getType("propertyPath3")); + Object result1 = bf.getBean("tb.spouse"); + Object result2 = bf.getBean("propertyPath3"); + Object result3 = bf.getBean("propertyPath3"); assertTrue(result1 instanceof TestBean); assertTrue(result2 instanceof TestBean); assertTrue(result3 instanceof TestBean); @@ -72,16 +81,14 @@ public void testPropertyPathFactoryBeanWithPrototypeResult() { @Test public void testPropertyPathFactoryBeanWithNullResult() { - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); - assertNull(xbf.getType("tb.spouse.spouse")); - assertNull(xbf.getBean("tb.spouse.spouse")); + assertNull(bf.getType("tb.spouse.spouse")); + assertNull(bf.getBean("tb.spouse.spouse")); } @Test public void testPropertyPathFactoryBeanAsInnerBean() { - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); - TestBean spouse = (TestBean) xbf.getBean("otb.spouse"); - TestBean tbWithInner = (TestBean) xbf.getBean("tbWithInner"); + TestBean spouse = (TestBean) bf.getBean("otb.spouse"); + TestBean tbWithInner = (TestBean) bf.getBean("tbWithInner"); assertSame(spouse, tbWithInner.getSpouse()); assertTrue(!tbWithInner.getFriends().isEmpty()); assertSame(spouse, tbWithInner.getFriends().iterator().next()); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java index 1f080734bc31..cd056d3278ef 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java @@ -16,11 +16,7 @@ package org.springframework.beans.factory.config; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition; import static test.util.TestResourceUtils.qualifiedResource; @@ -363,7 +359,7 @@ public void testPropertyPlaceholderConfigurerWithParentChildSeparation() { } private void doTestPropertyPlaceholderConfigurer(boolean parentChildSeparation) { - Map singletonMap = Collections.singletonMap("myKey", "myValue"); + Map singletonMap = Collections.singletonMap("myKey", "myValue"); if (parentChildSeparation) { MutablePropertyValues pvs1 = new MutablePropertyValues(); pvs1.add("age", "${age}"); @@ -371,7 +367,8 @@ private void doTestPropertyPlaceholderConfigurer(boolean parentChildSeparation) pvs2.add("name", "name${var}${var}${"); pvs2.add("spouse", new RuntimeBeanReference("${ref}")); pvs2.add("someMap", singletonMap); - RootBeanDefinition parent = new RootBeanDefinition(TestBean.class, pvs1); + RootBeanDefinition parent = new RootBeanDefinition(TestBean.class); + parent.setPropertyValues(pvs1); ChildBeanDefinition bd = new ChildBeanDefinition("${parent}", pvs2); factory.registerBeanDefinition("parent1", parent); factory.registerBeanDefinition("tb1", bd); @@ -382,7 +379,8 @@ private void doTestPropertyPlaceholderConfigurer(boolean parentChildSeparation) pvs.add("name", "name${var}${var}${"); pvs.add("spouse", new RuntimeBeanReference("${ref}")); pvs.add("someMap", singletonMap); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(pvs); factory.registerBeanDefinition("tb1", bd); } @@ -412,12 +410,14 @@ private void doTestPropertyPlaceholderConfigurer(boolean parentChildSeparation) someMap.put("key2", "${age}name"); MutablePropertyValues innerPvs = new MutablePropertyValues(); innerPvs.add("touchy", "${os.name}"); - someMap.put("key3", new RootBeanDefinition(TestBean.class, innerPvs)); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setPropertyValues(innerPvs); + someMap.put("key3", bd); MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs); someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child")); pvs.add("someMap", someMap); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, cas, pvs); + bd = new RootBeanDefinition(TestBean.class, cas, pvs); factory.registerBeanDefinition("tb2", bd); PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); @@ -640,6 +640,7 @@ public void testPropertyPlaceholderConfigurerWithSelfReferencingPlaceholderInAli ppc.postProcessBeanFactory(factory); TestBean tb = (TestBean) factory.getBean("tb"); + assertNotNull(tb); assertEquals(0, factory.getAliases("tb").length); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBeanTests.java index afb273a5b575..4a297b17a79e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ /** * Unit tests for {@link ServiceLocatorFactoryBean}. - * + * * @author Colin Sampaleanu * @author Rick Evans * @author Chris Beams @@ -40,7 +40,7 @@ public final class ServiceLocatorFactoryBeanTests { private DefaultListableBeanFactory bf; - + @Before public void setUp() { bf = new DefaultListableBeanFactory(); @@ -53,7 +53,7 @@ public void testNoArgGetter() { genericBeanDefinition(ServiceLocatorFactoryBean.class) .addPropertyValue("serviceLocatorInterface", TestServiceLocator.class) .getBeanDefinition()); - + TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory"); TestService testService = factory.getTestService(); assertNotNull(testService); @@ -75,13 +75,13 @@ public void testErrorOnTooManyOrTooFew() throws Exception { genericBeanDefinition(ServiceLocatorFactoryBean.class) .addPropertyValue("serviceLocatorInterface", TestService2Locator.class) .getBeanDefinition()); - + try { TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory"); factory.getTestService(); fail("Must fail on more than one matching type"); } catch (NoSuchBeanDefinitionException ex) { /* expected */ } - + try { TestServiceLocator2 factory = (TestServiceLocator2) bf.getBean("factory2"); factory.getTestService(null); @@ -114,7 +114,7 @@ public void testErrorOnTooManyOrTooFewWithCustomServiceLocatorException() { .addPropertyValue("serviceLocatorInterface", TestService2Locator.class) .addPropertyValue("serviceLocatorExceptionClass", CustomServiceLocatorException3.class) .getBeanDefinition()); - + try { TestServiceLocator factory = (TestServiceLocator) bf.getBean("factory"); factory.getTestService(); @@ -123,7 +123,7 @@ public void testErrorOnTooManyOrTooFewWithCustomServiceLocatorException() { catch (CustomServiceLocatorException1 expected) { assertTrue(expected.getCause() instanceof NoSuchBeanDefinitionException); } - + try { TestServiceLocator2 factory2 = (TestServiceLocator2) bf.getBean("factory2"); factory2.getTestService(null); @@ -132,7 +132,7 @@ public void testErrorOnTooManyOrTooFewWithCustomServiceLocatorException() { catch (CustomServiceLocatorException2 expected) { assertTrue(expected.getCause() instanceof NoSuchBeanDefinitionException); } - + try { TestService2Locator factory3 = (TestService2Locator) bf.getBean("factory3"); factory3.getTestService(); @@ -150,7 +150,7 @@ public void testStringArgGetter() throws Exception { // test string-arg getter with null id TestServiceLocator2 factory = (TestServiceLocator2) bf.getBean("factory"); - + @SuppressWarnings("unused") TestService testBean = factory.getTestService(null); // now test with explicit id @@ -166,12 +166,12 @@ public void testStringArgGetter() throws Exception { public void testCombinedLocatorInterface() { bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition()); bf.registerAlias("testService", "1"); - + bf.registerBeanDefinition("factory", genericBeanDefinition(ServiceLocatorFactoryBean.class) .addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class) .getBeanDefinition()); - + // StaticApplicationContext ctx = new StaticApplicationContext(); // ctx.registerPrototype("testService", TestService.class, new MutablePropertyValues()); // ctx.registerAlias("testService", "1"); @@ -204,7 +204,7 @@ public void testServiceMappings() { .addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class) .addPropertyValue("serviceMappings", "=testService1\n1=testService1\n2=testService2") .getBeanDefinition()); - + // StaticApplicationContext ctx = new StaticApplicationContext(); // ctx.registerPrototype("testService1", TestService.class, new MutablePropertyValues()); // ctx.registerPrototype("testService2", ExtendedTestService.class, new MutablePropertyValues()); @@ -233,12 +233,12 @@ public void testServiceMappings() { @Test(expected=IllegalArgumentException.class) public void testNoServiceLocatorInterfaceSupplied() throws Exception { - new ServiceLocatorFactoryBean().afterPropertiesSet(); + new ServiceLocatorFactoryBean().afterPropertiesSet(); } @Test(expected=IllegalArgumentException.class) public void testWhenServiceLocatorInterfaceIsNotAnInterfaceType() throws Exception { - ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); + ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); factory.setServiceLocatorInterface(getClass()); factory.afterPropertiesSet(); // should throw, bad (non-interface-type) serviceLocator interface supplied @@ -246,21 +246,22 @@ public void testWhenServiceLocatorInterfaceIsNotAnInterfaceType() throws Excepti @Test(expected=IllegalArgumentException.class) public void testWhenServiceLocatorExceptionClassToExceptionTypeWithOnlyNoArgCtor() throws Exception { - ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); + ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); factory.setServiceLocatorExceptionClass(ExceptionClassWithOnlyZeroArgCtor.class); // should throw, bad (invalid-Exception-type) serviceLocatorException class supplied } - @Test(expected=IllegalArgumentException.class) + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Test(expected = IllegalArgumentException.class) public void testWhenServiceLocatorExceptionClassIsNotAnExceptionSubclass() throws Exception { - ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); - factory.setServiceLocatorExceptionClass(getClass()); + ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); + factory.setServiceLocatorExceptionClass((Class)getClass()); // should throw, bad (non-Exception-type) serviceLocatorException class supplied } @Test(expected=UnsupportedOperationException.class) public void testWhenServiceLocatorMethodCalledWithTooManyParameters() throws Exception { - ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); + ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); factory.setServiceLocatorInterface(ServiceLocatorInterfaceWithExtraNonCompliantMethod.class); factory.afterPropertiesSet(); ServiceLocatorInterfaceWithExtraNonCompliantMethod locator = (ServiceLocatorInterfaceWithExtraNonCompliantMethod) factory.getObject(); @@ -273,7 +274,7 @@ public void testRequiresListableBeanFactoryAndChokesOnAnythingElse() throws Exce replay(beanFactory); try { - ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); + ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean(); factory.setBeanFactory(beanFactory); } catch (FatalBeanException ex) { // expected diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java index 683309211908..3a7bdabdb1f5 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,11 +39,11 @@ * @author Chris Beams */ public final class SimpleScopeTests { - + private static final Resource CONTEXT = qualifiedResource(SimpleScopeTests.class, "context.xml"); private DefaultListableBeanFactory beanFactory; - + @Before public void setUp() { beanFactory = new DefaultListableBeanFactory(); @@ -71,7 +71,7 @@ public Object get(String name, ObjectFactory objectFactory) { XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(beanFactory); xbdr.loadBeanDefinitions(CONTEXT); } - + @Test public void testCanGetScopedObject() { TestBean tb1 = (TestBean) beanFactory.getBean("usesScope"); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/TestTypes.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/TestTypes.java index 2aec11ef7138..5460f8bd0160 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/TestTypes.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/TestTypes.java @@ -20,7 +20,7 @@ /** * Shared test types for this package. - * + * * @author Chris Beams */ final class TestTypes {} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java index 774fb0b5a830..242a1f54d624 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ * @since 2.0 */ public final class CustomProblemReporterTests { - + private static final Resource CONTEXT = qualifiedResource(CustomProblemReporterTests.class, "context.xml"); private CollatingProblemReporter problemReporter; @@ -64,7 +64,7 @@ public void testErrorsAreCollated() { } - private static class CollatingProblemReporter implements ProblemReporter { + public static class CollatingProblemReporter implements ProblemReporter { private List errors = new ArrayList(); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/FailFastProblemReporterTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/FailFastProblemReporterTests.java index 3ebe8ec705ad..fb24cab3b82b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/FailFastProblemReporterTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/FailFastProblemReporterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/NullSourceExtractorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/NullSourceExtractorTests.java index 5241e7662f27..5edd20bbe304 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/NullSourceExtractorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/NullSourceExtractorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/ParseStateTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/ParseStateTests.java index 746d0c933b07..e607af90499c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/ParseStateTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/ParseStateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractorTests.java index c8d5e9c1ec73..afdc8dfccf23 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Unit tests for {@link PassThroughSourceExtractor}. - * + * * @author Rick Evans * @author Chris Beams */ @@ -30,7 +30,7 @@ public final class PassThroughSourceExtractorTests { @Test public void testPassThroughContract() throws Exception { - Object source = new Object(); + Object source = new Object(); Object extractedSource = new PassThroughSourceExtractor().extractSource(source, null); assertSame("The contract of PassThroughSourceExtractor states that the supplied " + "source object *must* be returned as-is", source, extractedSource); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java index 6eecc322e841..23a1e98aa7ce 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Arrays; +import org.springframework.beans.factory.config.BeanDefinition; + import junit.framework.TestCase; import test.beans.TestBean; @@ -31,7 +33,7 @@ public class BeanDefinitionBuilderTests extends TestCase { public void testBeanClassWithSimpleProperty() { String[] dependsOn = new String[] { "A", "B", "C" }; BeanDefinitionBuilder bdb = BeanDefinitionBuilder.rootBeanDefinition(TestBean.class); - bdb.setSingleton(false).addPropertyReference("age", "15"); + bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE).addPropertyReference("age", "15"); for (int i = 0; i < dependsOn.length; i++) { bdb.addDependsOn(dependsOn[i]); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java index cb365b39fda3..8de693937ba1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ import junit.framework.TestCase; +import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; import test.beans.TestBean; @@ -120,7 +121,7 @@ public void testBeanDefinitionMerging() { bd.getPropertyValues().add("name", "myName"); bd.getPropertyValues().add("age", "99"); - ChildBeanDefinition childBd = new ChildBeanDefinition("bd"); + BeanDefinition childBd = new ChildBeanDefinition("bd"); RootBeanDefinition mergedBd = new RootBeanDefinition(bd); mergedBd.overrideFrom(childBd); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java index be2cfdf2979a..2f8623657ecb 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java @@ -30,7 +30,7 @@ import static org.junit.Assert.*; -import org.easymock.EasyMock; +import org.junit.Before; import org.junit.Test; import test.beans.GenericBean; import test.beans.GenericIntegerBean; @@ -40,7 +40,7 @@ import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.PropertyEditorRegistry; import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.UrlResource; @@ -53,6 +53,16 @@ */ public class BeanFactoryGenericsTests { + private DefaultListableBeanFactory bf; + + @Before + public void setup() { + this.bf = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf); + reader.loadBeanDefinitions(new ClassPathResource("genericBeanTests.xml", + getClass())); + } + @Test public void testGenericSetProperty() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); @@ -93,7 +103,8 @@ public void testGenericListPropertyWithAutowiring() throws MalformedURLException bf.registerSingleton("resource1", new UrlResource("http://localhost:8080")); bf.registerSingleton("resource2", new UrlResource("http://localhost:9090")); - RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); bf.registerBeanDefinition("genericBean", rbd); GenericIntegerBean gb = (GenericIntegerBean) bf.getBean("genericBean"); @@ -106,7 +117,7 @@ public void testGenericListPropertyWithInvalidElementType() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class); - List input = new ArrayList(); + List input = new ArrayList(); input.add(1); rbd.getPropertyValues().add("testBeanList", input); @@ -125,7 +136,8 @@ public void testGenericListPropertyWithInvalidElementType() { public void testGenericListPropertyWithOptionalAutowiring() throws MalformedURLException { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); - RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); bf.registerBeanDefinition("genericBean", rbd); GenericBean gb = (GenericBean) bf.getBean("genericBean"); @@ -151,7 +163,6 @@ public void testGenericMapProperty() { @Test public void testGenericListOfArraysProperty() throws MalformedURLException { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); GenericBean gb = (GenericBean) bf.getBean("listOfArrays"); assertEquals(1, gb.getListOfArrays().size()); @@ -185,7 +196,8 @@ public void testGenericSetConstructorWithAutowiring() { bf.registerSingleton("integer1", new Integer(4)); bf.registerSingleton("integer2", new Integer(5)); - RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("genericBean", rbd); GenericBean gb = (GenericBean) bf.getBean("genericBean"); @@ -197,7 +209,8 @@ public void testGenericSetConstructorWithAutowiring() { public void testGenericSetConstructorWithOptionalAutowiring() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); - RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("genericBean", rbd); GenericBean gb = (GenericBean) bf.getBean("genericBean"); @@ -235,7 +248,8 @@ public void testGenericSetListConstructorWithAutowiring() throws MalformedURLExc bf.registerSingleton("resource1", new UrlResource("http://localhost:8080")); bf.registerSingleton("resource2", new UrlResource("http://localhost:9090")); - RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("genericBean", rbd); GenericBean gb = (GenericBean) bf.getBean("genericBean"); @@ -251,7 +265,8 @@ public void testGenericSetListConstructorWithOptionalAutowiring() throws Malform bf.registerSingleton("resource1", new UrlResource("http://localhost:8080")); bf.registerSingleton("resource2", new UrlResource("http://localhost:9090")); - RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); + RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class); + rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); bf.registerBeanDefinition("genericBean", rbd); GenericBean gb = (GenericBean) bf.getBean("genericBean"); @@ -573,7 +588,6 @@ public void registerCustomEditors(PropertyEditorRegistry registry) { @Test public void testGenericListBean() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); List list = (List) bf.getBean("list"); assertEquals(1, list.size()); assertEquals(new URL("http://localhost:8080"), list.get(0)); @@ -581,7 +595,6 @@ public void testGenericListBean() throws Exception { @Test public void testGenericSetBean() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); Set set = (Set) bf.getBean("set"); assertEquals(1, set.size()); assertEquals(new URL("http://localhost:8080"), set.iterator().next()); @@ -589,7 +602,6 @@ public void testGenericSetBean() throws Exception { @Test public void testGenericMapBean() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); Map map = (Map) bf.getBean("map"); assertEquals(1, map.size()); assertEquals(new Integer(10), map.keySet().iterator().next()); @@ -598,7 +610,6 @@ public void testGenericMapBean() throws Exception { @Test public void testGenericallyTypedIntegerBean() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); GenericIntegerBean gb = (GenericIntegerBean) bf.getBean("integerBean"); assertEquals(new Integer(10), gb.getGenericProperty()); assertEquals(new Integer(20), gb.getGenericListProperty().get(0)); @@ -607,7 +618,6 @@ public void testGenericallyTypedIntegerBean() throws Exception { @Test public void testGenericallyTypedSetOfIntegerBean() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); GenericSetOfIntegerBean gb = (GenericSetOfIntegerBean) bf.getBean("setOfIntegerBean"); assertEquals(new Integer(10), gb.getGenericProperty().iterator().next()); assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next()); @@ -616,7 +626,6 @@ public void testGenericallyTypedSetOfIntegerBean() throws Exception { @Test public void testSetBean() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass())); UrlSet us = (UrlSet) bf.getBean("setBean"); assertEquals(1, us.size()); assertEquals(new URL("http://www.springframework.org"), us.iterator().next()); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedListTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedListTests.java index 9dc27c7f373d..3c4ff57fe72e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedListTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedListTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,25 +27,25 @@ public class ManagedListTests extends TestCase { public void testMergeSunnyDay() { - ManagedList parent = new ManagedList(); + ManagedList parent = new ManagedList(); parent.add("one"); parent.add("two"); - ManagedList child = new ManagedList(); + ManagedList child = new ManagedList(); child.add("three"); child.setMergeEnabled(true); - List mergedList = (List) child.merge(parent); + List mergedList = child.merge(parent); assertEquals("merge() obviously did not work.", 3, mergedList.size()); } public void testMergeWithNullParent() { - ManagedList child = new ManagedList(); + ManagedList child = new ManagedList(); child.add("one"); child.setMergeEnabled(true); assertSame(child, child.merge(null)); } public void testMergeNotAllowedWhenMergeNotEnabled() { - ManagedList child = new ManagedList(); + ManagedList child = new ManagedList(); try { child.merge(null); fail("Must have failed by this point (cannot merge() when the mergeEnabled property is false."); @@ -55,7 +55,7 @@ public void testMergeNotAllowedWhenMergeNotEnabled() { } public void testMergeWithNonCompatibleParentType() { - ManagedList child = new ManagedList(); + ManagedList child = new ManagedList(); child.add("one"); child.setMergeEnabled(true); try { @@ -67,24 +67,24 @@ public void testMergeWithNonCompatibleParentType() { } public void testMergeEmptyChild() { - ManagedList parent = new ManagedList(); + ManagedList parent = new ManagedList(); parent.add("one"); parent.add("two"); - ManagedList child = new ManagedList(); + ManagedList child = new ManagedList(); child.setMergeEnabled(true); - List mergedList = (List) child.merge(parent); + List mergedList = child.merge(parent); assertEquals("merge() obviously did not work.", 2, mergedList.size()); } public void testMergeChildValuesOverrideTheParents() { // doesn't make a whole lotta sense in the context of a list... - ManagedList parent = new ManagedList(); + ManagedList parent = new ManagedList(); parent.add("one"); parent.add("two"); - ManagedList child = new ManagedList(); + ManagedList child = new ManagedList(); child.add("one"); child.setMergeEnabled(true); - List mergedList = (List) child.merge(parent); + List mergedList = child.merge(parent); assertEquals("merge() obviously did not work.", 3, mergedList.size()); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedMapTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedMapTests.java index c86752d8e9a2..5aa4cc24f430 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedMapTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedMapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,24 +27,25 @@ public class ManagedMapTests extends TestCase { public void testMergeSunnyDay() { - ManagedMap parent = new ManagedMap(); + ManagedMap parent = new ManagedMap(); parent.put("one", "one"); parent.put("two", "two"); - ManagedMap child = new ManagedMap(); + ManagedMap child = new ManagedMap(); child.put("three", "three"); child.setMergeEnabled(true); - Map mergedMap = (Map) child.merge(parent); + @SuppressWarnings("unchecked") + Map mergedMap = (Map) child.merge(parent); assertEquals("merge() obviously did not work.", 3, mergedMap.size()); } public void testMergeWithNullParent() { - ManagedMap child = new ManagedMap(); + ManagedMap child = new ManagedMap(); child.setMergeEnabled(true); assertSame(child, child.merge(null)); } public void testMergeWithNonCompatibleParentType() { - ManagedMap map = new ManagedMap(); + ManagedMap map = new ManagedMap(); map.setMergeEnabled(true); try { map.merge("hello"); @@ -55,7 +56,7 @@ public void testMergeWithNonCompatibleParentType() { } public void testMergeNotAllowedWhenMergeNotEnabled() { - ManagedMap map = new ManagedMap(); + ManagedMap map = new ManagedMap(); try { map.merge(null); fail("Must have failed by this point (cannot merge() when the mergeEnabled property is false."); @@ -65,23 +66,25 @@ public void testMergeNotAllowedWhenMergeNotEnabled() { } public void testMergeEmptyChild() { - ManagedMap parent = new ManagedMap(); + ManagedMap parent = new ManagedMap(); parent.put("one", "one"); parent.put("two", "two"); - ManagedMap child = new ManagedMap(); + ManagedMap child = new ManagedMap(); child.setMergeEnabled(true); - Map mergedMap = (Map) child.merge(parent); + @SuppressWarnings("unchecked") + Map mergedMap = (Map) child.merge(parent); assertEquals("merge() obviously did not work.", 2, mergedMap.size()); } public void testMergeChildValuesOverrideTheParents() { - ManagedMap parent = new ManagedMap(); + ManagedMap parent = new ManagedMap(); parent.put("one", "one"); parent.put("two", "two"); - ManagedMap child = new ManagedMap(); + ManagedMap child = new ManagedMap(); child.put("one", "fork"); child.setMergeEnabled(true); - Map mergedMap = (Map) child.merge(parent); + @SuppressWarnings("unchecked") + Map mergedMap = (Map) child.merge(parent); // child value for 'one' must override parent value... assertEquals("merge() obviously did not work.", 2, mergedMap.size()); assertEquals("Parent value not being overridden during merge().", "fork", mergedMap.get("one")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedPropertiesTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedPropertiesTests.java index 7594ab6cdddf..23cfb8657134 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedPropertiesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,8 @@ public void testMergeSunnyDay() { ManagedProperties child = new ManagedProperties(); child.setProperty("three", "three"); child.setMergeEnabled(true); - Map mergedMap = (Map) child.merge(parent); + @SuppressWarnings("unchecked") + Map mergedMap = (Map) child.merge(parent); assertEquals("merge() obviously did not work.", 3, mergedMap.size()); } @@ -70,7 +71,8 @@ public void testMergeEmptyChild() { parent.setProperty("two", "two"); ManagedProperties child = new ManagedProperties(); child.setMergeEnabled(true); - Map mergedMap = (Map) child.merge(parent); + @SuppressWarnings("unchecked") + Map mergedMap = (Map) child.merge(parent); assertEquals("merge() obviously did not work.", 2, mergedMap.size()); } @@ -81,7 +83,8 @@ public void testMergeChildValuesOverrideTheParents() { ManagedProperties child = new ManagedProperties(); child.setProperty("one", "fork"); child.setMergeEnabled(true); - Map mergedMap = (Map) child.merge(parent); + @SuppressWarnings("unchecked") + Map mergedMap = (Map) child.merge(parent); // child value for 'one' must override parent value... assertEquals("merge() obviously did not work.", 2, mergedMap.size()); assertEquals("Parent value not being overridden during merge().", "fork", mergedMap.get("one")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedSetTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedSetTests.java index 0eea409ab89a..4dba6eed58ce 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedSetTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedSetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,25 +27,25 @@ public class ManagedSetTests extends TestCase { public void testMergeSunnyDay() { - ManagedSet parent = new ManagedSet(); + ManagedSet parent = new ManagedSet(); parent.add("one"); parent.add("two"); - ManagedSet child = new ManagedSet(); + ManagedSet child = new ManagedSet(); child.add("three"); child.setMergeEnabled(true); - Set mergedSet = (Set) child.merge(parent); + Set mergedSet = child.merge(parent); assertEquals("merge() obviously did not work.", 3, mergedSet.size()); } public void testMergeWithNullParent() { - ManagedSet child = new ManagedSet(); + ManagedSet child = new ManagedSet(); child.add("one"); child.setMergeEnabled(true); assertSame(child, child.merge(null)); } public void testMergeNotAllowedWhenMergeNotEnabled() { - ManagedSet child = new ManagedSet(); + ManagedSet child = new ManagedSet(); try { child.merge(null); fail("Must have failed by this point (cannot merge() when the mergeEnabled property is false."); @@ -55,7 +55,7 @@ public void testMergeNotAllowedWhenMergeNotEnabled() { } public void testMergeWithNonCompatibleParentType() { - ManagedSet child = new ManagedSet(); + ManagedSet child = new ManagedSet(); child.add("one"); child.setMergeEnabled(true); try { @@ -67,24 +67,24 @@ public void testMergeWithNonCompatibleParentType() { } public void testMergeEmptyChild() { - ManagedSet parent = new ManagedSet(); + ManagedSet parent = new ManagedSet(); parent.add("one"); parent.add("two"); - ManagedSet child = new ManagedSet(); + ManagedSet child = new ManagedSet(); child.setMergeEnabled(true); - Set mergedSet = (Set) child.merge(parent); + Set mergedSet = child.merge(parent); assertEquals("merge() obviously did not work.", 2, mergedSet.size()); } public void testMergeChildValuesOverrideTheParents() { // asserts that the set contract is not violated during a merge() operation... - ManagedSet parent = new ManagedSet(); + ManagedSet parent = new ManagedSet(); parent.add("one"); parent.add("two"); - ManagedSet child = new ManagedSet(); + ManagedSet child = new ManagedSet(); child.add("one"); child.setMergeEnabled(true); - Set mergedSet = (Set) child.merge(parent); + Set mergedSet = child.merge(parent); assertEquals("merge() obviously did not work.", 2, mergedSet.size()); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java index 3442e720d4c2..51ad213963b1 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java index b995560e5fc4..4c044e40f86c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,9 +53,9 @@ public void testAutowireCandidateDefaultWithIrrelevantDescriptor() throws Except RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null); lbf.registerBeanDefinition(JUERGEN, rbd); assertTrue(lbf.isAutowireCandidate(JUERGEN, null)); - assertTrue(lbf.isAutowireCandidate(JUERGEN, + assertTrue(lbf.isAutowireCandidate(JUERGEN, new DependencyDescriptor(Person.class.getDeclaredField("name"), false))); - assertTrue(lbf.isAutowireCandidate(JUERGEN, + assertTrue(lbf.isAutowireCandidate(JUERGEN, new DependencyDescriptor(Person.class.getDeclaredField("name"), true))); } @@ -68,16 +68,16 @@ public void testAutowireCandidateExplicitlyFalseWithIrrelevantDescriptor() throw rbd.setAutowireCandidate(false); lbf.registerBeanDefinition(JUERGEN, rbd); assertFalse(lbf.isAutowireCandidate(JUERGEN, null)); - assertFalse(lbf.isAutowireCandidate(JUERGEN, + assertFalse(lbf.isAutowireCandidate(JUERGEN, new DependencyDescriptor(Person.class.getDeclaredField("name"), false))); - assertFalse(lbf.isAutowireCandidate(JUERGEN, + assertFalse(lbf.isAutowireCandidate(JUERGEN, new DependencyDescriptor(Person.class.getDeclaredField("name"), true))); } @Ignore @Test public void testAutowireCandidateWithFieldDescriptor() throws Exception { - DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); + DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); ConstructorArgumentValues cavs1 = new ConstructorArgumentValues(); cavs1.addGenericArgumentValue(JUERGEN); RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null); @@ -101,7 +101,7 @@ public void testAutowireCandidateWithFieldDescriptor() throws Exception { @Test public void testAutowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception { - DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); + DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); ConstructorArgumentValues cavs = new ConstructorArgumentValues(); cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); @@ -119,7 +119,7 @@ public void testAutowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exc @Test public void testAutowireCandidateWithShortClassName() throws Exception { - DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); + DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); ConstructorArgumentValues cavs = new ConstructorArgumentValues(); cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); @@ -137,7 +137,7 @@ public void testAutowireCandidateWithShortClassName() throws Exception { @Ignore @Test public void testAutowireCandidateWithConstructorDescriptor() throws Exception { - DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); + DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); ConstructorArgumentValues cavs1 = new ConstructorArgumentValues(); cavs1.addGenericArgumentValue(JUERGEN); RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null); @@ -159,7 +159,7 @@ public void testAutowireCandidateWithConstructorDescriptor() throws Exception { @Ignore @Test public void testAutowireCandidateWithMethodDescriptor() throws Exception { - DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); + DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); ConstructorArgumentValues cavs1 = new ConstructorArgumentValues(); cavs1.addGenericArgumentValue(JUERGEN); RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null); @@ -189,7 +189,7 @@ public void testAutowireCandidateWithMethodDescriptor() throws Exception { @Test public void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Exception { - DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); + DefaultListableBeanFactory lbf = new DefaultListableBeanFactory(); ConstructorArgumentValues cavs1 = new ConstructorArgumentValues(); cavs1.addGenericArgumentValue(JUERGEN); RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null); @@ -208,11 +208,13 @@ public void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Excep } - private static class QualifiedTestBean { + public static class QualifiedTestBean { @TestQualifier + @SuppressWarnings("unused") private Person qualified; + @SuppressWarnings("unused") private Person nonqualified; public QualifiedTestBean(@TestQualifier Person tpb) { @@ -226,7 +228,7 @@ public void autowireNonqualified(Person tpb) { } - private static class Person { + public static class Person { private String name; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java index 497352028ad9..a385b18ce983 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2012 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -56,216 +56,25 @@ import org.springframework.beans.factory.support.SecurityContextProvider; import org.springframework.beans.factory.support.security.support.ConstructorBean; import org.springframework.beans.factory.support.security.support.CustomCallbackBean; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; /** * Security test case. Checks whether the container uses its privileges for its * internal work but does not leak them when touching/calling user code. - * + * *t The first half of the test case checks that permissions are downgraded when * calling user code while the second half that the caller code permission get * through and Spring doesn't override the permission stack. - * + * * @author Costin Leau */ public class CallbacksSecurityTests { - private XmlBeanFactory beanFactory; + private DefaultListableBeanFactory beanFactory; private SecurityContextProvider provider; - private static class NonPrivilegedBean { - - private String expectedName; - public static boolean destroyed = false; - - public NonPrivilegedBean(String expected) { - this.expectedName = expected; - checkCurrentContext(); - } - - public void init() { - checkCurrentContext(); - } - - public void destroy() { - checkCurrentContext(); - destroyed = true; - } - - public void setProperty(Object value) { - checkCurrentContext(); - } - - public Object getProperty() { - checkCurrentContext(); - return null; - } - - public void setListProperty(Object value) { - checkCurrentContext(); - } - - public Object getListProperty() { - checkCurrentContext(); - return null; - } - - private void checkCurrentContext() { - assertEquals(expectedName, getCurrentSubjectName()); - } - } - - private static class NonPrivilegedSpringCallbacksBean implements - InitializingBean, DisposableBean, BeanClassLoaderAware, - BeanFactoryAware, BeanNameAware { - - private String expectedName; - public static boolean destroyed = false; - - public NonPrivilegedSpringCallbacksBean(String expected) { - this.expectedName = expected; - checkCurrentContext(); - } - - public void afterPropertiesSet() { - checkCurrentContext(); - } - - public void destroy() { - checkCurrentContext(); - destroyed = true; - } - - public void setBeanName(String name) { - checkCurrentContext(); - } - - public void setBeanClassLoader(ClassLoader classLoader) { - checkCurrentContext(); - } - - public void setBeanFactory(BeanFactory beanFactory) - throws BeansException { - checkCurrentContext(); - } - - private void checkCurrentContext() { - assertEquals(expectedName, getCurrentSubjectName()); - } - } - - private static class NonPrivilegedFactoryBean implements SmartFactoryBean { - private String expectedName; - - public NonPrivilegedFactoryBean(String expected) { - this.expectedName = expected; - checkCurrentContext(); - } - - public boolean isEagerInit() { - checkCurrentContext(); - return false; - } - - public boolean isPrototype() { - checkCurrentContext(); - return true; - } - - public Object getObject() throws Exception { - checkCurrentContext(); - return new Object(); - } - - public Class getObjectType() { - checkCurrentContext(); - return Object.class; - } - - public boolean isSingleton() { - checkCurrentContext(); - return false; - } - - private void checkCurrentContext() { - assertEquals(expectedName, getCurrentSubjectName()); - } - } - - private static class NonPrivilegedFactory { - - private final String expectedName; - - public NonPrivilegedFactory(String expected) { - this.expectedName = expected; - assertEquals(expectedName, getCurrentSubjectName()); - } - - public static Object makeStaticInstance(String expectedName) { - assertEquals(expectedName, getCurrentSubjectName()); - return new Object(); - } - - public Object makeInstance() { - assertEquals(expectedName, getCurrentSubjectName()); - return new Object(); - } - } - - private static String getCurrentSubjectName() { - final AccessControlContext acc = AccessController.getContext(); - - return AccessController.doPrivileged(new PrivilegedAction() { - - public String run() { - Subject subject = Subject.getSubject(acc); - if (subject == null) { - return null; - } - - Set principals = subject.getPrincipals(); - - if (principals == null) { - return null; - } - for (Principal p : principals) { - return p.getName(); - } - return null; - } - }); - } - - private static class TestPrincipal implements Principal { - - private String name; - - public TestPrincipal(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof TestPrincipal)) { - return false; - } - TestPrincipal p = (TestPrincipal) obj; - return this.name.equals(p.name); - } - - public int hashCode() { - return this.name.hashCode(); - } - } - public CallbacksSecurityTests() { // setup security if (System.getSecurityManager() == null) { @@ -297,9 +106,10 @@ public AccessControlContext getAccessControlContext() { }; DefaultResourceLoader drl = new DefaultResourceLoader(); - Resource config = drl - .getResource("/org/springframework/beans/factory/support/security/callbacks.xml"); - beanFactory = new XmlBeanFactory(config); + Resource config = drl.getResource("/org/springframework/beans/factory/support/security/callbacks.xml"); + beanFactory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); + reader.loadBeanDefinitions(config); beanFactory.setSecurityContextProvider(provider); } @@ -314,14 +124,14 @@ public void testSecuritySanity() throws Exception { } final CustomCallbackBean bean = new CustomCallbackBean(); - final Method method = bean.getClass().getMethod("destroy", null); + final Method method = bean.getClass().getMethod("destroy"); method.setAccessible(true); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { - method.invoke(bean, null); + method.invoke(bean); return null; } }, acc); @@ -352,7 +162,7 @@ public void testSpringInitBean() throws Exception { assertTrue(ex.getCause() instanceof SecurityException); } } - + @Test public void testCustomInitBean() throws Exception { try { @@ -493,8 +303,7 @@ public void testTrustedExecution() throws Exception { perms.add(new AuthPermission("getSubject")); ProtectionDomain pd = new ProtectionDomain(null, perms); - AccessControlContext acc = new AccessControlContext( - new ProtectionDomain[] { pd }); + new AccessControlContext(new ProtectionDomain[] { pd }); final Subject subject = new Subject(); subject.getPrincipals().add(new TestPrincipal("user1")); @@ -526,4 +335,196 @@ public Object run() { } }, provider.getAccessControlContext()); } + + public static class NonPrivilegedBean { + + private String expectedName; + + public static boolean destroyed = false; + + public NonPrivilegedBean(String expected) { + this.expectedName = expected; + checkCurrentContext(); + } + + public void init() { + checkCurrentContext(); + } + + public void destroy() { + checkCurrentContext(); + destroyed = true; + } + + public void setProperty(Object value) { + checkCurrentContext(); + } + + public Object getProperty() { + checkCurrentContext(); + return null; + } + + public void setListProperty(Object value) { + checkCurrentContext(); + } + + public Object getListProperty() { + checkCurrentContext(); + return null; + } + + private void checkCurrentContext() { + assertEquals(expectedName, getCurrentSubjectName()); + } + } + + public static class NonPrivilegedSpringCallbacksBean implements InitializingBean, + DisposableBean, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware { + + private String expectedName; + + public static boolean destroyed = false; + + public NonPrivilegedSpringCallbacksBean(String expected) { + this.expectedName = expected; + checkCurrentContext(); + } + + public void afterPropertiesSet() { + checkCurrentContext(); + } + + public void destroy() { + checkCurrentContext(); + destroyed = true; + } + + public void setBeanName(String name) { + checkCurrentContext(); + } + + public void setBeanClassLoader(ClassLoader classLoader) { + checkCurrentContext(); + } + + public void setBeanFactory(BeanFactory beanFactory) throws BeansException { + checkCurrentContext(); + } + + private void checkCurrentContext() { + assertEquals(expectedName, getCurrentSubjectName()); + } + } + + public static class NonPrivilegedFactoryBean implements SmartFactoryBean { + + private String expectedName; + + public NonPrivilegedFactoryBean(String expected) { + this.expectedName = expected; + checkCurrentContext(); + } + + public boolean isEagerInit() { + checkCurrentContext(); + return false; + } + + public boolean isPrototype() { + checkCurrentContext(); + return true; + } + + public Object getObject() throws Exception { + checkCurrentContext(); + return new Object(); + } + + public Class getObjectType() { + checkCurrentContext(); + return Object.class; + } + + public boolean isSingleton() { + checkCurrentContext(); + return false; + } + + private void checkCurrentContext() { + assertEquals(expectedName, getCurrentSubjectName()); + } + } + + public static class NonPrivilegedFactory { + + private final String expectedName; + + public NonPrivilegedFactory(String expected) { + this.expectedName = expected; + assertEquals(expectedName, getCurrentSubjectName()); + } + + public static Object makeStaticInstance(String expectedName) { + assertEquals(expectedName, getCurrentSubjectName()); + return new Object(); + } + + public Object makeInstance() { + assertEquals(expectedName, getCurrentSubjectName()); + return new Object(); + } + } + + public static String getCurrentSubjectName() { + final AccessControlContext acc = AccessController.getContext(); + + return AccessController.doPrivileged(new PrivilegedAction() { + + public String run() { + Subject subject = Subject.getSubject(acc); + if (subject == null) { + return null; + } + + Set principals = subject.getPrincipals(); + + if (principals == null) { + return null; + } + for (Principal p : principals) { + return p.getName(); + } + return null; + } + }); + } + + private static class TestPrincipal implements Principal { + + private String name; + + public TestPrincipal(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof TestPrincipal)) { + return false; + } + TestPrincipal p = (TestPrincipal) obj; + return this.name.equals(p.name); + } + + public int hashCode() { + return this.name.hashCode(); + } + } } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java index 95cf5df4dabe..1d07565be64f 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomCallbackBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomCallbackBean.java index 80c09aff2bda..0091998af758 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomCallbackBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomCallbackBean.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ public class CustomCallbackBean { public void init() { System.getProperties(); } - + public void destroy() { System.setProperty("security.destroy", "true"); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java index 93a8c344ba91..602e71a04d54 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java @@ -1,12 +1,12 @@ /* - * Copyright 2006-2009 the original author or authors. - * + * Copyright 2006-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ public Object getObject() throws Exception { return System.getProperties(); } - public Class getObjectType() { + public Class getObjectType() { System.setProperty("factory.object.type", "true"); return Properties.class; } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java index d24ff224741a..b429cd8e4b7d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/FactoryBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/FactoryBean.java index 43efd6fd8b09..f648206980e7 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/FactoryBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/FactoryBean.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,12 +19,12 @@ * @author Costin Leau */ public class FactoryBean { - + public static Object makeStaticInstance() { System.getProperties(); return new Object(); } - + protected static Object protectedStaticInstance() { return "protectedStaticInstance"; } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java index acd4343d21c3..62f379ee8b57 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/PropertyBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/PropertyBean.java index ced0d45b93bc..cf51e1cdd029 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/PropertyBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/PropertyBean.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,6 +25,6 @@ public void setSecurityProperty(Object property) { } public void setProperty(Object property) { - + } } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java index 6deeeb47c937..a8958ad1ee3e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,7 +102,7 @@ public void testConfigureBeanPerformsAutowiringByNameIfAppropriateBeanWiringInfo configurer.setBeanWiringInfoResolver(resolver); configurer.configureBean(beanInstance); assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName()); - + mock.verify(); } @@ -126,7 +126,7 @@ public void testConfigureBeanPerformsAutowiringByTypeIfAppropriateBeanWiringInfo configurer.setBeanWiringInfoResolver(resolver); configurer.configureBean(beanInstance); assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName()); - + mock.verify(); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java index eba0541e09d5..d4cd00146492 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -122,7 +122,7 @@ public void testGetInstanceByMatchingClass() { public void testGetInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -156,7 +156,7 @@ public void testGetSharedInstanceByMatchingClassNoCatch() { public void testGetSharedInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -200,7 +200,7 @@ public void testPrototypeInstancesAreIndependent() { public void testNotThere() { assertFalse(getBeanFactory().containsBean("Mr Squiggle")); try { - Object o = getBeanFactory().getBean("Mr Squiggle"); + getBeanFactory().getBean("Mr Squiggle"); fail("Can't find missing bean"); } catch (BeansException ex) { @@ -224,7 +224,7 @@ public void testValidEmpty() { public void xtestTypeMismatch() { try { - Object o = getBeanFactory().getBean("typeMismatch"); + getBeanFactory().getBean("typeMismatch"); fail("Shouldn't succeed with type mismatch"); } catch (BeanCreationException wex) { @@ -278,7 +278,8 @@ public void testGetFactoryItself() throws Exception { * @throws Exception */ public void testFactoryIsInitialized() throws Exception { - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); + Object tb = getBeanFactory().getBean("singletonFactory"); + assertTrue(tb instanceof TestBean); DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); } @@ -363,4 +364,4 @@ public void businessMethod() { throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object"); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java index 403b4735bbc7..49d182ee05fd 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,4 +87,4 @@ public void testContainsBeanDefinition() { Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java index 7c979316666f..b3fd7c18e548 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public class AutowireWithExclusionTests extends TestCase { public void testByTypeAutowireWithAutoSelfExclusion() throws Exception { CountingFactory.reset(); - XmlBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml"); + DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); TestBean sally = (TestBean) beanFactory.getBean("sally"); @@ -44,7 +44,7 @@ public void testByTypeAutowireWithAutoSelfExclusion() throws Exception { public void testByTypeAutowireWithExclusion() throws Exception { CountingFactory.reset(); - XmlBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml"); + DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); @@ -53,10 +53,11 @@ public void testByTypeAutowireWithExclusion() throws Exception { public void testByTypeAutowireWithExclusionInParentFactory() throws Exception { CountingFactory.reset(); - XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); + DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); - RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class); + robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); TestBean rob = (TestBean) child.getBean("rob2"); @@ -66,11 +67,12 @@ public void testByTypeAutowireWithExclusionInParentFactory() throws Exception { public void testByTypeAutowireWithPrimaryInParentFactory() throws Exception { CountingFactory.reset(); - XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); + DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.getBeanDefinition("props1").setPrimary(true); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); - RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class); + robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class); @@ -83,10 +85,11 @@ public void testByTypeAutowireWithPrimaryInParentFactory() throws Exception { public void testByTypeAutowireWithPrimaryOverridingParentFactory() throws Exception { CountingFactory.reset(); - XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); + DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); - RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class); + robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class); @@ -100,11 +103,12 @@ public void testByTypeAutowireWithPrimaryOverridingParentFactory() throws Except public void testByTypeAutowireWithPrimaryInParentAndChild() throws Exception { CountingFactory.reset(); - XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); + DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml"); parent.getBeanDefinition("props1").setPrimary(true); parent.preInstantiateSingletons(); DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent); - RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class); + robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally")); child.registerBeanDefinition("rob2", robDef); RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class); @@ -118,7 +122,7 @@ public void testByTypeAutowireWithPrimaryInParentAndChild() throws Exception { public void testByTypeAutowireWithInclusion() throws Exception { CountingFactory.reset(); - XmlBeanFactory beanFactory = getBeanFactory("autowire-with-inclusion.xml"); + DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-inclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); @@ -127,7 +131,7 @@ public void testByTypeAutowireWithInclusion() throws Exception { public void testByTypeAutowireWithSelectiveInclusion() throws Exception { CountingFactory.reset(); - XmlBeanFactory beanFactory = getBeanFactory("autowire-with-selective-inclusion.xml"); + DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-selective-inclusion.xml"); beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); @@ -135,7 +139,7 @@ public void testByTypeAutowireWithSelectiveInclusion() throws Exception { } public void testConstructorAutowireWithAutoSelfExclusion() throws Exception { - XmlBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml"); + DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml"); TestBean rob = (TestBean) beanFactory.getBean("rob"); TestBean sally = (TestBean) beanFactory.getBean("sally"); assertEquals(sally, rob.getSpouse()); @@ -147,13 +151,16 @@ public void testConstructorAutowireWithAutoSelfExclusion() throws Exception { } public void testConstructorAutowireWithExclusion() throws Exception { - XmlBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml"); + DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml"); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); } - private XmlBeanFactory getBeanFactory(String configPath) { - return new XmlBeanFactory(new ClassPathResource(configPath, getClass())); + private DefaultListableBeanFactory getBeanFactory(String configPath) { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); + reader.loadBeanDefinitions(new ClassPathResource(configPath, getClass())); + return beanFactory; } } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java index ba05c516756e..32e6134823d7 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java @@ -58,5 +58,5 @@ public void testNaming() { assertFalse(child1.getBeanName().equals(child2.getBeanName())); } - + } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java index 2be0637cf69c..fca6ff1b8880 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -28,7 +29,6 @@ import org.springframework.beans.factory.parsing.DefaultsDefinition; import org.springframework.beans.factory.parsing.ImportDefinition; import org.springframework.beans.factory.parsing.ReaderEventListener; -import org.springframework.core.CollectionFactory; /** * @author Rob Harrop @@ -36,20 +36,21 @@ */ public class CollectingReaderEventListener implements ReaderEventListener { - private final List defaults = new LinkedList(); + private final List defaults = new LinkedList(); - private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8); + private final Map componentDefinitions = new LinkedHashMap( + 8); - private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8); - - private final List imports = new LinkedList(); + private final Map> aliasMap = new LinkedHashMap>( + 8); + private final List imports = new LinkedList(); public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { this.defaults.add(defaultsDefinition); } - public List getDefaults() { + public List getDefaults() { return Collections.unmodifiableList(this.defaults); } @@ -58,25 +59,25 @@ public void componentRegistered(ComponentDefinition componentDefinition) { } public ComponentDefinition getComponentDefinition(String name) { - return (ComponentDefinition) this.componentDefinitions.get(name); + return this.componentDefinitions.get(name); } public ComponentDefinition[] getComponentDefinitions() { - Collection collection = this.componentDefinitions.values(); - return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]); + Collection collection = this.componentDefinitions.values(); + return collection.toArray(new ComponentDefinition[collection.size()]); } public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); - if(aliases == null) { - aliases = new ArrayList(); + List aliases = this.aliasMap.get(aliasDefinition.getBeanName()); + if (aliases == null) { + aliases = new ArrayList(); this.aliasMap.put(aliasDefinition.getBeanName(), aliases); } aliases.add(aliasDefinition); } - public List getAliases(String beanName) { - List aliases = (List) this.aliasMap.get(beanName); + public List getAliases(String beanName) { + List aliases = this.aliasMap.get(beanName); return aliases == null ? null : Collections.unmodifiableList(aliases); } @@ -84,8 +85,8 @@ public void importProcessed(ImportDefinition importDefinition) { this.imports.add(importDefinition); } - public List getImports() { + public List getImports() { return Collections.unmodifiableList(this.imports); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java index 55f7f920f5c1..c07665430006 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ protected void setUp() throws Exception { public void testMergeList() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithList"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertEquals("Incorrect size", 3, list.size()); assertEquals(list.get(0), "Rob Harrop"); assertEquals(list.get(1), "Rod Johnson"); @@ -57,7 +57,7 @@ public void testMergeList() throws Exception { public void testMergeListWithInnerBeanAsListElement() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithListOfRefs"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertNotNull(list); assertEquals(3, list.size()); assertNotNull(list.get(2)); @@ -66,7 +66,7 @@ public void testMergeListWithInnerBeanAsListElement() throws Exception { public void testMergeSet() { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSet"); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertEquals("Incorrect size", 2, set.size()); assertTrue(set.contains("Rob Harrop")); assertTrue(set.contains("Sally Greenwood")); @@ -74,10 +74,10 @@ public void testMergeSet() { public void testMergeSetWithInnerBeanAsSetElement() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetOfRefs"); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertNotNull(set); assertEquals(2, set.size()); - Iterator it = set.iterator(); + Iterator it = set.iterator(); it.next(); Object o = it.next(); assertNotNull(o); @@ -87,7 +87,7 @@ public void testMergeSetWithInnerBeanAsSetElement() throws Exception { public void testMergeMap() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithMap"); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertEquals("Incorrect size", 3, map.size()); assertEquals(map.get("Rob"), "Sally"); assertEquals(map.get("Rod"), "Kerry"); @@ -96,7 +96,7 @@ public void testMergeMap() throws Exception { public void testMergeMapWithInnerBeanAsMapEntryValue() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithMapOfRefs"); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertNotNull(map); assertEquals(2, map.size()); assertNotNull(map.get("Rob")); @@ -116,7 +116,7 @@ public void testMergeProperties() throws Exception { public void testMergeListInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithListInConstructor"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertEquals("Incorrect size", 3, list.size()); assertEquals(list.get(0), "Rob Harrop"); assertEquals(list.get(1), "Rod Johnson"); @@ -125,7 +125,7 @@ public void testMergeListInConstructor() throws Exception { public void testMergeListWithInnerBeanAsListElementInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithListOfRefsInConstructor"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertNotNull(list); assertEquals(3, list.size()); assertNotNull(list.get(2)); @@ -134,7 +134,7 @@ public void testMergeListWithInnerBeanAsListElementInConstructor() throws Except public void testMergeSetInConstructor() { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetInConstructor"); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertEquals("Incorrect size", 2, set.size()); assertTrue(set.contains("Rob Harrop")); assertTrue(set.contains("Sally Greenwood")); @@ -142,10 +142,10 @@ public void testMergeSetInConstructor() { public void testMergeSetWithInnerBeanAsSetElementInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithSetOfRefsInConstructor"); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertNotNull(set); assertEquals(2, set.size()); - Iterator it = set.iterator(); + Iterator it = set.iterator(); it.next(); Object o = it.next(); assertNotNull(o); @@ -155,7 +155,7 @@ public void testMergeSetWithInnerBeanAsSetElementInConstructor() throws Exceptio public void testMergeMapInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithMapInConstructor"); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertEquals("Incorrect size", 3, map.size()); assertEquals(map.get("Rob"), "Sally"); assertEquals(map.get("Rod"), "Kerry"); @@ -164,7 +164,7 @@ public void testMergeMapInConstructor() throws Exception { public void testMergeMapWithInnerBeanAsMapEntryValueInConstructor() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("childWithMapOfRefsInConstructor"); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertNotNull(map); assertEquals(2, map.size()); assertNotNull(map.get("Rob")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java index 0f3be3b0067f..5aaa109a08f6 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.junit.Test; import test.beans.TestBean; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; /** @@ -31,10 +32,12 @@ */ public class CollectionsWithDefaultTypesTests { - private final XmlBeanFactory beanFactory; + private final DefaultListableBeanFactory beanFactory; public CollectionsWithDefaultTypesTests() { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("collectionsWithDefaultTypes.xml", getClass())); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(new ClassPathResource( + "collectionsWithDefaultTypes.xml", getClass())); } @Test @@ -66,7 +69,7 @@ public void testMapWithNestedElementsHasDefaultKeyAndValueType() throws Exceptio } private void assertMap(Map map) { - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { assertEquals("Key type is incorrect", Integer.class, entry.getKey().getClass()); assertEquals("Value type is incorrect", Boolean.class, entry.getValue().getClass()); } @@ -74,10 +77,11 @@ private void assertMap(Map map) { @Test public void testBuildCollectionFromMixtureOfReferencesAndValues() throws Exception { - MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble"); + @SuppressWarnings("unchecked") + MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble"); assertTrue("Expected 3 elements, not " + jumble.getJumble().size(), jumble.getJumble().size() == 3); - List l = (List) jumble.getJumble(); + List l = (List) jumble.getJumble(); assertTrue(l.get(0).equals("literal")); Integer[] array1 = (Integer[]) l.get(1); assertTrue(array1[0].equals(new Integer(2))); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java index 72f32f07ef60..d16ff925c5fe 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,11 +28,11 @@ * @since 09.11.2003 */ public class ConstructorDependenciesBean implements Serializable { - + private int age; - + private String name; - + private TestBean spouse1; private TestBean spouse2; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java index 27ea4461be4d..8d01a3a0aecd 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CountingFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ /** * @author Juergen Hoeller */ -public class CountingFactory implements FactoryBean { +public class CountingFactory implements FactoryBean { private static int factoryBeanInstanceCount = 0; @@ -51,11 +51,11 @@ public void setTestBean(TestBean tb) { } - public Object getObject() { + public String getObject() { return "myString"; } - public Class getObjectType() { + public Class getObjectType() { return String.class; } @@ -63,4 +63,4 @@ public boolean isSingleton() { return true; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java index 8662e52c7822..008dead066b8 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ import junit.framework.TestCase; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; /** @@ -25,10 +26,12 @@ */ public class DefaultLifecycleMethodsTests extends TestCase { - private XmlBeanFactory beanFactory; + private DefaultListableBeanFactory beanFactory; protected void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("defaultLifecycleMethods.xml", getClass())); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions( + new ClassPathResource("defaultLifecycleMethods.xml", getClass())); } public void testLifecycleMethodsInvoked() { @@ -48,7 +51,9 @@ public void testLifecycleMethodsDisabled() throws Exception { public void testIgnoreDefaultLifecycleMethods() throws Exception { try { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("ignoreDefaultLifecycleMethods.xml", getClass())); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions( + new ClassPathResource("ignoreDefaultLifecycleMethods.xml", getClass())); bf.preInstantiateSingletons(); bf.destroySingletons(); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java index 59753651615c..479bbbab9675 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.beans.factory.xml; -import junit.framework.TestCase; - import org.junit.Test; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java index 2a2b5dcdabcf..7387cdf6003d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,11 +28,11 @@ * @since 04.09.2003 */ public class DependenciesBean implements BeanFactoryAware { - + private int age; - + private String name; - + private TestBean spouse; private BeanFactory beanFactory; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java index d42ab430eb15..1915b6ea035a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -64,4 +64,4 @@ public TestBean getTestBean2() { return testBean2; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java index 1c9e484182e1..bd2d8370384c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java @@ -31,11 +31,11 @@ * With Spring 3.1, bean id attributes (and all other id attributes across the * core schemas) are no longer typed as xsd:id, but as xsd:string. This allows * for using the same bean id within nested elements. - * + * * Duplicate ids *within the same level of nesting* will still be treated as an * error through the ProblemReporter, as this could never be an intended/valid * situation. - * + * * @author Chris Beams * @since 3.1 * @see org.springframework.beans.factory.xml.XmlBeanFactoryTests#testWithDuplicateName diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java index a9e9925d5129..3b6bccd8bb26 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.springframework.beans.factory.parsing.AliasDefinition; import org.springframework.beans.factory.parsing.BeanComponentDefinition; import org.springframework.beans.factory.parsing.ComponentDefinition; +import org.springframework.beans.factory.parsing.DefaultsDefinition; import org.springframework.beans.factory.parsing.ImportDefinition; import org.springframework.beans.factory.parsing.PassThroughSourceExtractor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -50,7 +51,7 @@ protected void setUp() throws Exception { } public void testDefaultsEventReceived() throws Exception { - List defaultsList = this.eventListener.getDefaults(); + List defaultsList = this.eventListener.getDefaults(); assertTrue(!defaultsList.isEmpty()); assertTrue(defaultsList.get(0) instanceof DocumentDefaultsDefinition); DocumentDefaultsDefinition defaults = (DocumentDefaultsDefinition) defaultsList.get(0); @@ -93,20 +94,20 @@ public void testBeanEventReceived() throws Exception { } public void testAliasEventReceived() throws Exception { - List aliases = this.eventListener.getAliases("testBean"); + List aliases = this.eventListener.getAliases("testBean"); assertEquals(2, aliases.size()); - AliasDefinition aliasDefinition1 = (AliasDefinition) aliases.get(0); + AliasDefinition aliasDefinition1 = aliases.get(0); assertEquals("testBeanAlias1", aliasDefinition1.getAlias()); assertTrue(aliasDefinition1.getSource() instanceof Element); - AliasDefinition aliasDefinition2 = (AliasDefinition) aliases.get(1); + AliasDefinition aliasDefinition2 = aliases.get(1); assertEquals("testBeanAlias2", aliasDefinition2.getAlias()); assertTrue(aliasDefinition2.getSource() instanceof Element); } public void testImportEventReceived() throws Exception { - List imports = this.eventListener.getImports(); + List imports = this.eventListener.getImports(); assertEquals(1, imports.size()); - ImportDefinition importDefinition = (ImportDefinition) imports.get(0); + ImportDefinition importDefinition = imports.get(0); assertEquals("beanEventsImported.xml", importDefinition.getImportedResource()); assertTrue(importDefinition.getSource() instanceof Element); } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java index 696ab6c0afe1..160572ae33f5 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java index 38666e188cb7..516cf1136806 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ * @author Juergen Hoeller */ public class FactoryMethods { - + public static FactoryMethods nullInstance() { return null; } @@ -39,21 +39,21 @@ public static FactoryMethods defaultInstance() { tb.setName("defaultInstance"); return new FactoryMethods(tb, "default", 0); } - + /** * Note that overloaded methods are supported. */ public static FactoryMethods newInstance(TestBean tb) { return new FactoryMethods(tb, "default", 0); } - + protected static FactoryMethods newInstance(TestBean tb, int num, String name) { if (name == null) { throw new IllegalStateException("Should never be called with null value"); } return new FactoryMethods(tb, name, num); } - + static FactoryMethods newInstance(TestBean tb, int num, Integer something) { if (something != null) { throw new IllegalStateException("Should never be called with non-null value"); @@ -61,8 +61,9 @@ static FactoryMethods newInstance(TestBean tb, int num, Integer something) { return new FactoryMethods(tb, null, num); } - private static List listInstance() { - return Collections.EMPTY_LIST; + @SuppressWarnings("unused") + private static List listInstance() { + return Collections.emptyList(); } @@ -81,35 +82,36 @@ private FactoryMethods(TestBean tb, String name, int num) { this.name = name; this.num = num; } - + public void setStringValue(String stringValue) { this.stringValue = stringValue; } - + public String getStringValue() { return this.stringValue; } - + public TestBean getTestBean() { return this.tb; } - + protected TestBean protectedGetTestBean() { return this.tb; } - + + @SuppressWarnings("unused") private TestBean privateGetTestBean() { return this.tb; } - + public int getNum() { return num; } - + public String getName() { return name; } - + /** * Set via Setter Injection once instance is created. */ diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java index f67a71894989..6e3f1df422bc 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,26 +37,26 @@ public InstanceFactory() { public void setFactoryBeanProperty(String s) { this.factoryBeanProperty = s; } - + public String getFactoryBeanProperty() { return this.factoryBeanProperty; } - + public FactoryMethods defaultInstance() { TestBean tb = new TestBean(); tb.setName(this.factoryBeanProperty); return FactoryMethods.newInstance(tb); } - + /** * Note that overloaded methods are supported. */ public FactoryMethods newInstance(TestBean tb) { return FactoryMethods.newInstance(tb); } - + public FactoryMethods newInstance(TestBean tb, int num, String name) { return FactoryMethods.newInstance(tb, num, name); } - + } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java index b943361f1a2e..db99a8b60c04 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; /** @@ -27,10 +28,12 @@ */ public class MetadataAttachmentTests extends TestCase { - private XmlBeanFactory beanFactory; + private DefaultListableBeanFactory beanFactory; protected void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("withMeta.xml", getClass())); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions( + new ClassPathResource("withMeta.xml", getClass())); } public void testMetadataAttachment() throws Exception { diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/MixedCollectionBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/MixedCollectionBean.java index 8ed5f2517ec8..8b70467ec247 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/MixedCollectionBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/MixedCollectionBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,16 +25,16 @@ * @author Rod Johnson * @since 27.05.2003 */ -public class MixedCollectionBean { +public class MixedCollectionBean { - private Collection jumble; + private Collection jumble; - public void setJumble(Collection jumble) { + public void setJumble(Collection jumble) { this.jumble = jumble; } - public Collection getJumble() { + public Collection getJumble() { return jumble; } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java index a6feaedcec6c..f3bb962262fe 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/NestedBeansElementAttributeRecursionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ public void defaultLazyInit() { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "cast" }) public void defaultMerge() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); new XmlBeanDefinitionReader(bf).loadBeanDefinitions( diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProtectedLifecycleBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProtectedLifecycleBean.java index ed8167b1126f..7fef9c315334 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProtectedLifecycleBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProtectedLifecycleBean.java @@ -159,4 +159,4 @@ public Object postProcessAfterInitialization(Object bean, String name) throws Be } } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java index 8344d0b5298a..be6b86e698e0 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SchemaValidationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java index 8cc4596a33d1..339d61adadf4 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; import test.beans.DummyBean; @@ -33,7 +33,7 @@ public class SimpleConstructorNamespaceHandlerTests { @Test public void simpleValue() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); String name = "simple"; // beanFactory.getBean("simple1", DummyBean.class); DummyBean nameValue = beanFactory.getBean(name, DummyBean.class); @@ -42,7 +42,7 @@ public void simpleValue() throws Exception { @Test public void simpleRef() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); String name = "simple-ref"; // beanFactory.getBean("name-value1", TestBean.class); DummyBean nameValue = beanFactory.getBean(name, DummyBean.class); @@ -51,7 +51,7 @@ public void simpleRef() throws Exception { @Test public void nameValue() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); String name = "name-value"; // beanFactory.getBean("name-value1", TestBean.class); TestBean nameValue = beanFactory.getBean(name, TestBean.class); @@ -61,7 +61,7 @@ public void nameValue() throws Exception { @Test public void nameRef() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); TestBean nameValue = beanFactory.getBean("name-value", TestBean.class); DummyBean nameRef = beanFactory.getBean("name-ref", DummyBean.class); @@ -71,7 +71,7 @@ public void nameRef() throws Exception { @Test public void typeIndexedValue() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); DummyBean typeRef = beanFactory.getBean("indexed-value", DummyBean.class); assertEquals("at", typeRef.getName()); @@ -81,7 +81,7 @@ public void typeIndexedValue() throws Exception { @Test public void typeIndexedRef() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); DummyBean typeRef = beanFactory.getBean("indexed-ref", DummyBean.class); assertEquals("some-name", typeRef.getName()); @@ -90,20 +90,21 @@ public void typeIndexedRef() throws Exception { @Test(expected = BeanDefinitionStoreException.class) public void ambiguousConstructor() throws Exception { - new XmlBeanFactory(new ClassPathResource("simpleConstructorNamespaceHandlerTestsWithErrors.xml", getClass())); + createFactory("simpleConstructorNamespaceHandlerTestsWithErrors.xml"); } @Test public void constructorWithNameEndingInRef() throws Exception { - XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); + DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml"); DummyBean derivedBean = beanFactory.getBean("beanWithRefConstructorArg", DummyBean.class); assertEquals(10, derivedBean.getAge()); assertEquals("silly name", derivedBean.getName()); } - private XmlBeanFactory createFactory(String resourceName) { - XmlBeanFactory fact = new XmlBeanFactory(new ClassPathResource(resourceName, getClass())); - //fact.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); - return fact; + private DefaultListableBeanFactory createFactory(String resourceName) { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(new ClassPathResource( + resourceName, getClass())); + return beanFactory; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java index a7e543780d13..c4a10ca5f4fa 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import test.beans.TestBean; import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; /** @@ -33,8 +34,7 @@ public class SimplePropertyNamespaceHandlerTests { @Test public void simpleBeanConfigured() throws Exception { - XmlBeanFactory beanFactory = - new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass())); + DefaultListableBeanFactory beanFactory = createFactory("simplePropertyNamespaceHandlerTests.xml"); ITestBean rob = (TestBean) beanFactory.getBean("rob"); ITestBean sally = (TestBean) beanFactory.getBean("sally"); assertEquals("Rob Harrop", rob.getName()); @@ -44,8 +44,7 @@ public void simpleBeanConfigured() throws Exception { @Test public void innerBeanConfigured() throws Exception { - XmlBeanFactory beanFactory = - new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass())); + DefaultListableBeanFactory beanFactory = createFactory("simplePropertyNamespaceHandlerTests.xml"); TestBean sally = (TestBean) beanFactory.getBean("sally2"); ITestBean rob = sally.getSpouse(); assertEquals("Rob Harrop", rob.getName()); @@ -55,15 +54,20 @@ public void innerBeanConfigured() throws Exception { @Test(expected = BeanDefinitionStoreException.class) public void withPropertyDefinedTwice() throws Exception { - new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTestsWithErrors.xml", getClass())); + createFactory("simplePropertyNamespaceHandlerTestsWithErrors.xml"); } @Test public void propertyWithNameEndingInRef() throws Exception { - XmlBeanFactory beanFactory = - new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass())); + DefaultListableBeanFactory beanFactory = createFactory("simplePropertyNamespaceHandlerTests.xml"); ITestBean sally = (TestBean) beanFactory.getBean("derivedSally"); assertEquals("r", sally.getSpouse().getName()); } + private DefaultListableBeanFactory createFactory(String resourceName) { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(new ClassPathResource( + resourceName, getClass())); + return beanFactory; + } } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java index ffd13f4630d8..07d8371b6f85 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,18 +21,18 @@ /** * Test class for Spring's ability to create * objects using static factory methods, rather - * than constructors. + * than constructors. * @author Rod Johnson */ public class TestBeanCreator { - + public static TestBean createTestBean(String name, int age) { TestBean tb = new TestBean(); tb.setName(name); tb.setAge(age); return tb; } - + public static TestBean createTestBean() { TestBean tb = new TestBean(); tb.setName("Tristan"); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java index 3345bf52fb39..c757707bf382 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,72 +91,80 @@ public void testNestedPropertyPath() throws Exception { assertEquals("Rob Harrop", bean.getName()); } + @SuppressWarnings("unchecked") public void testSimpleMap() throws Exception { - Map map = (Map) this.beanFactory.getBean("simpleMap"); + Map map = (Map) this.beanFactory.getBean("simpleMap"); assertEquals("bar", map.get("foo")); - Map map2 = (Map) this.beanFactory.getBean("simpleMap"); + Map map2 = (Map) this.beanFactory.getBean("simpleMap"); assertTrue(map == map2); } - public void testScopedMap() throws Exception { - Map map = (Map) this.beanFactory.getBean("scopedMap"); + @SuppressWarnings("unchecked") + public void testScopedMap() throws Exception { + Map map = (Map) this.beanFactory.getBean("scopedMap"); assertEquals("bar", map.get("foo")); - Map map2 = (Map) this.beanFactory.getBean("scopedMap"); + Map map2 = (Map) this.beanFactory.getBean("scopedMap"); assertEquals("bar", map2.get("foo")); assertTrue(map != map2); } + @SuppressWarnings("unchecked") public void testSimpleList() throws Exception { - List list = (List) this.beanFactory.getBean("simpleList"); + List list = (List) this.beanFactory.getBean("simpleList"); assertEquals("Rob Harrop", list.get(0)); - List list2 = (List) this.beanFactory.getBean("simpleList"); + List list2 = (List) this.beanFactory.getBean("simpleList"); assertTrue(list == list2); } + @SuppressWarnings("unchecked") public void testScopedList() throws Exception { - List list = (List) this.beanFactory.getBean("scopedList"); + List list = (List) this.beanFactory.getBean("scopedList"); assertEquals("Rob Harrop", list.get(0)); - List list2 = (List) this.beanFactory.getBean("scopedList"); + List list2 = (List) this.beanFactory.getBean("scopedList"); assertEquals("Rob Harrop", list2.get(0)); assertTrue(list != list2); } + @SuppressWarnings("unchecked") public void testSimpleSet() throws Exception { - Set set = (Set) this.beanFactory.getBean("simpleSet"); + Set set = (Set) this.beanFactory.getBean("simpleSet"); assertTrue(set.contains("Rob Harrop")); - Set set2 = (Set) this.beanFactory.getBean("simpleSet"); + Set set2 = (Set) this.beanFactory.getBean("simpleSet"); assertTrue(set == set2); } + @SuppressWarnings("unchecked") public void testScopedSet() throws Exception { - Set set = (Set) this.beanFactory.getBean("scopedSet"); + Set set = (Set) this.beanFactory.getBean("scopedSet"); assertTrue(set.contains("Rob Harrop")); - Set set2 = (Set) this.beanFactory.getBean("scopedSet"); + Set set2 = (Set) this.beanFactory.getBean("scopedSet"); assertTrue(set2.contains("Rob Harrop")); assertTrue(set != set2); } + @SuppressWarnings("unchecked") public void testMapWithRef() throws Exception { - Map map = (Map) this.beanFactory.getBean("mapWithRef"); + Map map = (Map) this.beanFactory.getBean("mapWithRef"); assertTrue(map instanceof TreeMap); assertEquals(this.beanFactory.getBean("testBean"), map.get("bean")); } + @SuppressWarnings("unchecked") public void testNestedCollections() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("nestedCollectionsBean"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals("foo", list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertEquals(1, set.size()); assertTrue(set.contains("bar")); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertTrue(map.get("foo") instanceof Set); - Set innerSet = (Set) map.get("foo"); + Set innerSet = (Set) map.get("foo"); assertEquals(1, innerSet.size()); assertTrue(innerSet.contains("bar")); @@ -175,11 +183,11 @@ public void testNestedShortcutCollections() throws Exception { assertEquals(1, bean.getStringArray().length); assertEquals("fooStr", bean.getStringArray()[0]); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals("foo", list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertEquals(1, set.size()); assertTrue(set.contains("bar")); @@ -195,16 +203,16 @@ public void testNestedShortcutCollections() throws Exception { public void testNestedInCollections() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals(Integer.MIN_VALUE, list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertEquals(2, set.size()); assertTrue(set.contains(Thread.State.NEW)); assertTrue(set.contains(Thread.State.RUNNABLE)); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertEquals(CustomEnum.VALUE_1, map.get("min")); @@ -220,15 +228,15 @@ public void testNestedInCollections() throws Exception { public void testCircularCollections() throws Exception { TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionsBean"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertEquals(1, list.size()); assertEquals(bean, list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertEquals(1, set.size()); assertTrue(set.contains(bean)); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertEquals(1, map.size()); assertEquals(bean, map.get("foo")); } @@ -237,17 +245,17 @@ public void testCircularCollectionBeansStartingWithList() throws Exception { this.beanFactory.getBean("circularList"); TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertTrue(Proxy.isProxyClass(list.getClass())); assertEquals(1, list.size()); assertEquals(bean, list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertFalse(Proxy.isProxyClass(set.getClass())); assertEquals(1, set.size()); assertTrue(set.contains(bean)); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertFalse(Proxy.isProxyClass(map.getClass())); assertEquals(1, map.size()); assertEquals(bean, map.get("foo")); @@ -257,17 +265,17 @@ public void testCircularCollectionBeansStartingWithSet() throws Exception { this.beanFactory.getBean("circularSet"); TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertFalse(Proxy.isProxyClass(list.getClass())); assertEquals(1, list.size()); assertEquals(bean, list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertTrue(Proxy.isProxyClass(set.getClass())); assertEquals(1, set.size()); assertTrue(set.contains(bean)); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertFalse(Proxy.isProxyClass(map.getClass())); assertEquals(1, map.size()); assertEquals(bean, map.get("foo")); @@ -277,17 +285,17 @@ public void testCircularCollectionBeansStartingWithMap() throws Exception { this.beanFactory.getBean("circularMap"); TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean"); - List list = bean.getSomeList(); + List list = bean.getSomeList(); assertFalse(Proxy.isProxyClass(list.getClass())); assertEquals(1, list.size()); assertEquals(bean, list.get(0)); - Set set = bean.getSomeSet(); + Set set = bean.getSomeSet(); assertFalse(Proxy.isProxyClass(set.getClass())); assertEquals(1, set.size()); assertTrue(set.contains(bean)); - Map map = bean.getSomeMap(); + Map map = bean.getSomeMap(); assertTrue(Proxy.isProxyClass(map.getClass())); assertEquals(1, map.size()); assertEquals(bean, map.get("foo")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java index 460c18a9f6ba..92cedacb86a2 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java @@ -40,6 +40,7 @@ import org.springframework.beans.factory.config.ListFactoryBean; import org.springframework.beans.factory.config.MapFactoryBean; import org.springframework.beans.factory.config.SetFactoryBean; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.core.io.ClassPathResource; /** @@ -51,26 +52,28 @@ */ public class XmlBeanCollectionTests { - private final XmlBeanFactory beanFactory; + private final DefaultListableBeanFactory beanFactory; public XmlBeanCollectionTests() { - this.beanFactory = new XmlBeanFactory(new ClassPathResource("collections.xml", getClass())); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(new ClassPathResource( + "collections.xml", getClass())); } @Test public void testCollectionFactoryDefaults() throws Exception { ListFactoryBean listFactory = new ListFactoryBean(); - listFactory.setSourceList(new LinkedList()); + listFactory.setSourceList(new LinkedList()); listFactory.afterPropertiesSet(); assertTrue(listFactory.getObject() instanceof ArrayList); SetFactoryBean setFactory = new SetFactoryBean(); - setFactory.setSourceSet(new TreeSet()); + setFactory.setSourceSet(new TreeSet()); setFactory.afterPropertiesSet(); assertTrue(setFactory.getObject() instanceof LinkedHashSet); MapFactoryBean mapFactory = new MapFactoryBean(); - mapFactory.setSourceMap(new TreeMap()); + mapFactory.setSourceMap(new TreeMap()); mapFactory.afterPropertiesSet(); assertTrue(mapFactory.getObject() instanceof LinkedHashMap); } @@ -151,12 +154,13 @@ public void testRefSubelementsBuildCollectionFromSingleElement() throws Exceptio assertTrue(loner.getFriends().contains(dave)); } + @SuppressWarnings("unchecked") @Test public void testBuildCollectionFromMixtureOfReferencesAndValues() throws Exception { - MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble"); + MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble"); assertTrue("Expected 5 elements, not " + jumble.getJumble().size(), jumble.getJumble().size() == 5); - List l = (List) jumble.getJumble(); + List l = (List) jumble.getJumble(); assertTrue(l.get(0).equals(this.beanFactory.getBean("david"))); assertTrue(l.get(1).equals("literal")); assertTrue(l.get(2).equals(this.beanFactory.getBean("jenny"))); @@ -223,6 +227,7 @@ public void testMapWithLiteralsAndPrototypeReferences() throws Exception { assertTrue("Not same instance", hasMap2.getMap().get("jenny") != hasMap.getMap().get("jenny")); } + @SuppressWarnings("unchecked") @Test public void testMapWithLiteralsReferencesAndList() throws Exception { HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMapWithList"); @@ -232,14 +237,14 @@ public void testMapWithLiteralsReferencesAndList() throws Exception { assertTrue(hasMap.getMap().get("jenny").equals(jenny)); // Check list - List l = (List) hasMap.getMap().get("list"); + List l = (List) hasMap.getMap().get("list"); assertNotNull(l); assertTrue(l.size() == 4); assertTrue(l.get(0).equals("zero")); assertTrue(l.get(3) == null); // Check nested map in list - Map m = (Map) l.get(1); + Map m = (Map) l.get(1); assertNotNull(m); assertTrue(m.size() == 2); assertTrue(m.get("fo").equals("bar")); @@ -247,14 +252,14 @@ public void testMapWithLiteralsReferencesAndList() throws Exception { m.get("jen").equals(jenny)); // Check nested list in list - l = (List) l.get(2); + l = (List) l.get(2); assertNotNull(l); assertTrue(l.size() == 2); assertTrue(l.get(0).equals(jenny)); assertTrue(l.get(1).equals("ba")); // Check nested map - m = (Map) hasMap.getMap().get("map"); + m = (Map) hasMap.getMap().get("map"); assertNotNull(m); assertTrue(m.size() == 2); assertTrue(m.get("foo").equals("bar")); @@ -276,7 +281,7 @@ public void testPopulatedSet() throws Exception { TestBean jenny = (TestBean) this.beanFactory.getBean("jenny"); assertTrue(hasMap.getSet().contains(jenny)); assertTrue(hasMap.getSet().contains(null)); - Iterator it = hasMap.getSet().iterator(); + Iterator it = hasMap.getSet().iterator(); assertEquals("bar", it.next()); assertEquals(jenny, it.next()); assertEquals(null, it.next()); @@ -296,7 +301,7 @@ public void testPopulatedConcurrentSet() throws Exception { public void testPopulatedIdentityMap() throws Exception { HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap"); assertTrue(hasMap.getIdentityMap().size() == 2); - HashSet set = new HashSet(hasMap.getIdentityMap().keySet()); + HashSet set = new HashSet(hasMap.getIdentityMap().keySet()); assertTrue(set.contains("foo")); assertTrue(set.contains("jenny")); } @@ -354,74 +359,82 @@ public void testProps() throws Exception { assertEquals("TWO", hasMap2.getProps().getProperty("2")); } + @SuppressWarnings("unchecked") @Test public void testListFactory() throws Exception { - List list = (List) this.beanFactory.getBean("listFactory"); + List list = (List) this.beanFactory.getBean("listFactory"); assertTrue(list instanceof LinkedList); assertTrue(list.size() == 2); assertEquals("bar", list.get(0)); assertEquals("jenny", list.get(1)); } + @SuppressWarnings("unchecked") @Test public void testPrototypeListFactory() throws Exception { - List list = (List) this.beanFactory.getBean("pListFactory"); + List list = (List) this.beanFactory.getBean("pListFactory"); assertTrue(list instanceof LinkedList); assertTrue(list.size() == 2); assertEquals("bar", list.get(0)); assertEquals("jenny", list.get(1)); } + @SuppressWarnings("unchecked") @Test public void testSetFactory() throws Exception { - Set set = (Set) this.beanFactory.getBean("setFactory"); + Set set = (Set) this.beanFactory.getBean("setFactory"); assertTrue(set instanceof TreeSet); assertTrue(set.size() == 2); assertTrue(set.contains("bar")); assertTrue(set.contains("jenny")); } + @SuppressWarnings("unchecked") @Test public void testPrototypeSetFactory() throws Exception { - Set set = (Set) this.beanFactory.getBean("pSetFactory"); + Set set = (Set) this.beanFactory.getBean("pSetFactory"); assertTrue(set instanceof TreeSet); assertTrue(set.size() == 2); assertTrue(set.contains("bar")); assertTrue(set.contains("jenny")); } + @SuppressWarnings("unchecked") @Test public void testMapFactory() throws Exception { - Map map = (Map) this.beanFactory.getBean("mapFactory"); + Map map = (Map) this.beanFactory.getBean("mapFactory"); assertTrue(map instanceof TreeMap); assertTrue(map.size() == 2); assertEquals("bar", map.get("foo")); assertEquals("jenny", map.get("jen")); } + @SuppressWarnings("unchecked") @Test public void testPrototypeMapFactory() throws Exception { - Map map = (Map) this.beanFactory.getBean("pMapFactory"); + Map map = (Map) this.beanFactory.getBean("pMapFactory"); assertTrue(map instanceof TreeMap); assertTrue(map.size() == 2); assertEquals("bar", map.get("foo")); assertEquals("jenny", map.get("jen")); } + @SuppressWarnings("unchecked") @Test public void testChoiceBetweenSetAndMap() { MapAndSet sam = (MapAndSet) this.beanFactory.getBean("setAndMap"); assertTrue("Didn't choose constructor with Map argument", sam.getObject() instanceof Map); - Map map = (Map) sam.getObject(); + Map map = (Map) sam.getObject(); assertEquals(3, map.size()); assertEquals("val1", map.get("key1")); assertEquals("val2", map.get("key2")); assertEquals("val3", map.get("key3")); } + @SuppressWarnings("unchecked") @Test public void testEnumSetFactory() throws Exception { - Set set = (Set) this.beanFactory.getBean("enumSetFactory"); + Set set = (Set) this.beanFactory.getBean("enumSetFactory"); assertTrue(set.size() == 2); assertTrue(set.contains("ONE")); assertTrue(set.contains("TWO")); @@ -432,11 +445,11 @@ public static class MapAndSet { private Object obj; - public MapAndSet(Map map) { + public MapAndSet(Map map) { this.obj = map; } - public MapAndSet(Set set) { + public MapAndSet(Set set) { this.obj = set; } @@ -454,52 +467,52 @@ public Object getObject() { * @since 05.06.2003 */ class HasMap { - - private Map map; - private IdentityHashMap identityMap; + private Map map; - private Set set; + private IdentityHashMap identityMap; - private CopyOnWriteArraySet concurrentSet; + private Set set; + + private CopyOnWriteArraySet concurrentSet; private Properties props; - + private Object[] objectArray; - - private Class[] classArray; - + + private Class[] classArray; + private Integer[] intArray; - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public IdentityHashMap getIdentityMap() { + public IdentityHashMap getIdentityMap() { return identityMap; } - public void setIdentityMap(IdentityHashMap identityMap) { + public void setIdentityMap(IdentityHashMap identityMap) { this.identityMap = identityMap; } - public Set getSet() { + public Set getSet() { return set; } - public void setSet(Set set) { + public void setSet(Set set) { this.set = set; } - public CopyOnWriteArraySet getConcurrentSet() { + public CopyOnWriteArraySet getConcurrentSet() { return concurrentSet; } - public void setConcurrentSet(CopyOnWriteArraySet concurrentSet) { + public void setConcurrentSet(CopyOnWriteArraySet concurrentSet) { this.concurrentSet = concurrentSet; } @@ -519,11 +532,11 @@ public void setObjectArray(Object[] objectArray) { this.objectArray = objectArray; } - public Class[] getClassArray() { + public Class[] getClassArray() { return classArray; } - public void setClassArray(Class[] classArray) { + public void setClassArray(Class[] classArray) { this.classArray = classArray; } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java index 8af531ca8f9f..76baf7366fe4 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ public void testWithInputSource() { catch (BeanDefinitionStoreException expected) { } } - + public void testWithInputSourceAndExplicitValidationMode() { SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();; InputSource resource = new InputSource(getClass().getResourceAsStream("test.xml")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java index 22d4fcb30c28..ca301afb89de 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,20 +44,23 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest private DefaultListableBeanFactory parent; - private XmlBeanFactory factory; + private DefaultListableBeanFactory factory; protected void setUp() { parent = new DefaultListableBeanFactory(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Albert"); - parent.registerBeanDefinition("father", - new RootBeanDefinition(TestBean.class, new MutablePropertyValues(m))); - m = new HashMap(); + RootBeanDefinition fatherBeanDefinition = new RootBeanDefinition(TestBean.class); + fatherBeanDefinition.setPropertyValues(new MutablePropertyValues(m)); + parent.registerBeanDefinition("father", fatherBeanDefinition); + m = new HashMap(); m.put("name", "Roderick"); - parent.registerBeanDefinition("rod", - new RootBeanDefinition(TestBean.class, new MutablePropertyValues(m))); + RootBeanDefinition rodBeanDefinition = new RootBeanDefinition(TestBean.class); + rodBeanDefinition.setPropertyValues(new MutablePropertyValues(m)); + parent.registerBeanDefinition("rod", rodBeanDefinition); - this.factory = new XmlBeanFactory(new ClassPathResource("test.xml", getClass()), parent); + this.factory = new DefaultListableBeanFactory(parent); + new XmlBeanDefinitionReader(this.factory).loadBeanDefinitions(new ClassPathResource("test.xml", getClass())); this.factory.addBeanPostProcessor(new BeanPostProcessor() { public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException { if (bean instanceof TestBean) { @@ -108,12 +111,12 @@ public void testDescriptionButNoProperties() throws Exception { * Test that properties with name as well as id creating an alias up front. */ public void testAutoAliasing() throws Exception { - List beanNames = Arrays.asList(getListableBeanFactory().getBeanDefinitionNames()); + List beanNames = Arrays.asList(getListableBeanFactory().getBeanDefinitionNames()); TestBean tb1 = (TestBean) getBeanFactory().getBean("aliased"); TestBean alias1 = (TestBean) getBeanFactory().getBean("myalias"); Assert.assertTrue(tb1 == alias1); - List tb1Aliases = Arrays.asList(getBeanFactory().getAliases("aliased")); + List tb1Aliases = Arrays.asList(getBeanFactory().getAliases("aliased")); Assert.assertEquals(2, tb1Aliases.size()); Assert.assertTrue(tb1Aliases.contains("myalias")); Assert.assertTrue(tb1Aliases.contains("youralias")); @@ -131,7 +134,7 @@ public void testAutoAliasing() throws Exception { Assert.assertTrue(tb2 == alias3a); Assert.assertTrue(tb2 == alias3b); - List tb2Aliases = Arrays.asList(getBeanFactory().getAliases("multiAliased")); + List tb2Aliases = Arrays.asList(getBeanFactory().getAliases("multiAliased")); Assert.assertEquals(4, tb2Aliases.size()); Assert.assertTrue(tb2Aliases.contains("alias1")); Assert.assertTrue(tb2Aliases.contains("alias2")); @@ -148,7 +151,7 @@ public void testAutoAliasing() throws Exception { TestBean alias5 = (TestBean) getBeanFactory().getBean("aliasWithoutId3"); Assert.assertTrue(tb3 == alias4); Assert.assertTrue(tb3 == alias5); - List tb3Aliases = Arrays.asList(getBeanFactory().getAliases("aliasWithoutId1")); + List tb3Aliases = Arrays.asList(getBeanFactory().getAliases("aliasWithoutId1")); Assert.assertEquals(2, tb3Aliases.size()); Assert.assertTrue(tb3Aliases.contains("aliasWithoutId2")); Assert.assertTrue(tb3Aliases.contains("aliasWithoutId3")); @@ -159,7 +162,7 @@ public void testAutoAliasing() throws Exception { TestBean tb4 = (TestBean) getBeanFactory().getBean(TestBean.class.getName() + "#0"); Assert.assertEquals(null, tb4.getName()); - Map drs = getListableBeanFactory().getBeansOfType(DummyReferencer.class, false, false); + Map drs = getListableBeanFactory().getBeansOfType(DummyReferencer.class, false, false); Assert.assertEquals(5, drs.size()); Assert.assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#0")); Assert.assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#1")); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java index e491b3ef8811..2b2ee692e6ab 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ /** * Unit and integration tests for the {@link DefaultNamespaceHandlerResolver} class. - * + * * @author Rob Harrop * @author Rick Evans */ diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ByteArrayPropertyEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ByteArrayPropertyEditorTests.java index 7c8ab4a56fe8..f2d77a2b684d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ByteArrayPropertyEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ByteArrayPropertyEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public void testSunnyDaySetAsText() throws Exception { public void testGetAsTextReturnsEmptyStringIfValueIsNull() throws Exception { PropertyEditor byteEditor = new ByteArrayPropertyEditor(); assertEquals("", byteEditor.getAsText()); - + byteEditor.setAsText(null); assertEquals("", byteEditor.getAsText()); } diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CharArrayPropertyEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CharArrayPropertyEditorTests.java index 3f28d1c2512a..08186a084314 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CharArrayPropertyEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CharArrayPropertyEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java index 14b3f4d48d0d..0f62579e4db8 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,9 +37,10 @@ public void testCtorWithNullCollectionType() throws Exception { new CustomCollectionEditor(null); } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test(expected=IllegalArgumentException.class) public void testCtorWithNonCollectionType() throws Exception { - new CustomCollectionEditor(String.class); + new CustomCollectionEditor((Class)String.class); } @Test(expected=IllegalArgumentException.class) @@ -86,7 +87,7 @@ public void testSunnyDaySetAsTextYieldsSingleValue() throws Exception { @SuppressWarnings("serial") - private static final class CollectionTypeWithNoNoArgCtor extends ArrayList { + public static final class CollectionTypeWithNoNoArgCtor extends ArrayList { public CollectionTypeWithNoNoArgCtor(String anArg) { } } diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java index ea5a69fb4612..8ab0d188778c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ * @author Rob Harrop * @author Arjen Poutsma * @author Chris Beams - * + * * @since 10.06.2003 */ public class CustomEditorTests { @@ -511,7 +511,7 @@ public void testCharacterEditor() { bw.setPropertyValue("myChar", "\\u0022"); assertEquals('"', cb.getMyChar()); - + CharacterEditor editor = new CharacterEditor(false); editor.setAsText("M"); assertEquals("M", editor.getAsText()); @@ -672,7 +672,7 @@ public void testPatternEditor() { patternEditor = new PatternEditor(); assertEquals("", patternEditor.getAsText()); - + patternEditor = new PatternEditor(); patternEditor.setAsText(null); assertEquals("", patternEditor.getAsText()); @@ -1460,7 +1460,7 @@ public void setAsText(String text) { } - private static class PrimitiveArrayBean { + public static class PrimitiveArrayBean { private byte[] byteArray; @@ -1484,7 +1484,7 @@ public void setCharArray(char[] charArray) { } - private static class CharBean { + public static class CharBean { private char myChar; @@ -1508,7 +1508,7 @@ public void setMyCharacter(Character myCharacter) { } - private static class OldCollectionsBean { + public static class OldCollectionsBean { private Vector vector; diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/FileEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/FileEditorTests.java index fc46e1ef7dda..3e591b697a4e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/FileEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/FileEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/InputStreamEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/InputStreamEditorTests.java index 94f8f1f387e4..59969af34f53 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/InputStreamEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/InputStreamEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java index 3e8266ea2d29..82f2e1ac6752 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ public void testOneProperty() { assertTrue("contains one entry", p.entrySet().size() == 1); assertTrue("foo=bar", p.get("foo").equals("bar")); } - + public void testTwoProperties() { String s = "foo=bar with whitespace\n" + "me=mi"; @@ -51,7 +51,7 @@ public void testTwoProperties() { assertTrue("foo=bar with whitespace", p.get("foo").equals("bar with whitespace")); assertTrue("me=mi", p.get("me").equals("mi")); } - + public void testHandlesEqualsInValue() { String s = "foo=bar\n" + "me=mi\n" + @@ -64,7 +64,7 @@ public void testHandlesEqualsInValue() { assertTrue("me=mi", p.get("me").equals("mi")); assertTrue("x='y=z'", p.get("x").equals("y=z")); } - + public void testHandlesEmptyProperty() { String s = "foo=bar\nme=mi\nx="; PropertiesEditor pe= new PropertiesEditor(); @@ -75,7 +75,7 @@ public void testHandlesEmptyProperty() { assertTrue("me=mi", p.get("me").equals("mi")); assertTrue("x='y=z'", p.get("x").equals("")); } - + public void testHandlesEmptyPropertyWithoutEquals() { String s = "foo\nme=mi\nx=x"; PropertiesEditor pe= new PropertiesEditor(); @@ -85,7 +85,7 @@ public void testHandlesEmptyPropertyWithoutEquals() { assertTrue("foo is empty", p.get("foo").equals("")); assertTrue("me=mi", p.get("me").equals("mi")); } - + /** * Comments begin with # */ @@ -124,14 +124,14 @@ public void testIgnoresLeadingSpacesAndTabs() { assertTrue("foo is bar", p.get("foo").equals("bar")); assertTrue("me=mi", p.get("me").equals("mi")); } - + public void testNull() { PropertiesEditor pe= new PropertiesEditor(); pe.setAsText(null); Properties p = (Properties) pe.getValue(); assertEquals(0, p.size()); } - + public void testEmptyString() { PropertiesEditor pe = new PropertiesEditor(); pe.setAsText(""); @@ -140,7 +140,7 @@ public void testEmptyString() { } public void testUsingMapAsValueSource() throws Exception { - Map map = new HashMap(); + Map map = new HashMap(); map.put("one", "1"); map.put("two", "2"); map.put("three", "3"); diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java index cf90255ed0df..5f7deb4e1424 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URIEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URIEditorTests.java index 426ceac13cb7..6e0b804e1872 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URIEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URIEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URLEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URLEditorTests.java index 16c7e9353d9f..0541adcc0c86 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URLEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/URLEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-beans/src/test/java/org/springframework/beans/support/DerivedFromProtectedBaseBean.java b/spring-beans/src/test/java/org/springframework/beans/support/DerivedFromProtectedBaseBean.java index c9733f61d3f9..fc41a86301f2 100644 --- a/spring-beans/src/test/java/org/springframework/beans/support/DerivedFromProtectedBaseBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/support/DerivedFromProtectedBaseBean.java @@ -22,4 +22,4 @@ */ public class DerivedFromProtectedBaseBean extends ProtectedBaseBean { -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java b/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java index 0d1712048fa6..ba30c93b4fbf 100644 --- a/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,17 +17,9 @@ package org.springframework.beans.support; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Locale; -import java.util.Map; - import junit.framework.TestCase; -import org.springframework.beans.BeanWrapper; -import org.springframework.beans.BeanWrapperImpl; - import test.beans.TestBean; /** @@ -47,12 +39,12 @@ public void testPagedListHolder() { TestBean tb3 = new TestBean(); tb3.setName("Rod"); tb3.setAge(32); - List tbs = new ArrayList(); + List tbs = new ArrayList(); tbs.add(tb1); tbs.add(tb2); tbs.add(tb3); - PagedListHolder holder = new PagedListHolder(tbs); + PagedListHolder holder = new PagedListHolder(tbs); assertTrue("Correct source", holder.getSource() == tbs); assertTrue("Correct number of elements", holder.getNrOfElements() == 3); assertTrue("Correct number of pages", holder.getPageCount() == 1); diff --git a/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java b/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java index 6d74ebe73962..4b618303d83c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ /** * Unit tests for {@link PropertyComparator} - * + * * @see org.springframework.util.comparator.ComparatorTests - * + * * @author Keith Donald * @author Chris Beams */ @@ -96,7 +96,7 @@ public void testCompoundComparatorInvert() { } - private static class Dog implements Comparable { + public static class Dog implements Comparable { private String nickName; diff --git a/spring-beans/src/test/java/org/springframework/beans/support/ProtectedBaseBean.java b/spring-beans/src/test/java/org/springframework/beans/support/ProtectedBaseBean.java index 7601cfd833dd..84c8e675a0bf 100644 --- a/spring-beans/src/test/java/org/springframework/beans/support/ProtectedBaseBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/support/ProtectedBaseBean.java @@ -32,4 +32,4 @@ public String getSomeProperty() { return someProperty; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/BooleanTestBean.java b/spring-beans/src/test/java/test/beans/BooleanTestBean.java index 37a022b66147..0562851a121c 100644 --- a/spring-beans/src/test/java/test/beans/BooleanTestBean.java +++ b/spring-beans/src/test/java/test/beans/BooleanTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,4 +43,4 @@ public void setBool2(Boolean bool2) { this.bool2 = bool2; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/Colour.java b/spring-beans/src/test/java/test/beans/Colour.java index f67b96cc0a6e..d2c4d5d91163 100644 --- a/spring-beans/src/test/java/test/beans/Colour.java +++ b/spring-beans/src/test/java/test/beans/Colour.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ /** * @author Rob Harrop */ +@SuppressWarnings("deprecation") public class Colour extends ShortCodedLabeledEnum { public static final Colour RED = new Colour(0, "RED"); @@ -32,4 +33,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/CustomEnum.java b/spring-beans/src/test/java/test/beans/CustomEnum.java index d7404bc67861..86279243591c 100644 --- a/spring-beans/src/test/java/test/beans/CustomEnum.java +++ b/spring-beans/src/test/java/test/beans/CustomEnum.java @@ -27,4 +27,4 @@ public String toString() { return "CustomEnum: " + name(); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/DummyBean.java b/spring-beans/src/test/java/test/beans/DummyBean.java index 54ae5e65d6d4..6c83aed20983 100644 --- a/spring-beans/src/test/java/test/beans/DummyBean.java +++ b/spring-beans/src/test/java/test/beans/DummyBean.java @@ -1,12 +1,12 @@ /* * Copyright 2010 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ public class DummyBean { private String name; private int age; private TestBean spouse; - + public DummyBean(Object value) { this.value = value; } diff --git a/spring-beans/src/test/java/test/beans/DummyFactory.java b/spring-beans/src/test/java/test/beans/DummyFactory.java index 75b585a498fb..32ca25bd3aed 100644 --- a/spring-beans/src/test/java/test/beans/DummyFactory.java +++ b/spring-beans/src/test/java/test/beans/DummyFactory.java @@ -176,4 +176,4 @@ public void destroy() { } } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/GenericBean.java b/spring-beans/src/test/java/test/beans/GenericBean.java index 12ff808dc84e..9879b4fe90d0 100644 --- a/spring-beans/src/test/java/test/beans/GenericBean.java +++ b/spring-beans/src/test/java/test/beans/GenericBean.java @@ -47,6 +47,7 @@ public class GenericBean { private List> listOfMaps; + @SuppressWarnings("rawtypes") private Map plainMap; private Map shortMap; @@ -91,6 +92,7 @@ public GenericBean(Map shortMap, Resource resource) { this.resourceList = Collections.singletonList(resource); } + @SuppressWarnings("rawtypes") public GenericBean(Map plainMap, Map shortMap) { this.plainMap = plainMap; this.shortMap = shortMap; @@ -161,6 +163,7 @@ public void setListOfMaps(List> listOfMaps) { this.listOfMaps = listOfMaps; } + @SuppressWarnings("rawtypes") public Map getPlainMap() { return plainMap; } @@ -237,51 +240,58 @@ public void setCustomEnumArray(CustomEnum[] customEnum) { this.customEnumArray = customEnum; } - public Set getCustomEnumSet() { - return customEnumSet; - } - public void setCustomEnumSet(Set customEnumSet) { this.customEnumSet = customEnumSet; } + public Set getCustomEnumSet() { + return customEnumSet; + } + public Set getCustomEnumSetMismatch() { return customEnumSet; } public void setCustomEnumSetMismatch(Set customEnumSet) { this.customEnumSet = new HashSet(customEnumSet.size()); - for (Iterator iterator = customEnumSet.iterator(); iterator.hasNext(); ) { + for (Iterator iterator = customEnumSet.iterator(); iterator.hasNext();) { this.customEnumSet.add(CustomEnum.valueOf(iterator.next())); } } - public static GenericBean createInstance(Set integerSet) { - return new GenericBean(integerSet); + public static GenericBean> createInstance(Set integerSet) { + return new GenericBean>(integerSet); } - public static GenericBean createInstance(Set integerSet, List resourceList) { - return new GenericBean(integerSet, resourceList); + public static GenericBean> createInstance(Set integerSet, + List resourceList) { + return new GenericBean>(integerSet, resourceList); } - public static GenericBean createInstance(HashSet integerSet, Map shortMap) { - return new GenericBean(integerSet, shortMap); + public static GenericBean> createInstance(HashSet integerSet, + Map shortMap) { + return new GenericBean>(integerSet, shortMap); } - public static GenericBean createInstance(Map shortMap, Resource resource) { - return new GenericBean(shortMap, resource); + public static GenericBean> createInstance(Map shortMap, + Resource resource) { + return new GenericBean>(shortMap, resource); } - public static GenericBean createInstance(Map map, Map shortMap) { - return new GenericBean(map, shortMap); + @SuppressWarnings("rawtypes") + public static GenericBean> createInstance(Map plainMap, + Map shortMap) { + return new GenericBean>(plainMap, shortMap); } - public static GenericBean createInstance(HashMap longMap) { - return new GenericBean(longMap); + public static GenericBean> createInstance(HashMap longMap) { + return new GenericBean>(longMap); } - public static GenericBean createInstance(boolean someFlag, Map> collectionMap) { - return new GenericBean(someFlag, collectionMap); + public static GenericBean>> createInstance( + boolean someFlag, Map> collectionMap) { + return new GenericBean>>(someFlag, + collectionMap); } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/GenericIntegerBean.java b/spring-beans/src/test/java/test/beans/GenericIntegerBean.java index 43b6465df08c..1de65333aaa5 100644 --- a/spring-beans/src/test/java/test/beans/GenericIntegerBean.java +++ b/spring-beans/src/test/java/test/beans/GenericIntegerBean.java @@ -22,4 +22,4 @@ */ public class GenericIntegerBean extends GenericBean { -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java b/spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java index 021c0cd1c162..560ce6a60bd8 100644 --- a/spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java +++ b/spring-beans/src/test/java/test/beans/GenericSetOfIntegerBean.java @@ -24,4 +24,4 @@ */ public class GenericSetOfIntegerBean extends GenericBean> { -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/INestedTestBean.java b/spring-beans/src/test/java/test/beans/INestedTestBean.java index 228109c284ab..1023dbbc1399 100644 --- a/spring-beans/src/test/java/test/beans/INestedTestBean.java +++ b/spring-beans/src/test/java/test/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/IOther.java b/spring-beans/src/test/java/test/beans/IOther.java index 734235aa068a..80fe4e84983b 100644 --- a/spring-beans/src/test/java/test/beans/IOther.java +++ b/spring-beans/src/test/java/test/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/ITestBean.java b/spring-beans/src/test/java/test/beans/ITestBean.java index 9397b1755036..5d72ebf8c36f 100644 --- a/spring-beans/src/test/java/test/beans/ITestBean.java +++ b/spring-beans/src/test/java/test/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/IndexedTestBean.java b/spring-beans/src/test/java/test/beans/IndexedTestBean.java index bd2a72662f6f..1d65e169a818 100644 --- a/spring-beans/src/test/java/test/beans/IndexedTestBean.java +++ b/spring-beans/src/test/java/test/beans/IndexedTestBean.java @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/LifecycleBean.java b/spring-beans/src/test/java/test/beans/LifecycleBean.java index 145413deefb7..1cb1f7500bbf 100644 --- a/spring-beans/src/test/java/test/beans/LifecycleBean.java +++ b/spring-beans/src/test/java/test/beans/LifecycleBean.java @@ -161,4 +161,4 @@ public Object postProcessAfterInitialization(Object bean, String name) throws Be } } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/NestedTestBean.java b/spring-beans/src/test/java/test/beans/NestedTestBean.java index d3fde438b67b..b0f9df9d9b6e 100644 --- a/spring-beans/src/test/java/test/beans/NestedTestBean.java +++ b/spring-beans/src/test/java/test/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/NumberTestBean.java b/spring-beans/src/test/java/test/beans/NumberTestBean.java index 2a4db759b665..f69bbf77cf2d 100644 --- a/spring-beans/src/test/java/test/beans/NumberTestBean.java +++ b/spring-beans/src/test/java/test/beans/NumberTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -140,4 +140,4 @@ public void setBigDecimal(BigDecimal bigDecimal) { this.bigDecimal = bigDecimal; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java b/spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java index 167211091f51..a77af92d129f 100644 --- a/spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java +++ b/spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java @@ -25,5 +25,5 @@ class PackageLevelVisibleBean { public static final String CONSTANT = "Wuby"; - + } diff --git a/spring-beans/src/test/java/test/beans/TestBean.java b/spring-beans/src/test/java/test/beans/TestBean.java index 7e8089e6e7ad..414c41cc6b64 100644 --- a/spring-beans/src/test/java/test/beans/TestBean.java +++ b/spring-beans/src/test/java/test/beans/TestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ * @author Juergen Hoeller * @since 15 April 2001 */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { +public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { private String beanName; @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-beans/src/test/java/test/util/TestResourceUtils.java b/spring-beans/src/test/java/test/util/TestResourceUtils.java index 410788d2c155..03303e78a549 100644 --- a/spring-beans/src/test/java/test/util/TestResourceUtils.java +++ b/spring-beans/src/test/java/test/util/TestResourceUtils.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,65 @@ import static java.lang.String.format; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; /** * Convenience utilities for common operations with test resources. * * @author Chris Beams + * @author Phillip Webb */ public class TestResourceUtils { - /** - * Loads a {@link ClassPathResource} qualified by the simple name of clazz, - * and relative to the package for clazz. - * - *

    Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', - * this method will return a ClassPathResource representing com/foo/BarTests-context.xml - * - *

    Intended for use loading context configuration XML files within JUnit tests. - * - * @param clazz - * @param resourceSuffix - */ - public static ClassPathResource qualifiedResource(Class clazz, String resourceSuffix) { - return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), resourceSuffix), clazz); - } + /** + * Loads a {@link ClassPathResource} qualified by the simple name of clazz, and relative to the package for clazz. + * + *

    + * Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', this method will return a + * ClassPathResource representing com/foo/BarTests-context.xml + * + *

    + * Intended for use loading context configuration XML files within JUnit tests. + * + * @param clazz + * @param resourceSuffix + */ + public static ClassPathResource qualifiedResource(Class clazz, + String resourceSuffix) { + return new ClassPathResource(format("%s-%s", clazz.getSimpleName(), + resourceSuffix), clazz); + } + + /** + * Creates a {@link DefaultListableBeanFactory} using a {@link #qualifiedResource(Class, String) qualified XML + * resource}. + * + * @param clazz + * @param resourceSuffix + */ + public static DefaultListableBeanFactory beanFactoryFromQualifiedResource( + Class clazz, String resourceSuffix) { + return beanFactoryFromQualifiedResource(clazz, resourceSuffix, null); + } + /** + * Creates a {@link DefaultListableBeanFactory} using a {@link #qualifiedResource(Class, String) qualified XML + * resource}. + * + * @param clazz + * @param resourceSuffix + * @param parentBeanFactory + */ + public static DefaultListableBeanFactory beanFactoryFromQualifiedResource( + Class clazz, String resourceSuffix, BeanFactory parentBeanFactory) { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory( + parentBeanFactory); + XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); + ClassPathResource resource = qualifiedResource(clazz, resourceSuffix); + reader.loadBeanDefinitions(resource); + return beanFactory; + } } diff --git a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java index 80ca887b9c3f..898e37191da1 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java +++ b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java @@ -98,5 +98,4 @@ public Cache getCache(String name) { } return cache; } - } diff --git a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java index 8ae68321dcd1..1fc70da90551 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/mail/MailSender.java b/spring-context-support/src/main/java/org/springframework/mail/MailSender.java index 390b9508715a..fb44ac572e75 100644 --- a/spring-context-support/src/main/java/org/springframework/mail/MailSender.java +++ b/spring-context-support/src/main/java/org/springframework/mail/MailSender.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,7 +30,7 @@ * @see org.springframework.mail.javamail.JavaMailSender */ public interface MailSender { - + /** * Send the given simple mail message. * @param simpleMessage the message to send diff --git a/spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java b/spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java index e5e5fe73b8c8..0a25079e9bd8 100644 --- a/spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java +++ b/spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ public SimpleMailMessage() { /** * Copy constructor for creating a new SimpleMailMessage from the state * of an existing SimpleMailMessage instance. - * @throws IllegalArgumentException if the supplied message is null + * @throws IllegalArgumentException if the supplied message is null */ public SimpleMailMessage(SimpleMailMessage original) { Assert.notNull(original, "The 'original' message argument cannot be null"); @@ -168,7 +168,7 @@ public String getText() { /** * Copy the contents of this message to the given target message. * @param target the MailMessage to copy to - * @throws IllegalArgumentException if the supplied target is null + * @throws IllegalArgumentException if the supplied target is null */ public void copyTo(MailMessage target) { Assert.notNull(target, "The 'target' message argument cannot be null"); diff --git a/spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java b/spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java index e0fdfadf7eca..015f4e388858 100644 --- a/spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java +++ b/spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java b/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java index 8c4557974c0b..ce9235c22c47 100644 --- a/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java +++ b/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java b/spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java index b4984c693de3..875c4e024244 100644 --- a/spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java +++ b/spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingTimerListener.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingTimerListener.java index 853ea465f245..54f3534e40a6 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingTimerListener.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingTimerListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingWork.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingWork.java index 6566dc789204..80a0b556ea0b 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingWork.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingWork.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerAccessor.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerAccessor.java index 46db6ee2c09e..1090e0ce817b 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerAccessor.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerFactoryBean.java index e46cbdba7014..99a848366d11 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java index 4d1518dfa9a9..c6af9013cd57 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java @@ -182,12 +182,14 @@ public WorkItem schedule(Work work, WorkListener workListener) return this.workManager.schedule(work, workListener); } + @SuppressWarnings("rawtypes") public boolean waitForAll(Collection workItems, long timeout) throws InterruptedException, IllegalArgumentException { return this.workManager.waitForAll(workItems, timeout); } + @SuppressWarnings("rawtypes") public Collection waitForAny(Collection workItems, long timeout) throws InterruptedException, IllegalArgumentException { diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/AdaptableJobFactory.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/AdaptableJobFactory.java index aa40358ca9f0..34fe01d5db73 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/AdaptableJobFactory.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/AdaptableJobFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { Method getJobDetail = bundle.getClass().getMethod("getJobDetail"); Object jobDetail = ReflectionUtils.invokeMethod(getJobDetail, bundle); Method getJobClass = jobDetail.getClass().getMethod("getJobClass"); - Class jobClass = (Class) ReflectionUtils.invokeMethod(getJobClass, jobDetail); + Class jobClass = (Class) ReflectionUtils.invokeMethod(getJobClass, jobDetail); return jobClass.newInstance(); } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerBean.java index cee2683dce5c..660e38bc3984 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java index b205e6d73af1..72424865a7a8 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java @@ -230,7 +230,7 @@ else if (this.startTime == null) { this.cronTrigger = cti; */ - Class cronTriggerClass; + Class cronTriggerClass; Method jobKeyMethod; try { cronTriggerClass = getClass().getClassLoader().loadClass("org.quartz.impl.triggers.CronTriggerImpl"); diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/DelegatingJob.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/DelegatingJob.java index bcec0e566a6e..f75e95951ef6 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/DelegatingJob.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/DelegatingJob.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailBean.java index 34c8395c93bd..b0dd09a1a1d5 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public class JobDetailBean extends JobDetail implements BeanNameAware, ApplicationContextAware, InitializingBean { - private Class actualJobClass; + private Class actualJobClass; private String beanName; @@ -65,6 +65,7 @@ public class JobDetailBean extends JobDetail * to adapt the given job class to the Quartz Job interface. * @see SchedulerFactoryBean#setJobFactory */ + @SuppressWarnings("rawtypes") @Override public void setJobClass(Class jobClass) { if (jobClass != null && !Job.class.isAssignableFrom(jobClass)) { @@ -81,7 +82,7 @@ public void setJobClass(Class jobClass) { * to adapt the given job class to the Quartz Job interface. */ @Override - public Class getJobClass() { + public Class getJobClass() { return (this.actualJobClass != null ? this.actualJobClass : super.getJobClass()); } @@ -96,6 +97,7 @@ public Class getJobClass() { * (for example Spring-managed beans) * @see SchedulerFactoryBean#setSchedulerContextAsMap */ + @SuppressWarnings("rawtypes") public void setJobDataAsMap(Map jobDataAsMap) { getJobDataMap().putAll(jobDataAsMap); } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java index 921a5e03d462..4f43f37f6b92 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java @@ -56,7 +56,7 @@ public class JobDetailFactoryBean private String group; - private Class jobClass; + private Class jobClass; private JobDataMap jobDataMap = new JobDataMap(); @@ -90,6 +90,7 @@ public void setGroup(String group) { /** * Specify the job's implementation class. */ + @SuppressWarnings("rawtypes") public void setJobClass(Class jobClass) { this.jobClass = jobClass; } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java index 139febeb7d2c..752dd5d39317 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,14 +83,14 @@ public class LocalDataSourceJobStore extends JobStoreCMT { @Override public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) - throws SchedulerConfigException { + throws SchedulerConfigException { // Absolutely needs thread-bound DataSource to initialize. this.dataSource = SchedulerFactoryBean.getConfigTimeDataSource(); if (this.dataSource == null) { throw new SchedulerConfigException( - "No local DataSource found for configuration - " + - "'dataSource' property must be set on SchedulerFactoryBean"); + "No local DataSource found for configuration - " + + "'dataSource' property must be set on SchedulerFactoryBean"); } // Configure transactional connection settings for Quartz. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java index 8738e21a5198..60d6f397a699 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,8 +52,8 @@ public void initialize() throws SchedulerConfigException { this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor(); if (this.taskExecutor == null) { throw new SchedulerConfigException( - "No local TaskExecutor found for configuration - " + - "'taskExecutor' property must be set on SchedulerFactoryBean"); + "No local TaskExecutor found for configuration - " + + "'taskExecutor' property must be set on SchedulerFactoryBean"); } } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java index 80ce225457af..2ae7fc7c1b9c 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java @@ -92,7 +92,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod jobDetailImplClass = null; } try { - Class jobExecutionContextClass = + Class jobExecutionContextClass = QuartzJobBean.class.getClassLoader().loadClass("org.quartz.JobExecutionContext"); setResultMethod = jobExecutionContextClass.getMethod("setResult", Object.class); } @@ -189,7 +189,7 @@ public void setBeanFactory(BeanFactory beanFactory) { } @Override - protected Class resolveClassName(String className) throws ClassNotFoundException { + protected Class resolveClassName(String className) throws ClassNotFoundException { return ClassUtils.forName(className, this.beanClassLoader); } @@ -201,7 +201,7 @@ public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodExce String name = (this.name != null ? this.name : this.beanName); // Consider the concurrent flag to choose between stateful and stateless job. - Class jobClass = (this.concurrent ? MethodInvokingJob.class : StatefulMethodInvokingJob.class); + Class jobClass = (this.concurrent ? MethodInvokingJob.class : StatefulMethodInvokingJob.class); // Build JobDetail instance. if (jobDetailImplClass != null) { @@ -249,8 +249,8 @@ protected void postProcessJobDetail(JobDetail jobDetail) { * Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature. */ @Override - public Class getTargetClass() { - Class targetClass = super.getTargetClass(); + public Class getTargetClass() { + Class targetClass = super.getTargetClass(); if (targetClass == null && this.targetBeanName != null) { Assert.state(this.beanFactory != null, "BeanFactory must be set when using 'targetBeanName'"); targetClass = this.beanFactory.getType(this.targetBeanName); diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java index 6b193b43d5e6..fa71447ccde6 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ public abstract class QuartzJobBean implements Job { static { try { - Class jobExecutionContextClass = + Class jobExecutionContextClass = QuartzJobBean.class.getClassLoader().loadClass("org.quartz.JobExecutionContext"); getSchedulerMethod = jobExecutionContextClass.getMethod("getScheduler"); getMergedJobDataMapMethod = jobExecutionContextClass.getMethod("getMergedJobDataMap"); @@ -99,7 +99,7 @@ public final void execute(JobExecutionContext context) throws JobExecutionExcept try { // Reflectively adapting to differences between Quartz 1.x and Quartz 2.0... Scheduler scheduler = (Scheduler) ReflectionUtils.invokeMethod(getSchedulerMethod, context); - Map mergedJobDataMap = (Map) ReflectionUtils.invokeMethod(getMergedJobDataMapMethod, context); + Map mergedJobDataMap = (Map) ReflectionUtils.invokeMethod(getMergedJobDataMapMethod, context); BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this); MutablePropertyValues pvs = new MutablePropertyValues(); diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/ResourceLoaderClassLoadHelper.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/ResourceLoaderClassLoadHelper.java index c77a1480a50c..d6b61f90ee8d 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/ResourceLoaderClassLoadHelper.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/ResourceLoaderClassLoadHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,14 +71,16 @@ public void initialize() { } } + @SuppressWarnings("rawtypes") public Class loadClass(String name) throws ClassNotFoundException { return this.resourceLoader.getClassLoader().loadClass(name); } @SuppressWarnings("unchecked") - public Class loadClass(String name, Class clazz) throws ClassNotFoundException { - return loadClass(name); - } + public Class loadClass(String name, Class clazz) + throws ClassNotFoundException { + return loadClass(name); + } public URL getResource(String name) { Resource resource = this.resourceLoader.getResource(name); diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java index 07e85c514c18..14c1b0095608 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java @@ -258,7 +258,7 @@ protected void registerJobsAndTriggers() throws SchedulerException { clh.initialize(); try { // Quartz 1.8 or higher? - Class dataProcessorClass = getClass().getClassLoader().loadClass("org.quartz.xml.XMLSchedulingDataProcessor"); + Class dataProcessorClass = getClass().getClassLoader().loadClass("org.quartz.xml.XMLSchedulingDataProcessor"); logger.debug("Using Quartz 1.8 XMLSchedulingDataProcessor"); Object dataProcessor = dataProcessorClass.getConstructor(ClassLoadHelper.class).newInstance(clh); Method processFileAndScheduleJobs = dataProcessorClass.getMethod("processFileAndScheduleJobs", String.class, Scheduler.class); @@ -268,7 +268,7 @@ protected void registerJobsAndTriggers() throws SchedulerException { } catch (ClassNotFoundException ex) { // Quartz 1.6 - Class dataProcessorClass = getClass().getClassLoader().loadClass("org.quartz.xml.JobSchedulingDataProcessor"); + Class dataProcessorClass = getClass().getClassLoader().loadClass("org.quartz.xml.JobSchedulingDataProcessor"); logger.debug("Using Quartz 1.6 JobSchedulingDataProcessor"); Object dataProcessor = dataProcessorClass.getConstructor(ClassLoadHelper.class, boolean.class, boolean.class).newInstance(clh, true, true); Method processFileAndScheduleJobs = dataProcessorClass.getMethod("processFileAndScheduleJobs", String.class, Scheduler.class, boolean.class); @@ -396,7 +396,9 @@ private JobDetail findJobDetail(Trigger trigger) { } else { try { - Map jobDataMap = (Map) ReflectionUtils.invokeMethod(Trigger.class.getMethod("getJobDataMap"), trigger); + @SuppressWarnings("unchecked") + Map jobDataMap = (Map) ReflectionUtils.invokeMethod( + Trigger.class.getMethod("getJobDataMap"), trigger); return (JobDetail) jobDataMap.get(JobDetailAwareTrigger.JOB_DETAIL_KEY); } catch (NoSuchMethodException ex) { diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java index 966ad09b74da..ac2c017a4986 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -173,7 +173,8 @@ public static DataSource getConfigTimeNonTransactionalDataSource() { private DataSource nonTransactionalDataSource; - private Map schedulerContextMap; + @SuppressWarnings("rawtypes") + private Map schedulerContextMap; private ApplicationContext applicationContext; @@ -208,7 +209,7 @@ public static DataSource getConfigTimeNonTransactionalDataSource() { * @see #setConfigLocation * @see #setQuartzProperties */ - public void setSchedulerFactoryClass(Class schedulerFactoryClass) { + public void setSchedulerFactoryClass(Class schedulerFactoryClass) { if (schedulerFactoryClass == null || !SchedulerFactory.class.isAssignableFrom(schedulerFactoryClass)) { throw new IllegalArgumentException("schedulerFactoryClass must implement [org.quartz.SchedulerFactory]"); } @@ -313,7 +314,8 @@ public void setNonTransactionalDataSource(DataSource nonTransactionalDataSource) * values (for example Spring-managed beans) * @see JobDetailBean#setJobDataAsMap */ - public void setSchedulerContextAsMap(Map schedulerContextAsMap) { + @SuppressWarnings("rawtypes") + public void setSchedulerContextAsMap(Map schedulerContextAsMap) { this.schedulerContextMap = schedulerContextAsMap; } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java index de51892481d4..b8d5f0bfa94d 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerBean.java index ca9d44c65868..1eb8e27aba96 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java index 5baffd047da6..0649c4e13fc0 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java @@ -231,7 +231,7 @@ else if (this.startTime == null) { this.simpleTrigger = sti; */ - Class simpleTriggerClass; + Class simpleTriggerClass; Method jobKeyMethod; try { simpleTriggerClass = getClass().getClassLoader().loadClass("org.quartz.impl.triggers.SimpleTriggerImpl"); diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SpringBeanJobFactory.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SpringBeanJobFactory.java index 5e555e2d04dd..54888d48e33b 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SpringBeanJobFactory.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SpringBeanJobFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java index 2abf6296e2e3..5b2a8a5b2c0f 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java +++ b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java index cf1652b5b6e1..32895bee90b5 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerTemplateUtils.java b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerTemplateUtils.java index f4ba0677529a..acc1e30b21df 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerTemplateUtils.java +++ b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerTemplateUtils.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java b/spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java index 7ed965ddb5d2..b3d1a3e2761c 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java +++ b/spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/jasperreports/JasperReportsUtils.java b/spring-context-support/src/main/java/org/springframework/ui/jasperreports/JasperReportsUtils.java index a4da611b261e..42ce2d61d9b4 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/jasperreports/JasperReportsUtils.java +++ b/spring-context-support/src/main/java/org/springframework/ui/jasperreports/JasperReportsUtils.java @@ -63,7 +63,7 @@ public static JRDataSource convertReportData(Object value) throws IllegalArgumen return (JRDataSource) value; } else if (value instanceof Collection) { - return new JRBeanCollectionDataSource((Collection) value); + return new JRBeanCollectionDataSource((Collection) value); } else if (value instanceof Object[]) { return new JRBeanArrayDataSource((Object[]) value); @@ -122,8 +122,9 @@ public static void render(JRExporter exporter, JasperPrint print, OutputStream o * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, - Writer writer) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer) + throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); render(new JRCsvExporter(), print, writer); @@ -141,8 +142,9 @@ public static void renderAsCsv(JasperReport report, Map paramete * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, - Writer writer, Map exporterParameters) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsCsv(JasperReport report, Map parameters, Object reportData, Writer writer, + Map exporterParameters) throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); JRCsvExporter exporter = new JRCsvExporter(); @@ -161,8 +163,9 @@ public static void renderAsCsv(JasperReport report, Map paramete * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsHtml(JasperReport report, Map parameters, Object reportData, - Writer writer) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsHtml(JasperReport report, Map parameters, Object reportData, Writer writer) + throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); render(new JRHtmlExporter(), print, writer); @@ -180,8 +183,9 @@ public static void renderAsHtml(JasperReport report, Map paramet * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsHtml(JasperReport report, Map parameters, Object reportData, - Writer writer, Map exporterParameters) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsHtml(JasperReport report, Map parameters, Object reportData, Writer writer, + Map exporterParameters) throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); JRHtmlExporter exporter = new JRHtmlExporter(); @@ -200,8 +204,9 @@ public static void renderAsHtml(JasperReport report, Map paramet * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsPdf(JasperReport report, Map parameters, Object reportData, - OutputStream stream) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsPdf(JasperReport report, Map parameters, Object reportData, OutputStream stream) + throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); render(new JRPdfExporter(), print, stream); @@ -219,8 +224,9 @@ public static void renderAsPdf(JasperReport report, Map paramete * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsPdf(JasperReport report, Map parameters, Object reportData, - OutputStream stream, Map exporterParameters) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsPdf(JasperReport report, Map parameters, Object reportData, OutputStream stream, + Map exporterParameters) throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); JRPdfExporter exporter = new JRPdfExporter(); @@ -239,8 +245,9 @@ public static void renderAsPdf(JasperReport report, Map paramete * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsXls(JasperReport report, Map parameters, Object reportData, - OutputStream stream) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsXls(JasperReport report, Map parameters, Object reportData, OutputStream stream) + throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); render(new JRXlsExporter(), print, stream); @@ -258,8 +265,9 @@ public static void renderAsXls(JasperReport report, Map paramete * @throws JRException if rendering failed * @see #convertReportData */ - public static void renderAsXls(JasperReport report, Map parameters, Object reportData, - OutputStream stream, Map exporterParameters) throws JRException { + @SuppressWarnings("rawtypes") + public static void renderAsXls(JasperReport report, Map parameters, Object reportData, OutputStream stream, + Map exporterParameters) throws JRException { JasperPrint print = JasperFillManager.fillReport(report, parameters, convertReportData(reportData)); JRXlsExporter exporter = new JRXlsExporter(); diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/CommonsLoggingLogSystem.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/CommonsLoggingLogSystem.java index b845d6c6aef5..dbef7731bc03 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/CommonsLoggingLogSystem.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/CommonsLoggingLogSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java index 302f989f7b46..2b7fa46d19b7 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java index 8d25492aa6ac..a66f75bf349b 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java index edee342be21f..7f81cad0544a 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java @@ -49,7 +49,7 @@ public abstract class VelocityEngineUtils { * @deprecated Use {@link #mergeTemplate(VelocityEngine, String, String, Map, Writer)} * instead, following Velocity 1.6's corresponding deprecation in its own API. */ - @Deprecated + @SuppressWarnings("rawtypes") public static void mergeTemplate( VelocityEngine velocityEngine, String templateLocation, Map model, Writer writer) throws VelocityException { @@ -80,6 +80,7 @@ public static void mergeTemplate( * @param writer the Writer to write the result to * @throws VelocityException if the template wasn't found or rendering failed */ + @SuppressWarnings("rawtypes") public static void mergeTemplate( VelocityEngine velocityEngine, String templateLocation, String encoding, Map model, Writer writer) throws VelocityException { @@ -113,9 +114,10 @@ public static void mergeTemplate( * @deprecated Use {@link #mergeTemplateIntoString(VelocityEngine, String, String, Map)} * instead, following Velocity 1.6's corresponding deprecation in its own API. */ - @Deprecated - public static String mergeTemplateIntoString(VelocityEngine velocityEngine, String templateLocation, - Map model) throws VelocityException { + @SuppressWarnings("rawtypes") + public static String mergeTemplateIntoString( + VelocityEngine velocityEngine, String templateLocation, Map model) + throws VelocityException { StringWriter result = new StringWriter(); mergeTemplate(velocityEngine, templateLocation, model, result); @@ -134,8 +136,10 @@ public static String mergeTemplateIntoString(VelocityEngine velocityEngine, Stri * @throws VelocityException if the template wasn't found or rendering failed * @see org.springframework.mail.MailPreparationException */ - public static String mergeTemplateIntoString(VelocityEngine velocityEngine, String templateLocation, - String encoding, Map model) throws VelocityException { + @SuppressWarnings("rawtypes") + public static String mergeTemplateIntoString( + VelocityEngine velocityEngine, String templateLocation, String encoding, Map model) + throws VelocityException { StringWriter result = new StringWriter(); mergeTemplate(velocityEngine, templateLocation, encoding, model, result); diff --git a/spring-context-support/src/test/java/org/springframework/beans/Colour.java b/spring-context-support/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..8ee70cc536c4 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/Colour.java +++ b/spring-context-support/src/test/java/org/springframework/beans/Colour.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ /** * @author Rob Harrop */ +@SuppressWarnings("deprecation") public class Colour extends ShortCodedLabeledEnum { public static final Colour RED = new Colour(0, "RED"); @@ -32,4 +33,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/beans/IOther.java b/spring-context-support/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/IOther.java +++ b/spring-context-support/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java b/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-context-support/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..c1949e7ec2a7 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-context-support/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,17 +34,17 @@ public class IndexedTestBean { private TestBean[] array; - private Collection collection; + private Collection collection; - private List list; + private List list; - private Set set; + private Set set; - private SortedSet sortedSet; + private SortedSet sortedSet; - private Map map; + private Map map; - private SortedMap sortedMap; + private SortedMap sortedMap; public IndexedTestBean() { @@ -69,17 +69,17 @@ public void populate() { TestBean tbX = new TestBean("nameX", 0); TestBean tbY = new TestBean("nameY", 0); this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); + this.list = new ArrayList(); this.list.add(tb2); this.list.add(tb3); - this.set = new TreeSet(); + this.set = new TreeSet(); this.set.add(tb6); this.set.add(tb7); - this.map = new HashMap(); + this.map = new HashMap(); this.map.put("key1", tb4); this.map.put("key2", tb5); this.map.put("key.3", tb5); - List list = new ArrayList(); + List list = new ArrayList(); list.add(tbX); list.add(tbY); this.map.put("key4", list); @@ -94,52 +94,52 @@ public void setArray(TestBean[] array) { this.array = array; } - public Collection getCollection() { + public Collection getCollection() { return collection; } - public void setCollection(Collection collection) { + public void setCollection(Collection collection) { this.collection = collection; } - public List getList() { + public List getList() { return list; } - public void setList(List list) { + public void setList(List list) { this.list = list; } - public Set getSet() { + public Set getSet() { return set; } - public void setSet(Set set) { + public void setSet(Set set) { this.set = set; } - public SortedSet getSortedSet() { + public SortedSet getSortedSet() { return sortedSet; } - public void setSortedSet(SortedSet sortedSet) { + public void setSortedSet(SortedSet sortedSet) { this.sortedSet = sortedSet; } - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public SortedMap getSortedMap() { + public SortedMap getSortedMap() { return sortedMap; } - public void setSortedMap(SortedMap sortedMap) { + public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/beans/TestBean.java b/spring-context-support/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..a913f2605494 100644 --- a/spring-context-support/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-context-support/src/test/java/org/springframework/beans/TestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ * @author Juergen Hoeller * @since 15 April 2001 */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { +public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { private String beanName; @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java b/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java index 5cb15498324a..e711d62096e0 100644 --- a/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java +++ b/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java @@ -28,6 +28,8 @@ import static org.junit.Assert.*; /** + * Test for native cache implementations. + * * @author Costin Leau */ public class EhCacheCacheTests { @@ -92,20 +94,4 @@ public void testCacheClear() throws Exception { assertNull(cache.get("vlaicu")); assertNull(cache.get("enescu")); } - - @Test - public void testExpiredElements() throws Exception { - String key = "brancusi"; - String value = "constantin"; - Element brancusi = new Element(key, value); - // ttl = 10s - brancusi.setTimeToLive(3); - nativeCache.put(brancusi); - - assertEquals(value, cache.get(key).get()); - // wait for the entry to expire - Thread.sleep(5 * 1000); - assertNull(cache.get(key)); - } - } diff --git a/spring-context-support/src/test/java/org/springframework/mail/SimpleMailMessageTests.java b/spring-context-support/src/test/java/org/springframework/mail/SimpleMailMessageTests.java index ad479d9d3074..3edeb7390405 100644 --- a/spring-context-support/src/test/java/org/springframework/mail/SimpleMailMessageTests.java +++ b/spring-context-support/src/test/java/org/springframework/mail/SimpleMailMessageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java b/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java index b0deb96a6a24..fbd491e89380 100644 --- a/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java +++ b/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Properties; @@ -59,7 +60,7 @@ public void testJavaMailSenderWithSimpleMessage() throws MessagingException, IOE simpleMessage.setTo("you@mail.org"); simpleMessage.setCc(new String[] {"he@mail.org", "she@mail.org"}); simpleMessage.setBcc(new String[] {"us@mail.org", "them@mail.org"}); - Date sentDate = new Date(2004, 1, 1); + Date sentDate = newDate(2004, 1, 1); simpleMessage.setSentDate(sentDate); simpleMessage.setSubject("my subject"); simpleMessage.setText("my text"); @@ -73,19 +74,19 @@ public void testJavaMailSenderWithSimpleMessage() throws MessagingException, IOE assertEquals(1, sender.transport.getSentMessages().size()); MimeMessage sentMessage = sender.transport.getSentMessage(0); - List froms = Arrays.asList(sentMessage.getFrom()); + List
    froms = Arrays.asList(sentMessage.getFrom()); assertEquals(1, froms.size()); assertEquals("me@mail.org", ((InternetAddress) froms.get(0)).getAddress()); - List replyTos = Arrays.asList(sentMessage.getReplyTo()); + List
    replyTos = Arrays.asList(sentMessage.getReplyTo()); assertEquals("reply@mail.org", ((InternetAddress) replyTos.get(0)).getAddress()); - List tos = Arrays.asList(sentMessage.getRecipients(Message.RecipientType.TO)); + List
    tos = Arrays.asList(sentMessage.getRecipients(Message.RecipientType.TO)); assertEquals(1, tos.size()); assertEquals("you@mail.org", ((InternetAddress) tos.get(0)).getAddress()); - List ccs = Arrays.asList(sentMessage.getRecipients(Message.RecipientType.CC)); + List
    ccs = Arrays.asList(sentMessage.getRecipients(Message.RecipientType.CC)); assertEquals(2, ccs.size()); assertEquals("he@mail.org", ((InternetAddress) ccs.get(0)).getAddress()); assertEquals("she@mail.org", ((InternetAddress) ccs.get(1)).getAddress()); - List bccs = Arrays.asList(sentMessage.getRecipients(Message.RecipientType.BCC)); + List
    bccs = Arrays.asList(sentMessage.getRecipients(Message.RecipientType.BCC)); assertEquals(2, bccs.size()); assertEquals("us@mail.org", ((InternetAddress) bccs.get(0)).getAddress()); assertEquals("them@mail.org", ((InternetAddress) bccs.get(1)).getAddress()); @@ -113,11 +114,11 @@ public void testJavaMailSenderWithSimpleMessages() throws MessagingException, IO assertEquals(2, sender.transport.getSentMessages().size()); MimeMessage sentMessage1 = sender.transport.getSentMessage(0); - List tos1 = Arrays.asList(sentMessage1.getRecipients(Message.RecipientType.TO)); + List
    tos1 = Arrays.asList(sentMessage1.getRecipients(Message.RecipientType.TO)); assertEquals(1, tos1.size()); assertEquals("he@mail.org", ((InternetAddress) tos1.get(0)).getAddress()); MimeMessage sentMessage2 = sender.transport.getSentMessage(1); - List tos2 = Arrays.asList(sentMessage2.getRecipients(Message.RecipientType.TO)); + List
    tos2 = Arrays.asList(sentMessage2.getRecipients(Message.RecipientType.TO)); assertEquals(1, tos2.size()); assertEquals("she@mail.org", ((InternetAddress) tos2.get(0)).getAddress()); } @@ -330,7 +331,8 @@ protected Transport getTransport(Session sess) throws NoSuchProviderException { MimeMessage mimeMessage = sender.createMimeMessage(); mimeMessage.setSubject("custom"); mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("you@mail.org")); - mimeMessage.setSentDate(new Date(2005, 3, 1)); + Date sentDate = newDate(2005, 3, 1); + mimeMessage.setSentDate(sentDate); sender.send(mimeMessage); assertEquals("host", sender.transport.getConnectedHost()); @@ -468,6 +470,12 @@ public void testFailedMimeMessage() throws Exception { } } + private static Date newDate(int year, int month, int day) { + Calendar c = Calendar.getInstance(); + c.set(year, month, day, 0, 0); + c.set(Calendar.MILLISECOND, 0); + return c.getTime(); + } private static class MockJavaMailSender extends JavaMailSenderImpl { @@ -514,7 +522,7 @@ public boolean isCloseCalled() { return closeCalled; } - public List getSentMessages() { + public List getSentMessages() { return sentMessages; } @@ -546,8 +554,8 @@ public void sendMessage(Message message, Address[] addresses) throws MessagingEx if ("fail".equals(message.getSubject())) { throw new MessagingException("failed"); } - List addr1 = Arrays.asList(message.getAllRecipients()); - List addr2 = Arrays.asList(addresses); + List
    addr1 = Arrays.asList(message.getAllRecipients()); + List
    addr2 = Arrays.asList(addresses); if (!addr1.equals(addr2)) { throw new MessagingException("addresses not correct"); } @@ -555,7 +563,8 @@ public void sendMessage(Message message, Address[] addresses) throws MessagingEx throw new MessagingException("No sentDate specified"); } if (message.getSubject() != null && message.getSubject().contains("custom")) { - assertEquals(new Date(2005, 3, 1), message.getSentDate()); + Date sentDate = newDate(2005, 3, 1); + assertEquals(sentDate, message.getSentDate()); } this.sentMessages.add(message); } diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java b/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java index a95a2408b546..364610db9e84 100644 --- a/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java +++ b/spring-context-support/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java @@ -49,4 +49,4 @@ public void stop() { } } -} \ No newline at end of file +} diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/CronTriggerBeanTests.java b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/CronTriggerBeanTests.java index fcd1a2f7c595..88fe3bd09c3e 100644 --- a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/CronTriggerBeanTests.java +++ b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/CronTriggerBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSchedulerLifecycleTests.java b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSchedulerLifecycleTests.java index 374a2e81d82f..2cca588faacf 100644 --- a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSchedulerLifecycleTests.java +++ b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSchedulerLifecycleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java index e1bd9a8c6391..94ac9a1d2a6a 100644 --- a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java +++ b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ private void doTestSchedulerFactoryBean(boolean explicitJobDetail, boolean proto JobDetailBean jobDetail0 = new JobDetailBean(); jobDetail0.setJobClass(Job.class); jobDetail0.setBeanName("myJob0"); - Map jobData = new HashMap(); + Map jobData = new HashMap(); jobData.put("testBean", tb); jobDetail0.setJobDataAsMap(jobData); jobDetail0.afterPropertiesSet(); @@ -118,7 +118,7 @@ private void doTestSchedulerFactoryBean(boolean explicitJobDetail, boolean proto } mijdfb.setTargetMethod("doSomething"); mijdfb.afterPropertiesSet(); - JobDetail jobDetail1 = (JobDetail) mijdfb.getObject(); + JobDetail jobDetail1 = mijdfb.getObject(); SimpleTriggerBean trigger1 = new SimpleTriggerBean(); trigger1.setBeanName("myTrigger1"); @@ -159,7 +159,7 @@ protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String sc } }; schedulerFactoryBean.setJobFactory(null); - Map schedulerContext = new HashMap(); + Map schedulerContext = new HashMap(); schedulerContext.put("otherTestBean", tb); schedulerFactoryBean.setSchedulerContextAsMap(schedulerContext); if (explicitJobDetail) { @@ -192,7 +192,7 @@ private void doTestSchedulerFactoryBeanWithExistingJobs(boolean overwrite) throw JobDetailBean jobDetail0 = new JobDetailBean(); jobDetail0.setJobClass(Job.class); jobDetail0.setBeanName("myJob0"); - Map jobData = new HashMap(); + Map jobData = new HashMap(); jobData.put("testBean", tb); jobDetail0.setJobDataAsMap(jobData); jobDetail0.afterPropertiesSet(); @@ -210,7 +210,7 @@ private void doTestSchedulerFactoryBeanWithExistingJobs(boolean overwrite) throw mijdfb.setTargetObject(task1); mijdfb.setTargetMethod("doSomething"); mijdfb.afterPropertiesSet(); - JobDetail jobDetail1 = (JobDetail) mijdfb.getObject(); + JobDetail jobDetail1 = mijdfb.getObject(); SimpleTriggerBean trigger1 = new SimpleTriggerBean(); trigger1.setBeanName("myTrigger1"); @@ -253,7 +253,7 @@ protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String sc } }; schedulerFactoryBean.setJobFactory(null); - Map schedulerContext = new HashMap(); + Map schedulerContext = new HashMap(); schedulerContext.put("otherTestBean", tb); schedulerFactoryBean.setSchedulerContextAsMap(schedulerContext); schedulerFactoryBean.setTriggers(new Trigger[] {trigger0, trigger1}); @@ -286,7 +286,7 @@ private void doTestSchedulerFactoryBeanWithExistingJobsAndRaceCondition(boolean JobDetailBean jobDetail0 = new JobDetailBean(); jobDetail0.setJobClass(Job.class); jobDetail0.setBeanName("myJob0"); - Map jobData = new HashMap(); + Map jobData = new HashMap(); jobData.put("testBean", tb); jobDetail0.setJobDataAsMap(jobData); jobDetail0.afterPropertiesSet(); @@ -304,7 +304,7 @@ private void doTestSchedulerFactoryBeanWithExistingJobsAndRaceCondition(boolean mijdfb.setTargetObject(task1); mijdfb.setTargetMethod("doSomething"); mijdfb.afterPropertiesSet(); - JobDetail jobDetail1 = (JobDetail) mijdfb.getObject(); + JobDetail jobDetail1 = mijdfb.getObject(); SimpleTriggerBean trigger1 = new SimpleTriggerBean(); trigger1.setBeanName("myTrigger1"); @@ -351,7 +351,7 @@ protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String sc } }; schedulerFactoryBean.setJobFactory(null); - Map schedulerContext = new HashMap(); + HashMap schedulerContext = new HashMap(); schedulerContext.put("otherTestBean", tb); schedulerFactoryBean.setSchedulerContextAsMap(schedulerContext); schedulerFactoryBean.setTriggers(new Trigger[] {trigger0, trigger1}); @@ -446,7 +446,7 @@ private void methodInvokingConcurrency(boolean concurrent) throws Exception { mijdfb.setTargetObject(task1); mijdfb.setTargetMethod("doWait"); mijdfb.afterPropertiesSet(); - JobDetail jobDetail1 = (JobDetail) mijdfb.getObject(); + JobDetail jobDetail1 = mijdfb.getObject(); SimpleTriggerBean trigger0 = new SimpleTriggerBean(); trigger0.setBeanName("myTrigger1"); @@ -532,7 +532,7 @@ public void testSchedulerFactoryBeanWithPlainQuartzObjects() throws Exception { mijdfb.setTargetObject(task1); mijdfb.setTargetMethod("doSomething"); mijdfb.afterPropertiesSet(); - JobDetail jobDetail1 = (JobDetail) mijdfb.getObject(); + JobDetail jobDetail1 = mijdfb.getObject(); SimpleTrigger trigger1 = new SimpleTrigger(); trigger1.setName("myTrigger1"); diff --git a/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java b/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java index 7e22fe88f754..2a211106982a 100644 --- a/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java +++ b/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java @@ -72,7 +72,7 @@ public void testRenderAsCsvWithCollection() throws Exception { public void testRenderAsCsvWithExporterParameters() throws Exception { StringWriter writer = new StringWriter(); - Map exporterParameters = new HashMap(); + Map exporterParameters = new HashMap(); exporterParameters.put(JRCsvExporterParameter.FIELD_DELIMITER, "~"); JasperReportsUtils.renderAsCsv(getReport(), getParameters(), getData(), writer, exporterParameters); String output = writer.getBuffer().toString(); @@ -96,7 +96,7 @@ public void testRenderAsHtmlWithCollection() throws Exception { public void testRenderAsHtmlWithExporterParameters() throws Exception { StringWriter writer = new StringWriter(); - Map exporterParameters = new HashMap(); + Map exporterParameters = new HashMap(); String uri = "/my/uri"; exporterParameters.put(JRHtmlExporterParameter.IMAGES_URI, uri); JasperReportsUtils.renderAsHtml(getReport(), getParameters(), getData(), writer, exporterParameters); @@ -121,7 +121,7 @@ public void testRenderAsPdfWithCollection() throws Exception { public void testRenderAsPdfWithExporterParameters() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); - Map exporterParameters = new HashMap(); + Map exporterParameters = new HashMap(); exporterParameters.put(JRPdfExporterParameter.PDF_VERSION, JRPdfExporterParameter.PDF_VERSION_1_6.toString()); JasperReportsUtils.renderAsPdf(getReport(), getParameters(), getData(), os, exporterParameters); byte[] output = os.toByteArray(); @@ -145,7 +145,7 @@ public void testRenderAsXlsWithCollection() throws Exception { public void testRenderAsXlsWithExporterParameters() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); - Map exporterParameters = new HashMap(); + Map exporterParameters = new HashMap(); SimpleProgressMonitor monitor = new SimpleProgressMonitor(); exporterParameters.put(JRXlsExporterParameter.PROGRESS_MONITOR, monitor); @@ -206,8 +206,8 @@ private JasperReport getReport() throws Exception { return (JasperReport) JRLoader.loadObject(resource.getInputStream()); } - private Map getParameters() { - Map model = new HashMap(); + private Map getParameters() { + HashMap model = new HashMap(); model.put("ReportTitle", "Dear Lord!"); model.put(JRParameter.REPORT_LOCALE, Locale.GERMAN); model.put(JRParameter.REPORT_RESOURCE_BUNDLE, @@ -220,7 +220,7 @@ private JRDataSource getDataSource() { } private List getData() { - List list = new ArrayList(); + ArrayList list = new ArrayList(); for (int x = 0; x < 10; x++) { PersonBean bean = new PersonBean(); bean.setId(x); diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java b/spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java index 3e6e49d760a1..6017ca6df2cf 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java @@ -38,7 +38,7 @@ /** * Qualifier value for the specified cached operation. - *

    May be used to determine the target cache (or caches), matching the qualifier + *

    May be used to determine the target cache (or caches), matching the qualifier * value (or the bean name(s)) of (a) specific bean definition. */ String[] value(); @@ -50,7 +50,7 @@ String key() default ""; /** - * Spring Expression Language (SpEL) attribute used for conditioning the method caching. + * Spring Expression Language (SpEL) attribute used for conditioning the method caching. *

    Default is "", meaning the method is always cached. */ String condition() default ""; diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java b/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java index 447ce62b4f8e..7116955e829e 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java @@ -52,7 +52,7 @@ String key() default ""; /** - * Spring Expression Language (SpEL) attribute used for conditioning the method caching. + * Spring Expression Language (SpEL) attribute used for conditioning the method caching. *

    Default is "", meaning the method is always cached. */ String condition() default ""; diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java b/spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java index 9114dfc6332b..1529a6c214da 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java @@ -154,15 +154,4 @@ private Collection getAnnotations(AnnotatedElement ae, return (anns.isEmpty() ? null : anns); } - - @Override - public boolean equals(Object other) { - return (this == other || other instanceof SpringCacheAnnotationParser); - } - - @Override - public int hashCode() { - return SpringCacheAnnotationParser.class.hashCode(); - } - } diff --git a/spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java b/spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java index 0da4c6850bca..5a9e5480cd4e 100644 --- a/spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java +++ b/spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java @@ -87,7 +87,7 @@ public String getName() { return this.name; } - public ConcurrentMap getNativeCache() { + public ConcurrentMap getNativeCache() { return this.store; } diff --git a/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java index 5cae8fdff480..8c0fb757bef7 100644 --- a/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java index 1a600193b931..3c8a0a40a649 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java @@ -223,7 +223,7 @@ protected Object execute(Invoker invoker, Object target, Method method, Object[] return invoker.invoke(); } - + private void inspectBeforeCacheEvicts(Collection evictions) { inspectCacheEvicts(evictions, true); } @@ -326,7 +326,7 @@ private CacheStatus inspectCacheables(Collection cacheabl } } } - + // return a status only if at least on cacheable matched if (atLeastOnePassed) { return new CacheStatus(cUpdates, updateRequire, retVal); @@ -470,4 +470,4 @@ protected Collection getCaches() { return this.caches; } } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java b/spring-context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java index cb0dcc95d8c5..619bd51ca73e 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java b/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java index 2ee38bb87280..9bcce589edc7 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/ExpressionEvaluator.java @@ -89,4 +89,4 @@ private String toString(Method method, String expression) { sb.append(expression); return sb.toString(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java b/spring-context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java index c8c3e27905b7..7dc1289a41a1 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java @@ -117,4 +117,4 @@ private String toString(Method m) { sb.append(m.toString()); return sb.toString(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java b/spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java index dc3203e6cf8a..0d41f1ab6f18 100644 --- a/spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java +++ b/spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java @@ -100,4 +100,30 @@ public void put(Object key, Object value) { } } + /** + * {@inheritDoc} + * + * This implementation always returns a {@link Cache} implementation that will not + * store items. Additionally, the request cache will be remembered by the manager for consistency. + */ + public Cache getCache(String name) { + Cache cache = caches.get(name); + if (cache == null) { + caches.putIfAbsent(name, new NoOpCache(name)); + synchronized (names) { + names.add(name); + } + } + + return caches.get(name); + } + + /** + * {@inheritDoc} + * + * This implementation returns the name of the caches previously requested. + */ + public Collection getCacheNames() { + return Collections.unmodifiableSet(names); + } } diff --git a/spring-context/src/main/java/org/springframework/context/ApplicationContext.java b/spring-context/src/main/java/org/springframework/context/ApplicationContext.java index 85336bc43ac2..2ded43906888 100644 --- a/spring-context/src/main/java/org/springframework/context/ApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/ApplicationContext.java @@ -22,7 +22,7 @@ import org.springframework.core.env.EnvironmentCapable; import org.springframework.core.io.support.ResourcePatternResolver; -/** +/** * Central interface to provide configuration for an application. * This is read-only while the application is running, but may be * reloaded if the implementation supports this. diff --git a/spring-context/src/main/java/org/springframework/context/ApplicationContextAware.java b/spring-context/src/main/java/org/springframework/context/ApplicationContextAware.java index 07a7f7f3ec83..8c74f2974a45 100644 --- a/spring-context/src/main/java/org/springframework/context/ApplicationContextAware.java +++ b/spring-context/src/main/java/org/springframework/context/ApplicationContextAware.java @@ -57,8 +57,8 @@ * @see org.springframework.beans.factory.BeanFactoryAware */ public interface ApplicationContextAware extends Aware { - - /** + + /** * Set the ApplicationContext that this object runs in. * Normally this call will be used to initialize the object. *

    Invoked after population of normal bean properties but before an init callback such diff --git a/spring-context/src/main/java/org/springframework/context/HierarchicalMessageSource.java b/spring-context/src/main/java/org/springframework/context/HierarchicalMessageSource.java index 45ef4243c769..dc15274a85a8 100644 --- a/spring-context/src/main/java/org/springframework/context/HierarchicalMessageSource.java +++ b/spring-context/src/main/java/org/springframework/context/HierarchicalMessageSource.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,8 +24,8 @@ * @author Juergen Hoeller */ public interface HierarchicalMessageSource extends MessageSource { - - /** + + /** * Set the parent that will be used to try to resolve messages * that this object can't resolve. * @param parent the parent MessageSource that will be used to diff --git a/spring-context/src/main/java/org/springframework/context/MessageSourceResolvable.java b/spring-context/src/main/java/org/springframework/context/MessageSourceResolvable.java index b6441e59d728..6590f111d52e 100644 --- a/spring-context/src/main/java/org/springframework/context/MessageSourceResolvable.java +++ b/spring-context/src/main/java/org/springframework/context/MessageSourceResolvable.java @@ -19,7 +19,7 @@ /** * Interface for objects that are suitable for message resolution in a * {@link MessageSource}. - * + * *

    Spring's own validation error classes implement this interface. * * @author Juergen Hoeller diff --git a/spring-context/src/main/java/org/springframework/context/NoSuchMessageException.java b/spring-context/src/main/java/org/springframework/context/NoSuchMessageException.java index b2ab999a3f53..38bb09b93512 100644 --- a/spring-context/src/main/java/org/springframework/context/NoSuchMessageException.java +++ b/spring-context/src/main/java/org/springframework/context/NoSuchMessageException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/main/java/org/springframework/context/Phased.java b/spring-context/src/main/java/org/springframework/context/Phased.java index 3d262233b946..b4b84d86d94b 100644 --- a/spring-context/src/main/java/org/springframework/context/Phased.java +++ b/spring-context/src/main/java/org/springframework/context/Phased.java @@ -19,7 +19,7 @@ /** * Interface for objects that may participate in a phased * process such as lifecycle management. - * + * * @author Mark Fisher * @since 3.0 * @see SmartLifecycle diff --git a/spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java b/spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java index 3491cd047baf..6b413e620456 100644 --- a/spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java +++ b/spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java @@ -46,7 +46,7 @@ *

    As alternative to a ResourcePatternResolver dependency, consider exposing * bean properties of type Resource array, populated via pattern Strings with * automatic type conversion by the bean factory. - * + * * @author Juergen Hoeller * @author Chris Beams * @since 10.03.2004 diff --git a/spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java b/spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java index fe56c165ae10..43d674367dd7 100644 --- a/spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java +++ b/spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -59,7 +59,7 @@ public BeanFactory getFactory() { public void release() { if (this.applicationContext != null) { ApplicationContext savedCtx; - + // We don't actually guarantee thread-safety, but it's not a lot of extra work. synchronized (this) { savedCtx = this.applicationContext; diff --git a/spring-context/src/main/java/org/springframework/context/access/DefaultLocatorFactory.java b/spring-context/src/main/java/org/springframework/context/access/DefaultLocatorFactory.java index 66e88b6bfc87..9b550724893b 100644 --- a/spring-context/src/main/java/org/springframework/context/access/DefaultLocatorFactory.java +++ b/spring-context/src/main/java/org/springframework/context/access/DefaultLocatorFactory.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/main/java/org/springframework/context/access/package-info.java b/spring-context/src/main/java/org/springframework/context/access/package-info.java index eeceb70a9f04..bcf7238ac6da 100644 --- a/spring-context/src/main/java/org/springframework/context/access/package-info.java +++ b/spring-context/src/main/java/org/springframework/context/access/package-info.java @@ -2,7 +2,7 @@ /** * * Helper infrastructure to locate and access shared application contexts. - * + * *

    Note: This package is only relevant for special sharing of application * contexts, for example behind EJB facades. It is not used in a typical * web application or standalone application. diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AdviceMode.java b/spring-context/src/main/java/org/springframework/context/annotation/AdviceMode.java index 91b82e2825d2..5b741d606943 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AdviceMode.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AdviceMode.java @@ -29,4 +29,4 @@ public enum AdviceMode { PROXY, ASPECTJ -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java index 60a05635aa9d..1a185248bacc 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java @@ -37,7 +37,7 @@ * {@link org.springframework.stereotype.Component @Component} as a * meta-annotation. For example, Spring's stereotype annotations (such as * {@link org.springframework.stereotype.Repository @Repository}) are - * themselves annotated with + * themselves annotated with * {@link org.springframework.stereotype.Component @Component}. * *

    Also supports Java EE 6's {@link javax.annotation.ManagedBean} and diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigBeanDefinitionParser.java index c25b536f9342..7d8feebd6fc4 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java b/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java index 804dbca526b5..5fcd8a572d0f 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import static org.springframework.context.annotation.MetadataUtils.attributesFor; -import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Bean.java b/spring-context/src/main/java/org/springframework/context/annotation/Bean.java index 900584037d12..4f40ea26aeb6 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Bean.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Bean.java @@ -118,7 +118,7 @@ * the invocation via a CGLIB proxy. This is analogous to inter-{@code @Transactional} * method calls where in proxy mode, Spring does not intercept the invocation — * Spring does so only in AspectJ mode. - * + * *

    For example: * *

    diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java b/spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java
    index a06bd3d7706d..bc2ed4e63cb4 100644
    --- a/spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java
    +++ b/spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java
    @@ -256,7 +256,7 @@ protected Set doScan(String... basePackages) {
     					beanDefinitions.add(definitionHolder);
     					registerBeanDefinition(definitionHolder, this.registry);
     				}
    -			}						
    +			}
     		}
     		return beanDefinitions;
     	}
    diff --git a/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
    index 295ebb500f81..b591f47e62f6 100644
    --- a/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
    +++ b/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
    @@ -127,7 +127,7 @@
      * to specify a custom CommonAnnotationBeanPostProcessor bean definition!
      * 

    NOTE: Annotation injection will be performed before XML injection; thus * the latter configuration will override the former for properties wired through - * both approaches. + * both approaches. * * @author Juergen Hoeller * @since 2.5 @@ -725,4 +725,4 @@ public Class getDependencyType() { } } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java index f7b567763525..d11667c2c883 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -239,7 +239,7 @@ else if ("regex".equals(filterType)) { return new RegexPatternTypeFilter(Pattern.compile(expression)); } else if ("custom".equals(filterType)) { - Class filterClass = classLoader.loadClass(expression); + Class filterClass = classLoader.loadClass(expression); if (!TypeFilter.class.isAssignableFrom(filterClass)) { throw new IllegalArgumentException( "Class is not assignable to [" + TypeFilter.class.getName() + "]: " + expression); @@ -255,8 +255,7 @@ else if ("custom".equals(filterType)) { } } - @SuppressWarnings("unchecked") - private Object instantiateUserDefinedStrategy(String className, Class strategyType, ClassLoader classLoader) { + private Object instantiateUserDefinedStrategy(String className, Class strategyType, ClassLoader classLoader) { Object result = null; try { result = classLoader.loadClass(className).newInstance(); diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java index 5268e633aa05..a25fdcf4ced0 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java @@ -178,7 +178,7 @@ public void validate(ProblemReporter problemReporter) { int newCount = currentCount != null ? currentCount + 1 : 1; methodNameCounts.put(fqMethodName, newCount); } - + for (String methodName : methodNameCounts.keySet()) { int count = methodNameCounts.get(methodName); if (count > 1) { @@ -186,7 +186,7 @@ public void validate(ProblemReporter problemReporter) { problemReporter.error(new BeanMethodOverloadingProblem(shortMethodName, count)); } } - + // A configuration class may not be final (CGLIB limitation) if (getMetadata().isAnnotated(Configuration.class.getName())) { if (getMetadata().isFinal()) { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java index e7fa93a246cb..58e2389752a6 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java @@ -88,6 +88,8 @@ class ConfigurationClassBeanDefinitionReader { /** * Create a new {@link ConfigurationClassBeanDefinitionReader} instance that will be used * to populate the given {@link BeanDefinitionRegistry}. + * @param problemReporter + * @param metadataReaderFactory */ public ConfigurationClassBeanDefinitionReader( BeanDefinitionRegistry registry, SourceExtractor sourceExtractor, @@ -333,7 +335,7 @@ public ConfigurationClassBeanDefinition cloneBeanDefinition() { } } - + /** * Configuration classes must be annotated with {@link Configuration @Configuration} or * declare at least one {@link Bean @Bean} method. diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java index 99678159d336..8ca2fc7a1e0b 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java @@ -335,14 +335,21 @@ private Object enhanceFactoryBean(Class fbClass, String beanName) throws Inst Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(fbClass); enhancer.setUseFactory(false); - enhancer.setCallbackFilter(CALLBACK_FITLER); - // Callback instances must be ordered in the same way as CALLBACK_TYPES and CALLBACK_FILTER - Callback[] callbackInstances = new Callback[] { - new GetObjectMethodInterceptor(this.beanFactory, beanName), - NoOp.INSTANCE - }; - - enhancer.setCallbackTypes(CALLBACK_TYPES); + enhancer.setCallbackFilter(new CallbackFilter() { + public int accept(Method method) { + return method.getName().equals("getObject") ? 0 : 1; + } + }); + List callbackInstances = new ArrayList(); + callbackInstances.add(new GetObjectMethodInterceptor(this.beanFactory, beanName)); + callbackInstances.add(NoOp.INSTANCE); + + List> callbackTypes = new ArrayList>(); + for (Callback callback : callbackInstances) { + callbackTypes.add(callback.getClass()); + } + + enhancer.setCallbackTypes(callbackTypes.toArray(new Class[callbackTypes.size()])); Class fbSubclass = enhancer.createClass(); Enhancer.registerCallbacks(fbSubclass, callbackInstances); return fbSubclass.newInstance(); diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java index f2fa6273e689..7afbc0273376 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java @@ -79,7 +79,7 @@ * that any {@link Bean} methods declared in Configuration classes have their * respective bean definitions registered before any other BeanFactoryPostProcessor * executes. - * + * * @author Chris Beams * @author Juergen Hoeller * @since 3.0 diff --git a/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java b/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java index a4cf352a2b73..effcec5df915 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java @@ -110,4 +110,4 @@ */ boolean proxyTargetClass() default false; -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java b/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java index da58779fd874..648a8e92113e 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java @@ -60,4 +60,4 @@ public interface ImportBeanDefinitionRegistrar { public void registerBeanDefinitions( AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry); -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java b/spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java index 8549d97f8e90..7e9ba2fcccbe 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ public Jsr330ScopeMetadataResolver() { * @param annotationType the JSR-330 annotation type as a Class * @param scopeName the Spring scope name */ - public final void registerScope(Class annotationType, String scopeName) { + public final void registerScope(Class annotationType, String scopeName) { this.scopeMap.put(annotationType.getName(), scopeName); } diff --git a/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java b/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java index d81821b7038c..b590da4c1856 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Scope.java b/spring-context/src/main/java/org/springframework/context/annotation/Scope.java index b62c3ca6ecc4..bcb433f5cafa 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Scope.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Scope.java @@ -29,7 +29,7 @@ * When used as a type-level annotation in conjunction with the {@link Component} * annotation, indicates the name of a scope to use for instances of the annotated * type. - * + * *

    When used as a method-level annotation in conjunction with the * {@link Bean} annotation, indicates the name of a scope to use for * the instance returned from the method. diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadata.java b/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadata.java index 07b41d1000df..2f67592b0fd9 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadata.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadata.java @@ -35,7 +35,7 @@ public class ScopeMetadata { private String scopeName = BeanDefinition.SCOPE_SINGLETON; - + private ScopedProxyMode scopedProxyMode = ScopedProxyMode.NO; diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadataResolver.java b/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadataResolver.java index e9cbcb25f7bd..54bafe39a569 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadataResolver.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ScopeMetadataResolver.java @@ -20,7 +20,7 @@ /** * Strategy interface for resolving the scope of bean definitions. - * + * * @author Mark Fisher * @since 2.5 * @see org.springframework.context.annotation.Scope @@ -40,5 +40,5 @@ public interface ScopeMetadataResolver { * @return the relevant scope metadata; never null */ ScopeMetadata resolveScopeMetadata(BeanDefinition definition); - + } diff --git a/spring-context/src/main/java/org/springframework/context/config/AbstractPropertyLoadingBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/config/AbstractPropertyLoadingBeanDefinitionParser.java index e77ac952b601..1ba65209f001 100644 --- a/spring-context/src/main/java/org/springframework/context/config/AbstractPropertyLoadingBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/config/AbstractPropertyLoadingBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/config/LoadTimeWeaverBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/config/LoadTimeWeaverBeanDefinitionParser.java index 5fb8af96b295..49555e1cdc5c 100644 --- a/spring-context/src/main/java/org/springframework/context/config/LoadTimeWeaverBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/config/LoadTimeWeaverBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/config/MBeanServerBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/config/MBeanServerBeanDefinitionParser.java index 2557ab6afbcd..d0db6c42dea5 100644 --- a/spring-context/src/main/java/org/springframework/context/config/MBeanServerBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/config/MBeanServerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/config/PropertyOverrideBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/config/PropertyOverrideBeanDefinitionParser.java index d48ad706b868..cf496b734641 100644 --- a/spring-context/src/main/java/org/springframework/context/config/PropertyOverrideBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/config/PropertyOverrideBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,10 +31,10 @@ class PropertyOverrideBeanDefinitionParser extends AbstractPropertyLoadingBeanDefinitionParser { @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return PropertyOverrideConfigurer.class; } - + @Override protected void doParse(Element element, BeanDefinitionBuilder builder) { @@ -44,4 +44,4 @@ protected void doParse(Element element, BeanDefinitionBuilder builder) { } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/context/config/PropertyPlaceholderBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/config/PropertyPlaceholderBeanDefinitionParser.java index 60d55605b383..61bfa085e322 100644 --- a/spring-context/src/main/java/org/springframework/context/config/PropertyPlaceholderBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/config/PropertyPlaceholderBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/config/SpringConfiguredBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/context/config/SpringConfiguredBeanDefinitionParser.java index 98e3c3a02505..c7198a283784 100644 --- a/spring-context/src/main/java/org/springframework/context/config/SpringConfiguredBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/context/config/SpringConfiguredBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java b/spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java index 055b5e59db84..ac9c16efa9b9 100644 --- a/spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java +++ b/spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java @@ -58,7 +58,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application private BeanFactory beanFactory; - public void addApplicationListener(ApplicationListener listener) { + public void addApplicationListener(ApplicationListener listener) { synchronized (this.defaultRetriever) { this.defaultRetriever.applicationListeners.add(listener); this.retrieverCache.clear(); @@ -72,7 +72,7 @@ public void addApplicationListenerBean(String listenerBeanName) { } } - public void removeApplicationListener(ApplicationListener listener) { + public void removeApplicationListener(ApplicationListener listener) { synchronized (this.defaultRetriever) { this.defaultRetriever.applicationListeners.remove(listener); this.retrieverCache.clear(); @@ -112,10 +112,8 @@ private BeanFactory getBeanFactory() { * @return a Collection of ApplicationListeners * @see org.springframework.context.ApplicationListener */ - protected Collection getApplicationListeners() { - synchronized (this.defaultRetriever) { - return this.defaultRetriever.getApplicationListeners(); - } + protected Collection> getApplicationListeners() { + return this.defaultRetriever.getApplicationListeners(); } /** @@ -126,9 +124,9 @@ protected Collection getApplicationListeners() { * @return a Collection of ApplicationListeners * @see org.springframework.context.ApplicationListener */ - protected Collection getApplicationListeners(ApplicationEvent event) { + protected Collection> getApplicationListeners(ApplicationEvent event) { Class eventType = event.getClass(); - Class sourceType = event.getSource().getClass(); + Class sourceType = event.getSource().getClass(); ListenerCacheKey cacheKey = new ListenerCacheKey(eventType, sourceType); ListenerRetriever retriever = this.retrieverCache.get(cacheKey); if (retriever != null) { @@ -136,28 +134,24 @@ protected Collection getApplicationListeners(ApplicationEve } else { retriever = new ListenerRetriever(true); - LinkedList allListeners = new LinkedList(); - Set listeners; - Set listenerBeans; + LinkedList> allListeners = new LinkedList>(); synchronized (this.defaultRetriever) { - listeners = new LinkedHashSet(this.defaultRetriever.applicationListeners); - listenerBeans = new LinkedHashSet(this.defaultRetriever.applicationListenerBeans); - } - for (ApplicationListener listener : listeners) { - if (supportsEvent(listener, eventType, sourceType)) { - retriever.applicationListeners.add(listener); - allListeners.add(listener); - } - } - if (!listenerBeans.isEmpty()) { - BeanFactory beanFactory = getBeanFactory(); - for (String listenerBeanName : listenerBeans) { - ApplicationListener listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class); - if (!allListeners.contains(listener) && supportsEvent(listener, eventType, sourceType)) { - retriever.applicationListenerBeans.add(listenerBeanName); + for (ApplicationListener listener : this.defaultRetriever.applicationListeners) { + if (supportsEvent(listener, eventType, sourceType)) { + retriever.applicationListeners.add(listener); allListeners.add(listener); } } + if (!this.defaultRetriever.applicationListenerBeans.isEmpty()) { + BeanFactory beanFactory = getBeanFactory(); + for (String listenerBeanName : this.defaultRetriever.applicationListenerBeans) { + ApplicationListener listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class); + if (!allListeners.contains(listener) && supportsEvent(listener, eventType, sourceType)) { + retriever.applicationListenerBeans.add(listenerBeanName); + allListeners.add(listener); + } + } + } } OrderComparator.sort(allListeners); this.retrieverCache.put(cacheKey, retriever); @@ -178,7 +172,7 @@ protected Collection getApplicationListeners(ApplicationEve * candidates for the given event type */ protected boolean supportsEvent( - ApplicationListener listener, Class eventType, Class sourceType) { + ApplicationListener listener, Class eventType, Class sourceType) { SmartApplicationListener smartListener = (listener instanceof SmartApplicationListener ? (SmartApplicationListener) listener : new GenericApplicationListenerAdapter(listener)); @@ -191,11 +185,11 @@ protected boolean supportsEvent( */ private static class ListenerCacheKey { - private final Class eventType; + private final Class eventType; - private final Class sourceType; + private final Class sourceType; - public ListenerCacheKey(Class eventType, Class sourceType) { + public ListenerCacheKey(Class eventType, Class sourceType) { this.eventType = eventType; this.sourceType = sourceType; } @@ -223,27 +217,27 @@ public int hashCode() { */ private class ListenerRetriever { - public final Set applicationListeners; + public final Set> applicationListeners; public final Set applicationListenerBeans; private final boolean preFiltered; public ListenerRetriever(boolean preFiltered) { - this.applicationListeners = new LinkedHashSet(); + this.applicationListeners = new LinkedHashSet>(); this.applicationListenerBeans = new LinkedHashSet(); this.preFiltered = preFiltered; } - public Collection getApplicationListeners() { - LinkedList allListeners = new LinkedList(); - for (ApplicationListener listener : this.applicationListeners) { + public Collection> getApplicationListeners() { + LinkedList> allListeners = new LinkedList>(); + for (ApplicationListener listener : this.applicationListeners) { allListeners.add(listener); } if (!this.applicationListenerBeans.isEmpty()) { BeanFactory beanFactory = getBeanFactory(); for (String listenerBeanName : this.applicationListenerBeans) { - ApplicationListener listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class); + ApplicationListener listener = beanFactory.getBean(listenerBeanName, ApplicationListener.class); if (this.preFiltered || !allListeners.contains(listener)) { allListeners.add(listener); } diff --git a/spring-context/src/main/java/org/springframework/context/event/ApplicationEventMulticaster.java b/spring-context/src/main/java/org/springframework/context/event/ApplicationEventMulticaster.java index 6a2f2cd7457c..8fa60889df41 100644 --- a/spring-context/src/main/java/org/springframework/context/event/ApplicationEventMulticaster.java +++ b/spring-context/src/main/java/org/springframework/context/event/ApplicationEventMulticaster.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public interface ApplicationEventMulticaster { * Add a listener to be notified of all events. * @param listener the listener to add */ - void addApplicationListener(ApplicationListener listener); + void addApplicationListener(ApplicationListener listener); /** * Add a listener bean to be notified of all events. @@ -48,7 +48,7 @@ public interface ApplicationEventMulticaster { * Remove a listener from the notification list. * @param listener the listener to remove */ - void removeApplicationListener(ApplicationListener listener); + void removeApplicationListener(ApplicationListener listener); /** * Remove a listener bean from the notification list. diff --git a/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java b/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java index 98d08dbcf3d6..16cb6a396a1c 100644 --- a/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java +++ b/spring-context/src/main/java/org/springframework/context/event/EventPublicationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public class EventPublicationInterceptor implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean { - private Constructor applicationEventClassConstructor; + private Constructor applicationEventClassConstructor; private ApplicationEventPublisher applicationEventPublisher; @@ -62,7 +62,7 @@ public class EventPublicationInterceptor * null or if it is not an ApplicationEvent subclass or * if it does not expose a constructor that takes a single Object argument */ - public void setApplicationEventClass(Class applicationEventClass) { + public void setApplicationEventClass(Class applicationEventClass) { if (ApplicationEvent.class.equals(applicationEventClass) || !ApplicationEvent.class.isAssignableFrom(applicationEventClass)) { throw new IllegalArgumentException("applicationEventClass needs to extend ApplicationEvent"); diff --git a/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java b/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java index 5866212e871b..c0f0af9b1065 100644 --- a/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java +++ b/spring-context/src/main/java/org/springframework/context/event/GenericApplicationListenerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,28 +33,27 @@ */ public class GenericApplicationListenerAdapter implements SmartApplicationListener { - private final ApplicationListener delegate; + private final ApplicationListener delegate; /** * Create a new GenericApplicationListener for the given delegate. * @param delegate the delegate listener to be invoked */ - public GenericApplicationListenerAdapter(ApplicationListener delegate) { + public GenericApplicationListenerAdapter(ApplicationListener delegate) { Assert.notNull(delegate, "Delegate listener must not be null"); this.delegate = delegate; } - @SuppressWarnings("unchecked") public void onApplicationEvent(ApplicationEvent event) { - this.delegate.onApplicationEvent(event); + ((ApplicationListener)this.delegate).onApplicationEvent(event); } public boolean supportsEventType(Class eventType) { - Class typeArg = GenericTypeResolver.resolveTypeArgument(this.delegate.getClass(), ApplicationListener.class); + Class typeArg = GenericTypeResolver.resolveTypeArgument(this.delegate.getClass(), ApplicationListener.class); if (typeArg == null || typeArg.equals(ApplicationEvent.class)) { - Class targetClass = AopUtils.getTargetClass(this.delegate); + Class targetClass = AopUtils.getTargetClass(this.delegate); if (targetClass != this.delegate.getClass()) { typeArg = GenericTypeResolver.resolveTypeArgument(targetClass, ApplicationListener.class); } diff --git a/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java b/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java index d84d0d17b061..cf674e0acfd9 100644 --- a/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java +++ b/spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,13 +81,12 @@ protected Executor getTaskExecutor() { } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void multicastEvent(final ApplicationEvent event) { for (final ApplicationListener listener : getApplicationListeners(event)) { Executor executor = getTaskExecutor(); if (executor != null) { executor.execute(new Runnable() { - @SuppressWarnings("unchecked") public void run() { listener.onApplicationEvent(event); } diff --git a/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java b/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java index a9326c5b168a..12306007a67c 100644 --- a/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java +++ b/spring-context/src/main/java/org/springframework/context/event/SourceFilteringListener.java @@ -45,7 +45,7 @@ public class SourceFilteringListener implements SmartApplicationListener { * @param delegate the delegate listener to invoke with event * from the specified source */ - public SourceFilteringListener(Object source, ApplicationListener delegate) { + public SourceFilteringListener(Object source, ApplicationListener delegate) { this.source = source; this.delegate = (delegate instanceof SmartApplicationListener ? (SmartApplicationListener) delegate : new GenericApplicationListenerAdapter(delegate)); diff --git a/spring-context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java b/spring-context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java index e81c929e8113..2d9d1e340f2a 100644 --- a/spring-context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java +++ b/spring-context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public void write(EvaluationContext context, Object target, String name, Object throw new AccessException("Beans in a BeanFactory are read-only"); } - public Class[] getSpecificTargetClasses() { + public Class[] getSpecificTargetClasses() { return new Class[] {BeanExpressionContext.class}; } diff --git a/spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java b/spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java index 486ded925fde..961b4f515396 100644 --- a/spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java +++ b/spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public void write(EvaluationContext context, Object target, String name, Object throw new AccessException("Beans in a BeanFactory are read-only"); } - public Class[] getSpecificTargetClasses() { + public Class[] getSpecificTargetClasses() { return new Class[] {BeanFactory.class}; } diff --git a/spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java b/spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java index 53ed9ce91148..ac7f68f87796 100644 --- a/spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java +++ b/spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,12 +34,11 @@ public class MapAccessor implements PropertyAccessor { public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { - Map map = (Map) target; - return map.containsKey(name); + return asMap(target).containsKey(name); } public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { - Map map = (Map) target; + Map map = asMap(target); Object value = map.get(name); if (value == null && !map.containsKey(name)) { throw new MapAccessException(name); @@ -51,16 +50,19 @@ public boolean canWrite(EvaluationContext context, Object target, String name) t return true; } - @SuppressWarnings("unchecked") public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { - Map map = (Map) target; + Map map = asMap(target); map.put(name, newValue); } - public Class[] getSpecificTargetClasses() { + public Class[] getSpecificTargetClasses() { return new Class[] {Map.class}; } + @SuppressWarnings("unchecked") + private Map asMap(Object target) { + return (Map) target; + } /** * Exception thrown from read in order to reset a cached diff --git a/spring-context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java b/spring-context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java index 8537e050876f..fff09d2da441 100644 --- a/spring-context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java +++ b/spring-context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java @@ -38,7 +38,7 @@ * Standard implementation of the * {@link org.springframework.beans.factory.config.BeanExpressionResolver} * interface, parsing and evaluating Spring EL using Spring's expression module. - * + * * @author Juergen Hoeller * @since 3.0 * @see org.springframework.expression.ExpressionParser diff --git a/spring-context/src/main/java/org/springframework/context/package-info.java b/spring-context/src/main/java/org/springframework/context/package-info.java index c7ae35d00ee3..3a09bc5a584a 100644 --- a/spring-context/src/main/java/org/springframework/context/package-info.java +++ b/spring-context/src/main/java/org/springframework/context/package-info.java @@ -5,7 +5,7 @@ * message sources and for the Observer design pattern, and the * ability for application objects to obtain resources using a * consistent API. - * + * *

    There is no necessity for Spring applications to depend * on ApplicationContext or even BeanFactory functionality * explicitly. One of the strengths of the Spring architecture diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index b1e7726ed6f5..120ee4215415 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java @@ -1257,7 +1257,7 @@ private MessageSource getMessageSource() throws IllegalStateException { */ protected MessageSource getInternalParentMessageSource() { return (getParent() instanceof AbstractApplicationContext) ? - ((AbstractApplicationContext) getParent()).messageSource : getParent(); + ((AbstractApplicationContext) getParent()).messageSource : getParent(); } diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableApplicationContext.java index 9cbfcdddb0d3..44ba2589d8df 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextException; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; /** * Base class for {@link org.springframework.context.ApplicationContext} diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java index 77155fb220aa..7b59553321b1 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java b/spring-context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java index 83b7aec72538..a2ce34e6ad6a 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java @@ -91,10 +91,10 @@ public Object run() { else { invokeAwareInterfaces(bean); } - + return bean; } - + private void invokeAwareInterfaces(Object bean) { if (bean instanceof Aware) { if (bean instanceof EnvironmentAware) { diff --git a/spring-context/src/main/java/org/springframework/context/support/ApplicationObjectSupport.java b/spring-context/src/main/java/org/springframework/context/support/ApplicationObjectSupport.java index 0a0acb70f7b0..b0c6c1d50488 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ApplicationObjectSupport.java +++ b/spring-context/src/main/java/org/springframework/context/support/ApplicationObjectSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,10 +45,10 @@ * @see org.springframework.web.context.support.WebApplicationObjectSupport */ public abstract class ApplicationObjectSupport implements ApplicationContextAware { - + /** Logger that is available to subclasses */ protected final Log logger = LogFactory.getLog(getClass()); - + /** ApplicationContext this object runs in */ private ApplicationContext applicationContext; @@ -99,7 +99,7 @@ protected boolean isContextRequired() { * Can be overridden in subclasses. * @see #setApplicationContext */ - protected Class requiredContextClass() { + protected Class requiredContextClass() { return ApplicationContext.class; } diff --git a/spring-context/src/main/java/org/springframework/context/support/ClassPathXmlApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/ClassPathXmlApplicationContext.java index 670461fc5490..742fa1cbd026 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ClassPathXmlApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/ClassPathXmlApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,7 +154,7 @@ public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, * @see org.springframework.context.support.GenericApplicationContext * @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader */ - public ClassPathXmlApplicationContext(String path, Class clazz) throws BeansException { + public ClassPathXmlApplicationContext(String path, Class clazz) throws BeansException { this(new String[] {path}, clazz); } @@ -168,7 +168,7 @@ public ClassPathXmlApplicationContext(String path, Class clazz) throws BeansExce * @see org.springframework.context.support.GenericApplicationContext * @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader */ - public ClassPathXmlApplicationContext(String[] paths, Class clazz) throws BeansException { + public ClassPathXmlApplicationContext(String[] paths, Class clazz) throws BeansException { this(paths, clazz, null); } @@ -184,7 +184,7 @@ public ClassPathXmlApplicationContext(String[] paths, Class clazz) throws BeansE * @see org.springframework.context.support.GenericApplicationContext * @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader */ - public ClassPathXmlApplicationContext(String[] paths, Class clazz, ApplicationContext parent) + public ClassPathXmlApplicationContext(String[] paths, Class clazz, ApplicationContext parent) throws BeansException { super(parent); diff --git a/spring-context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java b/spring-context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java index 9570bcb0d5f6..580cc507b56c 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java +++ b/spring-context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,11 +59,11 @@ public ContextTypeMatchClassLoader(ClassLoader parent) { } @Override - public Class loadClass(String name) throws ClassNotFoundException { + public Class loadClass(String name) throws ClassNotFoundException { return new ContextOverridingClassLoader(getParent()).loadClass(name); } - public boolean isClassReloadable(Class clazz) { + public boolean isClassReloadable(Class clazz) { return (clazz.getClassLoader() instanceof ContextOverridingClassLoader); } @@ -95,7 +95,7 @@ protected boolean isEligibleForOverriding(String className) { } @Override - protected Class loadClassForOverriding(String name) throws ClassNotFoundException { + protected Class loadClassForOverriding(String name) throws ClassNotFoundException { byte[] bytes = bytesCache.get(name); if (bytes == null) { bytes = loadBytesForClass(name); diff --git a/spring-context/src/main/java/org/springframework/context/support/ConversionServiceFactoryBean.java b/spring-context/src/main/java/org/springframework/context/support/ConversionServiceFactoryBean.java index a4fb136b2b11..32bb029c0a6b 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ConversionServiceFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/context/support/ConversionServiceFactoryBean.java @@ -81,7 +81,7 @@ protected GenericConversionService createConversionService() { // implementing FactoryBean - + public ConversionService getObject() { return this.conversionService; } diff --git a/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java b/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java index 025f4cfb96ca..5d50a0e1c979 100644 --- a/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java index 8a5da83ddc48..4660402ac996 100644 --- a/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.support.ResourcePatternResolver; diff --git a/spring-context/src/main/java/org/springframework/context/support/MessageSourceAccessor.java b/spring-context/src/main/java/org/springframework/context/support/MessageSourceAccessor.java index 2d9773509139..34cb5e51db2b 100644 --- a/spring-context/src/main/java/org/springframework/context/support/MessageSourceAccessor.java +++ b/spring-context/src/main/java/org/springframework/context/support/MessageSourceAccessor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java b/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java index 44d284c9a55f..a014a70014c3 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java +++ b/spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java @@ -329,9 +329,9 @@ protected PropertiesHolder getMergedProperties(Locale locale) { Properties mergedProps = new Properties(); mergedHolder = new PropertiesHolder(mergedProps, -1); for (int i = this.basenames.length - 1; i >= 0; i--) { - List filenames = calculateAllFilenames(this.basenames[i], locale); + List filenames = calculateAllFilenames(this.basenames[i], locale); for (int j = filenames.size() - 1; j >= 0; j--) { - String filename = (String) filenames.get(j); + String filename = filenames.get(j); PropertiesHolder propHolder = getProperties(filename); if (propHolder.getProperties() != null) { mergedProps.putAll(propHolder.getProperties()); diff --git a/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java b/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java index bf9981255396..f052b7b444df 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java +++ b/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java @@ -135,7 +135,7 @@ public void setBasename(String basename) { * @see #setBasename * @see java.util.ResourceBundle#getBundle(String) */ - public void setBasenames(String... basenames) { + public void setBasenames(String... basenames) { if (basenames != null) { this.basenames = new String[basenames.length]; for (int i = 0; i < basenames.length; i++) { diff --git a/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java b/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java index c30f65e58c2d..03c29586ddb4 100644 --- a/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java +++ b/spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ protected Map initialValue() { } }; - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { Map scope = threadScope.get(); Object object = scope.get(name); if (object == null) { diff --git a/spring-context/src/main/java/org/springframework/context/support/StaticApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/StaticApplicationContext.java index c03f3446dc7b..fbcd4453ed5c 100644 --- a/spring-context/src/main/java/org/springframework/context/support/StaticApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/StaticApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public final StaticMessageSource getStaticMessageSource() { *

    For more advanced needs, register with the underlying BeanFactory directly. * @see #getDefaultListableBeanFactory */ - public void registerSingleton(String name, Class clazz) throws BeansException { + public void registerSingleton(String name, Class clazz) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setBeanClass(clazz); getDefaultListableBeanFactory().registerBeanDefinition(name, bd); @@ -94,7 +94,7 @@ public void registerSingleton(String name, Class clazz) throws BeansException { *

    For more advanced needs, register with the underlying BeanFactory directly. * @see #getDefaultListableBeanFactory */ - public void registerSingleton(String name, Class clazz, MutablePropertyValues pvs) throws BeansException { + public void registerSingleton(String name, Class clazz, MutablePropertyValues pvs) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setBeanClass(clazz); bd.setPropertyValues(pvs); @@ -106,7 +106,7 @@ public void registerSingleton(String name, Class clazz, MutablePropertyValues pv *

    For more advanced needs, register with the underlying BeanFactory directly. * @see #getDefaultListableBeanFactory */ - public void registerPrototype(String name, Class clazz) throws BeansException { + public void registerPrototype(String name, Class clazz) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE); bd.setBeanClass(clazz); @@ -118,7 +118,7 @@ public void registerPrototype(String name, Class clazz) throws BeansException { *

    For more advanced needs, register with the underlying BeanFactory directly. * @see #getDefaultListableBeanFactory */ - public void registerPrototype(String name, Class clazz, MutablePropertyValues pvs) throws BeansException { + public void registerPrototype(String name, Class clazz, MutablePropertyValues pvs) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE); bd.setBeanClass(clazz); diff --git a/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java index 0630d290c63e..dad03a4b94d9 100644 --- a/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java b/spring-context/src/main/java/org/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java index fd088c88ffad..b7f088c5425c 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +42,8 @@ * @author Juergen Hoeller */ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor { - - private Class homeInterface; + + private Class homeInterface; private boolean refreshHomeOnConnectFailure = false; @@ -60,7 +60,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI * sufficient to make a WebSphere 5.0 Remote SLSB work. On other servers, * the specific home interface for the target SLSB might be necessary. */ - public void setHomeInterface(Class homeInterface) { + public void setHomeInterface(Class homeInterface) { if (homeInterface != null && !homeInterface.isInterface()) { throw new IllegalArgumentException( "Home interface class [" + homeInterface.getClass() + "] is not an interface"); diff --git a/spring-context/src/main/java/org/springframework/ejb/access/AbstractSlsbInvokerInterceptor.java b/spring-context/src/main/java/org/springframework/ejb/access/AbstractSlsbInvokerInterceptor.java index fb51f516344b..3c19b6a45a63 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/AbstractSlsbInvokerInterceptor.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/AbstractSlsbInvokerInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptor.java b/spring-context/src/main/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptor.java index 8ce1aa9928c0..7a27feafa29a 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptor.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ * bound at the target location yet. The best solution is to set the lookupHomeOnStartup * property to false, in which case the home will be fetched on first access to the EJB. * (This flag is only true by default for backwards compatibility reasons). - * + * * @author Rod Johnson * @author Juergen Hoeller * @see AbstractSlsbInvokerInterceptor#setLookupHomeOnStartup @@ -93,7 +93,7 @@ public Object invokeInContext(MethodInvocation invocation) throws Throwable { } catch (IllegalAccessException ex) { throw new EjbAccessException("Could not access method [" + invocation.getMethod().getName() + - "] of local EJB [" + getJndiName() + "]", ex); + "] of local EJB [" + getJndiName() + "]", ex); } finally { if (ejb instanceof EJBLocalObject) { diff --git a/spring-context/src/main/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBean.java b/spring-context/src/main/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBean.java index 2eeef7627a3c..4040c7d85cc7 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ * *

    See {@link org.springframework.jndi.JndiObjectLocator} for info on * how to specify the JNDI location of the target EJB. - * + * *

    If you want control over interceptor chaining, use an AOP ProxyFactoryBean * with LocalSlsbInvokerInterceptor rather than rely on this class. * @@ -41,7 +41,7 @@ * bound at the target location yet. The best solution is to set the "lookupHomeOnStartup" * property to "false", in which case the home will be fetched on first access to the EJB. * (This flag is only true by default for backwards compatibility reasons). - * + * * @author Rod Johnson * @author Colin Sampaleanu * @since 09.05.2003 @@ -52,7 +52,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter implements FactoryBean, BeanClassLoaderAware { /** The business interface of the EJB we're proxying */ - private Class businessInterface; + private Class businessInterface; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -66,14 +66,14 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter * Using a business methods interface is a best practice when implementing EJBs. * @param businessInterface set the business interface of the EJB */ - public void setBusinessInterface(Class businessInterface) { + public void setBusinessInterface(Class businessInterface) { this.businessInterface = businessInterface; } /** * Return the business interface of the EJB we're proxying. */ - public Class getBusinessInterface() { + public Class getBusinessInterface() { return this.businessInterface; } diff --git a/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java b/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java index c133a61f65bb..29de41bc3edf 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,11 +106,11 @@ protected Object doInvoke(MethodInvocation invocation) throws Throwable { if (targetEx instanceof RemoteException) { RemoteException rex = (RemoteException) targetEx; throw RmiClientInterceptorUtils.convertRmiAccessException( - invocation.getMethod(), rex, isConnectFailure(rex), getJndiName()); + invocation.getMethod(), rex, isConnectFailure(rex), getJndiName()); } else if (targetEx instanceof CreateException) { throw RmiClientInterceptorUtils.convertRmiAccessException( - invocation.getMethod(), targetEx, "Could not create remote EJB [" + getJndiName() + "]"); + invocation.getMethod(), targetEx, "Could not create remote EJB [" + getJndiName() + "]"); } throw targetEx; } diff --git a/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBean.java b/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBean.java index 84e9eb6b3e23..063ce58df77b 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ * *

    See {@link org.springframework.jndi.JndiObjectLocator} for info on * how to specify the JNDI location of the target EJB. - * + * *

    If you want control over interceptor chaining, use an AOP ProxyFactoryBean * with SimpleRemoteSlsbInvokerInterceptor rather than rely on this class. * @@ -41,7 +41,7 @@ * bound at the target location yet. The best solution is to set the lookupHomeOnStartup * property to false, in which case the home will be fetched on first access to the EJB. * (This flag is only true by default for backwards compatibility reasons). - * + * *

    This proxy factory is typically used with an RMI business interface, which serves * as super-interface of the EJB component interface. Alternatively, this factory * can also proxy a remote SLSB with a matching non-RMI business interface, i.e. an @@ -62,7 +62,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl implements FactoryBean, BeanClassLoaderAware { /** The business interface of the EJB we're proxying */ - private Class businessInterface; + private Class businessInterface; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -80,14 +80,14 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl * converted to Spring's generic RemoteAccessException. * @param businessInterface the business interface of the EJB */ - public void setBusinessInterface(Class businessInterface) { + public void setBusinessInterface(Class businessInterface) { this.businessInterface = businessInterface; } /** * Return the business interface of the EJB we're proxying. */ - public Class getBusinessInterface() { + public Class getBusinessInterface() { return this.businessInterface; } diff --git a/spring-context/src/main/java/org/springframework/ejb/access/package-info.java b/spring-context/src/main/java/org/springframework/ejb/access/package-info.java index 608bd665ae4c..9615bb81469f 100644 --- a/spring-context/src/main/java/org/springframework/ejb/access/package-info.java +++ b/spring-context/src/main/java/org/springframework/ejb/access/package-info.java @@ -12,11 +12,11 @@ * or may not be EJBs). This gives us the choice of introducing EJB * into an application (or removing EJB from an application) without * affecting code using business objects. - * + * *

    The motivation for the classes in this package are discussed in Chapter 11 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). - * + * *

    However, the implementation and naming of classes in this package has changed. * It now uses FactoryBeans and AOP, rather than the custom bean definitions described in * Expert One-on-One J2EE. diff --git a/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java index f3b7aff7579c..065c15b5fab7 100644 --- a/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/ejb/config/AbstractJndiLocatingBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ejb/config/JndiLookupBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/ejb/config/JndiLookupBeanDefinitionParser.java index 266c9ebe5ba3..a34b6757bc87 100644 --- a/spring-context/src/main/java/org/springframework/ejb/config/JndiLookupBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/ejb/config/JndiLookupBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ class JndiLookupBeanDefinitionParser extends AbstractJndiLocatingBeanDefinitionP @Override - protected Class getBeanClass(Element element) { + protected Class getBeanClass(Element element) { return JndiObjectFactoryBean.class; } diff --git a/spring-context/src/main/java/org/springframework/ejb/config/LocalStatelessSessionBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/ejb/config/LocalStatelessSessionBeanDefinitionParser.java index 0a6f8bad148c..978c9e27dabd 100644 --- a/spring-context/src/main/java/org/springframework/ejb/config/LocalStatelessSessionBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/ejb/config/LocalStatelessSessionBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ejb/config/RemoteStatelessSessionBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/ejb/config/RemoteStatelessSessionBeanDefinitionParser.java index 954dc100d3ea..0ab599dc71e2 100644 --- a/spring-context/src/main/java/org/springframework/ejb/config/RemoteStatelessSessionBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/ejb/config/RemoteStatelessSessionBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.java b/spring-context/src/main/java/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.java index 251e688b840a..3c9b55de6caf 100644 --- a/spring-context/src/main/java/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.java +++ b/spring-context/src/main/java/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ejb/support/AbstractJmsMessageDrivenBean.java b/spring-context/src/main/java/org/springframework/ejb/support/AbstractJmsMessageDrivenBean.java index 4d2b613d39fe..cb9db418a524 100644 --- a/spring-context/src/main/java/org/springframework/ejb/support/AbstractJmsMessageDrivenBean.java +++ b/spring-context/src/main/java/org/springframework/ejb/support/AbstractJmsMessageDrivenBean.java @@ -18,7 +18,7 @@ import javax.jms.MessageListener; -/** +/** * Convenient base class for JMS-based EJB 2.x MDBs. Requires subclasses * to implement the JMS javax.jms.MessageListener interface. * @@ -31,4 +31,4 @@ public abstract class AbstractJmsMessageDrivenBean extends AbstractMessageDriven // Empty: The purpose of this class is to ensure // that subclasses implement javax.jms.MessageListener. -} +} diff --git a/spring-context/src/main/java/org/springframework/ejb/support/AbstractMessageDrivenBean.java b/spring-context/src/main/java/org/springframework/ejb/support/AbstractMessageDrivenBean.java index 3b5167adc38c..8d661b480c60 100644 --- a/spring-context/src/main/java/org/springframework/ejb/support/AbstractMessageDrivenBean.java +++ b/spring-context/src/main/java/org/springframework/ejb/support/AbstractMessageDrivenBean.java @@ -22,7 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -/** +/** * Convenient base class for EJB 2.x MDBs. * Doesn't require JMS, as EJB 2.1 MDBs are no longer JMS-specific; * see the {@link AbstractJmsMessageDrivenBean} subclass. diff --git a/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatefulSessionBean.java b/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatefulSessionBean.java index a5a009d57ffc..b36b8fcb4cba 100644 --- a/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatefulSessionBean.java +++ b/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatefulSessionBean.java @@ -29,7 +29,7 @@ * method in their custom ejbCreate() and ejbActivate() * methods, and should invoke the unloadBeanFactory() method in * their ejbPassivate method. - * + * *

    Note: The default BeanFactoryLocator used by this class's superclass * (ContextJndiBeanFactoryLocator) is not serializable. Therefore, * when using the default BeanFactoryLocator, or another variant which is diff --git a/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatelessSessionBean.java b/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatelessSessionBean.java index da11f8e521dc..83f5877291ca 100644 --- a/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatelessSessionBean.java +++ b/spring-context/src/main/java/org/springframework/ejb/support/AbstractStatelessSessionBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,16 +81,16 @@ public void ejbCreate() throws CreateException { /** - * @see javax.ejb.SessionBean#ejbActivate(). This method always throws an exception, as - * it should not be invoked by the EJB container. + * This method always throws an exception, as it should not be invoked by the EJB container. + * @see javax.ejb.SessionBean#ejbActivate() */ public void ejbActivate() throws EJBException { throw new IllegalStateException("ejbActivate must not be invoked on a stateless session bean"); } /** - * @see javax.ejb.SessionBean#ejbPassivate(). This method always throws an exception, as - * it should not be invoked by the EJB container. + * This method always throws an exception, as it should not be invoked by the EJB container. + * @see javax.ejb.SessionBean#ejbPassivate() */ public void ejbPassivate() throws EJBException { throw new IllegalStateException("ejbPassivate must not be invoked on a stateless session bean"); diff --git a/spring-context/src/main/java/org/springframework/ejb/support/package-info.java b/spring-context/src/main/java/org/springframework/ejb/support/package-info.java index 02433e4439ec..6682ae66d34c 100644 --- a/spring-context/src/main/java/org/springframework/ejb/support/package-info.java +++ b/spring-context/src/main/java/org/springframework/ejb/support/package-info.java @@ -6,17 +6,17 @@ * This promotes good EJB practice, with EJB services used for transaction * management, thread management, and (possibly) remoting, while * business logic is implemented in easily testable POJOs.

    - * + * *

    In this model, the EJB is a facade, with as many POJO helpers * behind the BeanFactory as required.

    - * - *

    Note that the default behavior is to look for an EJB environment variable + * + *

    Note that the default behavior is to look for an EJB enviroment variable * with name ejb/BeanFactoryPath that specifies the * location on the classpath of an XML bean factory definition * file (such as /com/mycom/mypackage/mybeans.xml). * If this JNDI key is missing, your EJB subclass won't successfully * initialize in the container.

    - * + * *

    Check out the org.springframework.ejb.interceptor * package for equivalent support for the EJB 3 component model, * providing annotation-based autowiring using an EJB 3 interceptor.

    diff --git a/spring-context/src/main/java/org/springframework/format/AnnotationFormatterFactory.java b/spring-context/src/main/java/org/springframework/format/AnnotationFormatterFactory.java index 2a267d1e5ab1..454649b2a46e 100644 --- a/spring-context/src/main/java/org/springframework/format/AnnotationFormatterFactory.java +++ b/spring-context/src/main/java/org/springframework/format/AnnotationFormatterFactory.java @@ -25,7 +25,7 @@ * that formats Date values set on fields annotated with @DateTimeFormat. * * @author Keith Donald - * @since 3.0 + * @since 3.0 * @param the annotation type that should trigger formatting */ public interface AnnotationFormatterFactory { @@ -52,5 +52,5 @@ public interface AnnotationFormatterFactory { * @return the parser */ Parser getParser(A annotation, Class fieldType); - + } diff --git a/spring-context/src/main/java/org/springframework/format/Formatter.java b/spring-context/src/main/java/org/springframework/format/Formatter.java index 67723c89dd58..83d26b13a75d 100644 --- a/spring-context/src/main/java/org/springframework/format/Formatter.java +++ b/spring-context/src/main/java/org/springframework/format/Formatter.java @@ -21,7 +21,7 @@ * A Formatter is both a Printer and a Parser for an object type. * * @author Keith Donald - * @since 3.0 + * @since 3.0 * @param the type of object this Formatter formats */ public interface Formatter extends Printer, Parser { diff --git a/spring-context/src/main/java/org/springframework/format/FormatterRegistrar.java b/spring-context/src/main/java/org/springframework/format/FormatterRegistrar.java index 16b2208b1aec..b754a738d10e 100644 --- a/spring-context/src/main/java/org/springframework/format/FormatterRegistrar.java +++ b/spring-context/src/main/java/org/springframework/format/FormatterRegistrar.java @@ -20,14 +20,14 @@ /** * Registers {@link Converter Converters} and {@link Formatter Formatters} with * a FormattingConversionService through the {@link FormatterRegistry} SPI. - * + * * @author Keith Donald * @since 3.1 */ public interface FormatterRegistrar { /** - * Register Formatters and Converters with a FormattingConversionService + * Register Formatters and Converters with a FormattingConversionService * through a FormatterRegistry SPI. * @param registry the FormatterRegistry instance to use. */ diff --git a/spring-context/src/main/java/org/springframework/format/Parser.java b/spring-context/src/main/java/org/springframework/format/Parser.java index 63e71ba77e19..276a509305a1 100644 --- a/spring-context/src/main/java/org/springframework/format/Parser.java +++ b/spring-context/src/main/java/org/springframework/format/Parser.java @@ -23,7 +23,7 @@ * Parses text strings to produce instances of T. * * @author Keith Donald - * @since 3.0 + * @since 3.0 * @param the type of object this Parser produces */ public interface Parser { diff --git a/spring-context/src/main/java/org/springframework/format/Printer.java b/spring-context/src/main/java/org/springframework/format/Printer.java index 00b8c6ec7000..c85283985844 100644 --- a/spring-context/src/main/java/org/springframework/format/Printer.java +++ b/spring-context/src/main/java/org/springframework/format/Printer.java @@ -22,7 +22,7 @@ * Prints objects of type T for display. * * @author Keith Donald - * @since 3.0 + * @since 3.0 * @param the type of object this Printer prints */ public interface Printer { diff --git a/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java b/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java index c5e526e8e070..6be31567d6ac 100644 --- a/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java +++ b/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java @@ -83,12 +83,12 @@ public enum ISO { DATE, /** - * The most common ISO Time Format HH:mm:ss.SSSZ e.g. 01:30:00.000-05:00. + * The most common ISO Time Format hh:mm:ss.SSSZ e.g. 01:30:00.000-05:00. */ TIME, /** - * The most common ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSZ e.g. 2000-10-31 01:30:00.000-05:00. + * The most common ISO DateTime Format yyyy-MM-dd'T'hh:mm:ss.SSSZ e.g. 2000-10-31 01:30:00.000-05:00. * The default if no annotation value is specified. */ DATE_TIME, diff --git a/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java b/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java index 21881a2bbb86..60761a254e0b 100644 --- a/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java +++ b/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java @@ -26,13 +26,13 @@ * Supports formatting by style or custom pattern string. * Can be applied to any JDK java.lang.Number type. *

    - * For style-based formatting, set the {@link #style()} attribute to be the desired {@link Style}. + * For style-based formatting, set the {@link #style()} attribute to be the desired {@link Style}. * For custom formatting, set the {@link #pattern()} attribute to be the number pattern, such as #,###.##. *

    * Each attribute is mutually exclusive, so only set one attribute per annotation instance (the one most convenient one for your formatting needs). * When the pattern attribute is specified, it takes precedence over the style attribute. * When no annotation attributes are specified, the default format applied is style-based with a style of {@link Style#NUMBER}. - * + * * @author Keith Donald * @since 3.0 * @see java.text.NumberFormat @@ -67,7 +67,7 @@ public enum Style { * The general-purpose number format for the current locale. */ NUMBER, - + /** * The currency format for the current locale. */ diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/DateTimeParser.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/DateTimeParser.java index 48f8d46c4297..92285dffb4cb 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/DateTimeParser.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/DateTimeParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java index 2c5638c26fac..920a6f986d21 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaDateTimeFormatAnnotationFormatterFactory.java @@ -71,6 +71,7 @@ public class JodaDateTimeFormatAnnotationFormatterFactory private StringValueResolver embeddedValueResolver; + public final Set> getFieldTypes() { return FIELD_TYPES; } @@ -84,7 +85,7 @@ protected String resolveEmbeddedValue(String value) { } public Printer getPrinter(DateTimeFormat annotation, Class fieldType) { - DateTimeFormatter formatter = getFormatter(annotation, fieldType); + DateTimeFormatter formatter = configureDateTimeFormatterFrom(annotation); if (ReadableInstant.class.isAssignableFrom(fieldType)) { return new ReadableInstantPrinter(formatter); } @@ -95,27 +96,66 @@ public Printer getPrinter(DateTimeFormat annotation, Class fieldType) { // assumes Calendar->ReadableInstant converter is registered return new ReadableInstantPrinter(formatter); } - // assumes Date->Long converter is registered - return new MillisecondInstantPrinter(formatter); + else { + // assumes Date->Long converter is registered + return new MillisecondInstantPrinter(formatter); + } } public Parser getParser(DateTimeFormat annotation, Class fieldType) { - return new DateTimeParser(getFormatter(annotation, fieldType)); + return new DateTimeParser(configureDateTimeFormatterFrom(annotation)); } + // internal helpers + /** - * Factory method used to create a {@link DateTimeFormatter}. - * @param annotation the format annotation for the field - * @param fieldType the type of field - * @return a {@link DateTimeFormatter} instance - * @since 3.2 + * Create the set of field types that may be annotated with @DateTimeFormat. + * Note: the 3 ReadablePartial concrete types are registered explicitly since addFormatterForFieldType rules exist for each of these types + * (if we did not do this, the default byType rules for LocalDate, LocalTime, and LocalDateTime would take precedence over the annotation rule, which is not what we want) + * @see JodaTimeFormatterRegistrar#registerFormatters(org.springframework.format.FormatterRegistry) */ - protected DateTimeFormatter getFormatter(DateTimeFormat annotation, Class fieldType) { - DateTimeFormatterFactory factory = new DateTimeFormatterFactory(); - factory.setStyle(resolveEmbeddedValue(annotation.style())); - factory.setIso(annotation.iso()); - factory.setPattern(resolveEmbeddedValue(annotation.pattern())); - return factory.createDateTimeFormatter(); + private Set> createFieldTypes() { + Set> rawFieldTypes = new HashSet>(7); + rawFieldTypes.add(ReadableInstant.class); + rawFieldTypes.add(LocalDate.class); + rawFieldTypes.add(LocalTime.class); + rawFieldTypes.add(LocalDateTime.class); + rawFieldTypes.add(Date.class); + rawFieldTypes.add(Calendar.class); + rawFieldTypes.add(Long.class); + return Collections.unmodifiableSet(rawFieldTypes); + } + + private DateTimeFormatter configureDateTimeFormatterFrom(DateTimeFormat annotation) { + if (StringUtils.hasLength(annotation.pattern())) { + return forPattern(resolveEmbeddedValue(annotation.pattern())); + } + else if (annotation.iso() != ISO.NONE) { + return forIso(annotation.iso()); + } + else { + return forStyle(resolveEmbeddedValue(annotation.style())); + } + } + + private DateTimeFormatter forPattern(String pattern) { + return org.joda.time.format.DateTimeFormat.forPattern(pattern); + } + + private DateTimeFormatter forStyle(String style) { + return org.joda.time.format.DateTimeFormat.forStyle(style); + } + + private DateTimeFormatter forIso(ISO iso) { + if (iso == ISO.DATE) { + return org.joda.time.format.ISODateTimeFormat.date(); + } + else if (iso == ISO.TIME) { + return org.joda.time.format.ISODateTimeFormat.time(); + } + else { + return org.joda.time.format.ISODateTimeFormat.dateTime(); + } } } diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeContextHolder.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeContextHolder.java index 58c94b14820f..5735657d8beb 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeContextHolder.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeContextHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java index 6943ad4241f9..cb8811940f20 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java @@ -148,6 +148,17 @@ public Long convert(DateTime source) { } } + /** + * Used when printing a java.util.Date field with a MillisecondInstantPrinter. + * @see MillisecondInstantPrinter + * @see JodaDateTimeFormatAnnotationFormatterFactory + */ + private static class DateToLongConverter implements Converter { + public Long convert(Date source) { + return source.getTime(); + } + } + /** * Used when printing a java.util.Calendar field with a ReadableInstantPrinter. * @see MillisecondInstantPrinter diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/MillisecondInstantPrinter.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/MillisecondInstantPrinter.java index d7b22e71f0d4..1cca5b6b7398 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/MillisecondInstantPrinter.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/MillisecondInstantPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/format/datetime/joda/ReadablePartialPrinter.java b/spring-context/src/main/java/org/springframework/format/datetime/joda/ReadablePartialPrinter.java index 9ad97c20581f..bb78ec7ba1e3 100644 --- a/spring-context/src/main/java/org/springframework/format/datetime/joda/ReadablePartialPrinter.java +++ b/spring-context/src/main/java/org/springframework/format/datetime/joda/ReadablePartialPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java b/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java index 7ae4021945a5..00c14d8a7d25 100644 --- a/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java +++ b/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java @@ -76,7 +76,7 @@ protected String resolveEmbeddedValue(String value) { public Printer getPrinter(NumberFormat annotation, Class fieldType) { return configureFormatterFrom(annotation); } - + public Parser getParser(NumberFormat annotation, Class fieldType) { return configureFormatterFrom(annotation); } diff --git a/spring-context/src/main/java/org/springframework/format/support/FormattingConversionService.java b/spring-context/src/main/java/org/springframework/format/support/FormattingConversionService.java index 345131a5aa4d..7b4400a31366 100644 --- a/spring-context/src/main/java/org/springframework/format/support/FormattingConversionService.java +++ b/spring-context/src/main/java/org/springframework/format/support/FormattingConversionService.java @@ -191,11 +191,12 @@ public String toString() { } + @SuppressWarnings({"rawtypes", "unchecked"}) private class AnnotationPrinterConverter implements ConditionalGenericConverter { private Class annotationType; - private AnnotationFormatterFactory annotationFormatterFactory; + private AnnotationFormatterFactory annotationFormatterFactory; private Class fieldType; @@ -214,7 +215,6 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { return sourceType.hasAnnotation(annotationType); } - @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { AnnotationConverterKey converterKey = new AnnotationConverterKey(sourceType.getAnnotation(annotationType), sourceType.getObjectType()); @@ -235,6 +235,7 @@ public String toString() { } + @SuppressWarnings({"rawtypes", "unchecked"}) private class AnnotationParserConverter implements ConditionalGenericConverter { private Class annotationType; @@ -258,7 +259,6 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { return targetType.hasAnnotation(annotationType); } - @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { AnnotationConverterKey converterKey = new AnnotationConverterKey(targetType.getAnnotation(annotationType), targetType.getObjectType()); @@ -273,8 +273,7 @@ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor t } public String toString() { - return String.class.getName() + " -> @" + annotationType.getName() + " " + - fieldType.getName() + ": " + annotationFormatterFactory; + return String.class.getName() + " -> @" + annotationType.getName() + " " + fieldType.getName() + ": " + annotationFormatterFactory; } } diff --git a/spring-context/src/main/java/org/springframework/format/support/FormattingConversionServiceFactoryBean.java b/spring-context/src/main/java/org/springframework/format/support/FormattingConversionServiceFactoryBean.java index e577c0619ca0..57a8f3ca2520 100644 --- a/spring-context/src/main/java/org/springframework/format/support/FormattingConversionServiceFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/format/support/FormattingConversionServiceFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,15 +96,15 @@ public void setFormatters(Set formatters) { } /** - *

    Configure the set of FormatterRegistrars to invoke to register - * Converters and Formatters in addition to those added declaratively + *

    Configure the set of FormatterRegistrars to invoke to register + * Converters and Formatters in addition to those added declaratively * via {@link #setConverters(Set)} and {@link #setFormatters(Set)}. - *

    FormatterRegistrars are useful when registering multiple related - * converters and formatters for a formatting category, such as Date - * formatting. All types related needed to support the formatting + *

    FormatterRegistrars are useful when registering multiple related + * converters and formatters for a formatting category, such as Date + * formatting. All types related needed to support the formatting * category can be registered from one place. - *

    FormatterRegistrars can also be used to register Formatters - * indexed under a specific field type different from its own <T>, + *

    FormatterRegistrars can also be used to register Formatters + * indexed under a specific field type different from its own <T>, * or when registering a Formatter from a Printer/Parser pair. * @see FormatterRegistry#addFormatterForFieldType(Class, Formatter) * @see FormatterRegistry#addFormatterForFieldType(Class, Printer, Parser) @@ -116,7 +116,7 @@ public void setFormatterRegistrars(Set formatterRegistrars) /** * Indicate whether default formatters should be registered or not. *

    By default, built-in formatters are registered. This flag can be used - * to turn that off and rely on explicitly registered formatters only. + * to turn that off and rely on explicitly registered formatters only. * @see #setFormatters(Set) * @see #setFormatterRegistrars(Set) */ diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaver.java index d9630c0622e6..19d380353465 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -135,4 +135,4 @@ public ClassLoader getThrowawayClassLoader() { return new SimpleThrowawayClassLoader(this.classLoader); } } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoader.java b/spring-context/src/main/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoader.java index 8f8447aef6a8..7cf9200abc4d 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoader.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoader.java @@ -34,7 +34,7 @@ * @since 2.0 */ public class ResourceOverridingShadowingClassLoader extends ShadowingClassLoader { - + private static final Enumeration EMPTY_URL_ENUMERATION = new Enumeration() { public boolean hasMoreElements() { return false; @@ -43,7 +43,7 @@ public URL nextElement() { throw new UnsupportedOperationException("Should not be called. I am empty."); } }; - + /** * Key is asked for value: value is actual value @@ -59,7 +59,7 @@ public URL nextElement() { public ResourceOverridingShadowingClassLoader(ClassLoader enclosingClassLoader) { super(enclosingClassLoader); } - + /** * Return the resource (if any) at the new path @@ -70,7 +70,7 @@ public ResourceOverridingShadowingClassLoader(ClassLoader enclosingClassLoader) public void override(String oldPath, String newPath) { this.overrides.put(oldPath, newPath); } - + /** * Ensure that a resource with the given path is not found. * @param oldPath the path of the resource to hide even if @@ -111,7 +111,7 @@ public InputStream getResourceAsStream(String requestedPath) { return super.getResourceAsStream(requestedPath); } } - + @Override public Enumeration getResources(String requestedPath) throws IOException { if (this.overrides.containsKey(requestedPath)) { diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/ShadowingClassLoader.java b/spring-context/src/main/java/org/springframework/instrument/classloading/ShadowingClassLoader.java index 913b4b00ded8..fbff824dfded 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/ShadowingClassLoader.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/ShadowingClassLoader.java @@ -56,7 +56,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader { private final List classFileTransformers = new LinkedList(); - private final Map classCache = new HashMap(); + private final Map> classCache = new HashMap>(); /** @@ -96,7 +96,7 @@ public void copyTransformers(ShadowingClassLoader other) { @Override public Class loadClass(String name) throws ClassNotFoundException { if (shouldShadow(name)) { - Class cls = this.classCache.get(name); + Class cls = this.classCache.get(name); if (cls != null) { return cls; } @@ -129,7 +129,7 @@ protected boolean isEligibleForShadowing(String className) { } - private Class doLoadClass(String name) throws ClassNotFoundException { + private Class doLoadClass(String name) throws ClassNotFoundException { String internalName = StringUtils.replace(name, ".", "/") + ".class"; InputStream is = this.enclosingClassLoader.getResourceAsStream(internalName); if (is == null) { @@ -138,7 +138,7 @@ private Class doLoadClass(String name) throws ClassNotFoundException { try { byte[] bytes = FileCopyUtils.copyToByteArray(is); bytes = applyTransformers(name, bytes); - Class cls = defineClass(name, bytes, 0, bytes.length); + Class cls = defineClass(name, bytes, 0, bytes.length); // Additional check for defining the package, if not defined yet. if (cls.getPackage() == null) { int packageSeparator = name.lastIndexOf('.'); diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/SimpleInstrumentableClassLoader.java b/spring-context/src/main/java/org/springframework/instrument/classloading/SimpleInstrumentableClassLoader.java index 191db3f83c20..5aa4ecdac0ab 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/SimpleInstrumentableClassLoader.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/SimpleInstrumentableClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ * @author Costin Leau * @since 2.0 */ -public class SimpleInstrumentableClassLoader extends OverridingClassLoader { +public class SimpleInstrumentableClassLoader extends OverridingClassLoader { private final WeavingTransformer weavingTransformer; diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/glassfish/GlassFishClassLoaderAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/glassfish/GlassFishClassLoaderAdapter.java index 8d114b2bec26..d5568e3b8d34 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/glassfish/GlassFishClassLoaderAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/glassfish/GlassFishClassLoaderAdapter.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,9 +24,9 @@ * Reflective wrapper around the GlassFish class loader. Used to * encapsulate the classloader-specific methods (discovered and * called through reflection) from the load-time weaver. - * + * *

    Supports GlassFish V1, V2 and V3 (currently in beta). - * + * * @author Costin Leau * @since 3.0 */ diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java index 5216b5cd508b..0932ab64cb06 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java @@ -26,7 +26,7 @@ /** * Reflective wrapper around a JBoss 5 and 6 class loader methods (discovered and called * through reflection) for load time weaving. - * + * * @author Costin Leau * @since 3.1 */ @@ -142,4 +142,4 @@ public void addTransformer(ClassFileTransformer transformer) { public ClassLoader getInstrumentableClassLoader() { return classLoader; } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java index 794864e5f6e9..da7399d5da24 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java @@ -23,10 +23,10 @@ /** * Adapter that implements JBoss Translator interface, delegating to a * standard JDK {@link ClassFileTransformer} underneath. - * + * *

    To avoid compile time checks again the vendor API, a dynamic proxy is * being used. - * + * * @author Costin Leau * @since 3.1 */ @@ -79,4 +79,4 @@ public String toString() { builder.append(this.transformer); return builder.toString(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java index f9ba2b62045d..03403036d06f 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java @@ -68,4 +68,4 @@ public void addTransformer(ClassFileTransformer transformer) { public ClassLoader getInstrumentableClassLoader() { return classLoader; } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassLoaderAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassLoaderAdapter.java index c1383385182f..72949c25bd18 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassLoaderAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassLoaderAdapter.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ * Reflective wrapper around a OC4J class loader. Used to * encapsulate the classloader-specific methods (discovered and * called through reflection) from the load-time weaver. - * + * * @author Costin Leau */ class OC4JClassLoaderAdapter { @@ -85,4 +85,4 @@ public ClassLoader getThrowawayClassLoader() { throw new IllegalStateException("Could not copy OC4J classloader", ex); } } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassPreprocessorAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassPreprocessorAdapter.java index 540aed883e76..1b1f240faf36 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassPreprocessorAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JClassPreprocessorAdapter.java @@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,7 @@ * *

    To avoid compile time checks again the vendor API, a dynamic proxy is * being used. - * + * * @author Costin Leau */ class OC4JClassPreprocessorAdapter implements InvocationHandler { @@ -92,4 +92,4 @@ public String toString() { builder.append(this.transformer); return builder.toString(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.java index 8e0a25111554..5835f107cee8 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.java @@ -45,7 +45,7 @@ public class OC4JLoadTimeWeaver implements LoadTimeWeaver { /** * Creates a new instance of thie {@link OC4JLoadTimeWeaver} class * using the default {@link ClassLoader class loader}. - * @see org.springframework.util.ClassUtils#getDefaultClassLoader() + * @see org.springframework.util.ClassUtils#getDefaultClassLoader() */ public OC4JLoadTimeWeaver() { this(ClassUtils.getDefaultClassLoader()); @@ -76,5 +76,4 @@ public ClassLoader getInstrumentableClassLoader() { public ClassLoader getThrowawayClassLoader() { return this.classLoader.getThrowawayClassLoader(); } - } diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassLoaderAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassLoaderAdapter.java index fc198635a42f..3cdcf8953ee7 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassLoaderAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassLoaderAdapter.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2007 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,7 @@ * Reflective wrapper around a WebLogic 10 class loader. Used to * encapsulate the classloader-specific methods (discovered and * called through reflection) from the load-time weaver. - * + * * @author Costin Leau * @author Juergen Hoeller * @since 2.5 @@ -43,7 +43,7 @@ class WebLogicClassLoaderAdapter { private final ClassLoader classLoader; - private final Class wlPreProcessorClass; + private final Class wlPreProcessorClass; private final Method addPreProcessorMethod; @@ -51,11 +51,11 @@ class WebLogicClassLoaderAdapter { private final Method getParentMethod; - private final Constructor wlGenericClassLoaderConstructor; + private final Constructor wlGenericClassLoaderConstructor; public WebLogicClassLoaderAdapter(ClassLoader classLoader) { - Class wlGenericClassLoaderClass = null; + Class wlGenericClassLoaderClass = null; try { wlGenericClassLoaderClass = classLoader.loadClass(GENERIC_CLASS_LOADER_NAME); this.wlPreProcessorClass = classLoader.loadClass(CLASS_PRE_PROCESSOR_NAME); @@ -110,4 +110,4 @@ public ClassLoader getThrowawayClassLoader() { throw new IllegalStateException("Could not construct WebLogic GenericClassLoader", ex); } } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassPreProcessorAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassPreProcessorAdapter.java index 4fe58d444d4a..94405f09fb54 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassPreProcessorAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicClassPreProcessorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl } else if ("toString".equals(name)) { return toString(); } else if ("initialize".equals(name)) { - initialize((Hashtable) args[0]); + initialize((Hashtable) args[0]); return null; } else if ("preProcess".equals(name)) { return preProcess((String) args[0], (byte[]) args[1]); @@ -68,7 +68,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl } } - public void initialize(Hashtable params) { + public void initialize(Hashtable params) { } public byte[] preProcess(String className, byte[] classBytes) { @@ -87,4 +87,4 @@ public String toString() { builder.append(this.transformer); return builder.toString(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicLoadTimeWeaver.java index ef1baa9912ff..0df6c6dbc463 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/weblogic/WebLogicLoadTimeWeaver.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2007 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -69,4 +69,4 @@ public ClassLoader getInstrumentableClassLoader() { public ClassLoader getThrowawayClassLoader() { return this.classLoader.getThrowawayClassLoader(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassLoaderAdapter.java b/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassLoaderAdapter.java index 798393676b01..b0004bb1a761 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassLoaderAdapter.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassLoaderAdapter.java @@ -28,11 +28,11 @@ import org.springframework.util.Assert; /** - * + * * Reflective wrapper around a WebSphere 7 class loader. Used to * encapsulate the classloader-specific methods (discovered and * called through reflection) from the load-time weaver. - * + * * @author Costin Leau * @since 3.1 */ @@ -93,7 +93,7 @@ public void addTransformer(ClassFileTransformer transformer) { public ClassLoader getThrowawayClassLoader() { try { - ClassLoader loader = (ClassLoader) cloneConstructor.newInstance(getClassLoader()); + ClassLoader loader = cloneConstructor.newInstance(getClassLoader()); // clear out the transformers (copied as well) List list = (List) transformerList.get(loader); list.clear(); diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassPreDefinePlugin.java b/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassPreDefinePlugin.java index 748ba182a45d..32227c0b4758 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassPreDefinePlugin.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereClassPreDefinePlugin.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2011 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,10 +25,10 @@ /** * Adapter that implements WebSphere 7.0 ClassPreProcessPlugin interface, * delegating to a standard JDK {@link ClassFileTransformer} underneath. - * + * *

    To avoid compile time checks again the vendor API, a dynamic proxy is * being used. - * + * * @author Costin Leau * @since 3.1 */ diff --git a/spring-context/src/main/java/org/springframework/jmx/access/ConnectorDelegate.java b/spring-context/src/main/java/org/springframework/jmx/access/ConnectorDelegate.java index f4df31dcbc7e..d78b841b0767 100644 --- a/spring-context/src/main/java/org/springframework/jmx/access/ConnectorDelegate.java +++ b/spring-context/src/main/java/org/springframework/jmx/access/ConnectorDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java b/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java index 0396c0dfb811..e5aac009a64f 100644 --- a/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java +++ b/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,7 @@ public class MBeanClientInterceptor private boolean useStrictCasing = true; - private Class managementInterface; + private Class managementInterface; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -215,7 +215,7 @@ public void setUseStrictCasing(boolean useStrictCasing) { * setters and getters for MBean attributes and conventional Java methods * for MBean operations. */ - public void setManagementInterface(Class managementInterface) { + public void setManagementInterface(Class managementInterface) { this.managementInterface = managementInterface; } @@ -223,7 +223,7 @@ public void setManagementInterface(Class managementInterface) { * Return the management interface of the target MBean, * or null if none specified. */ - protected final Class getManagementInterface() { + protected final Class getManagementInterface() { return this.managementInterface; } @@ -297,7 +297,7 @@ private void retrieveMBeanInfo() throws MBeanInfoRetrievalException { MBeanOperationInfo[] operationInfo = info.getOperations(); this.allowedOperations = new HashMap(operationInfo.length); for (MBeanOperationInfo infoEle : operationInfo) { - Class[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader); + Class[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader); this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle); } } @@ -531,7 +531,7 @@ private Object invokeOperation(Method method, Object[] args) throws JMException, * is necessary */ protected Object convertResultValueIfNecessary(Object result, MethodParameter parameter) { - Class targetClass = parameter.getParameterType(); + Class targetClass = parameter.getParameterType(); try { if (result == null) { return null; @@ -549,7 +549,7 @@ else if (result instanceof CompositeData[]) { return convertDataArrayToTargetArray(array, targetClass); } else if (Collection.class.isAssignableFrom(targetClass)) { - Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter); + Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter); if (elementType != null) { return convertDataArrayToTargetCollection(array, targetClass, elementType); } @@ -565,7 +565,7 @@ else if (result instanceof TabularData[]) { return convertDataArrayToTargetArray(array, targetClass); } else if (Collection.class.isAssignableFrom(targetClass)) { - Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter); + Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter); if (elementType != null) { return convertDataArrayToTargetCollection(array, targetClass, elementType); } @@ -581,8 +581,8 @@ else if (Collection.class.isAssignableFrom(targetClass)) { } } - private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) throws NoSuchMethodException { - Class targetType = targetClass.getComponentType(); + private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) throws NoSuchMethodException { + Class targetType = targetClass.getComponentType(); Method fromMethod = targetType.getMethod("from", array.getClass().getComponentType()); Object resultArray = Array.newInstance(targetType, array.length); for (int i = 0; i < array.length; i++) { @@ -591,12 +591,11 @@ private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) return resultArray; } - @SuppressWarnings("unchecked") - private Collection convertDataArrayToTargetCollection(Object[] array, Class collectionType, Class elementType) + private Collection convertDataArrayToTargetCollection(Object[] array, Class collectionType, Class elementType) throws NoSuchMethodException { Method fromMethod = elementType.getMethod("from", array.getClass().getComponentType()); - Collection resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array)); + Collection resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array)); for (int i = 0; i < array.length; i++) { resultColl.add(ReflectionUtils.invokeMethod(fromMethod, null, array[i])); } @@ -616,7 +615,7 @@ private static class MethodCacheKey { private final String name; - private final Class[] parameterTypes; + private final Class[] parameterTypes; /** * Create a new instance of MethodCacheKey with the supplied @@ -624,7 +623,7 @@ private static class MethodCacheKey { * @param name the name of the method * @param parameterTypes the arguments in the method signature */ - public MethodCacheKey(String name, Class[] parameterTypes) { + public MethodCacheKey(String name, Class[] parameterTypes) { this.name = name; this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class[0]); } diff --git a/spring-context/src/main/java/org/springframework/jmx/access/MBeanProxyFactoryBean.java b/spring-context/src/main/java/org/springframework/jmx/access/MBeanProxyFactoryBean.java index 3cd7878f01ce..44abb5183141 100644 --- a/spring-context/src/main/java/org/springframework/jmx/access/MBeanProxyFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/access/MBeanProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor implements FactoryBean, BeanClassLoaderAware, InitializingBean { - private Class proxyInterface; + private Class proxyInterface; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -62,7 +62,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor * conventional Java methods for MBean operations. * @see #setObjectName */ - public void setProxyInterface(Class proxyInterface) { + public void setProxyInterface(Class proxyInterface) { this.proxyInterface = proxyInterface; } diff --git a/spring-context/src/main/java/org/springframework/jmx/access/NotificationListenerRegistrar.java b/spring-context/src/main/java/org/springframework/jmx/access/NotificationListenerRegistrar.java index 9c9f5330d572..b0a58baed39d 100644 --- a/spring-context/src/main/java/org/springframework/jmx/access/NotificationListenerRegistrar.java +++ b/spring-context/src/main/java/org/springframework/jmx/access/NotificationListenerRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java b/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java index 6b02d5b92de7..cfc94b37bac8 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -603,7 +603,7 @@ protected ObjectName registerBeanNameOrInstance(Object mapValue, String beanKey) "Unable to register MBean [" + mapValue + "] with key '" + beanKey + "'", ex); } } - + /** * Replaces any bean names used as keys in the NotificationListener * mappings with their corresponding ObjectName values. @@ -739,7 +739,7 @@ protected ObjectName getObjectName(Object bean, String beanKey) throws Malformed * @return whether the class qualifies as an MBean * @see org.springframework.jmx.support.JmxUtils#isMBean(Class) */ - protected boolean isMBean(Class beanClass) { + protected boolean isMBean(Class beanClass) { return JmxUtils.isMBean(beanClass); } @@ -751,7 +751,7 @@ protected boolean isMBean(Class beanClass) { * @param bean the original bean instance * @return the adapted MBean, or null if not possible */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException { Class targetClass = AopUtils.getTargetClass(bean); if (targetClass != bean.getClass()) { @@ -782,8 +782,8 @@ protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException { * interface for the supplied managed resource. * @param managedResource the resource that is to be exported as an MBean * @param beanKey the key associated with the managed bean - * @see #createModelMBean() - * @see #getMBeanInfo(Object, String) + * @see #createModelMBean() + * @see #getMBeanInfo(Object, String) */ protected ModelMBean createAndConfigureMBean(Object managedResource, String beanKey) throws MBeanExportException { @@ -840,7 +840,7 @@ private ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws J */ private void autodetectBeans(final AutodetectCapableMBeanInfoAssembler assembler) { autodetect(new AutodetectCallback() { - public boolean include(Class beanClass, String beanName) { + public boolean include(Class beanClass, String beanName) { return assembler.includeBean(beanClass, beanName); } }); @@ -852,7 +852,7 @@ public boolean include(Class beanClass, String beanName) { */ private void autodetectMBeans() { autodetect(new AutodetectCallback() { - public boolean include(Class beanClass, String beanName) { + public boolean include(Class beanClass, String beanName) { return isMBean(beanClass); } }); @@ -874,7 +874,7 @@ private void autodetect(AutodetectCallback callback) { for (String beanName : beanNames) { if (!isExcluded(beanName) && !isBeanDefinitionAbstract(this.beanFactory, beanName)) { try { - Class beanClass = this.beanFactory.getType(beanName); + Class beanClass = this.beanFactory.getType(beanName); if (beanClass != null && callback.include(beanClass, beanName)) { boolean lazyInit = isBeanDefinitionLazyInit(this.beanFactory, beanName); Object beanInstance = (!lazyInit ? this.beanFactory.getBean(beanName) : null); @@ -1060,7 +1060,7 @@ private static interface AutodetectCallback { * @param beanClass the class of the bean * @param beanName the name of the bean */ - boolean include(Class beanClass, String beanName); + boolean include(Class beanClass, String beanName); } @@ -1072,7 +1072,7 @@ private static interface AutodetectCallback { private class NotificationPublisherAwareLazyTargetSource extends LazyInitTargetSource { private ModelMBean modelMBean; - + private ObjectName objectName; public void setModelMBean(ModelMBean modelMBean) { diff --git a/spring-context/src/main/java/org/springframework/jmx/export/SpringModelMBean.java b/spring-context/src/main/java/org/springframework/jmx/export/SpringModelMBean.java index f313e65fbc39..3ade5624604a 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/SpringModelMBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/SpringModelMBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public SpringModelMBean() throws MBeanException, RuntimeOperationsException { * Construct a new SpringModelMBean instance with the given {@link ModelMBeanInfo}. * @see javax.management.modelmbean.RequiredModelMBean#RequiredModelMBean(ModelMBeanInfo) */ - public SpringModelMBean(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException { + public SpringModelMBean(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException { super(mbi); } diff --git a/spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedMetric.java b/spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedMetric.java index b2a1d26338ba..f6868aeb9f94 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedMetric.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedMetric.java @@ -28,7 +28,7 @@ * JDK 1.5+ method-level annotation that indicates to expose a given bean * property as JMX attribute, with added Descriptor properties to indicate that * it is a metric. Only valid when used on a JavaBean getter. - * + * * @author Jennifer Hickey * @since 3.0 * @see org.springframework.jmx.export.metadata.ManagedMetric diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractConfigurableMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractConfigurableMBeanInfoAssembler.java index 4857f405e08e..845972b1fc6b 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractConfigurableMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractConfigurableMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ private ModelMBeanNotificationInfo[] extractNotificationMetadata(Object mapValue return new ModelMBeanNotificationInfo[] {JmxMetadataUtils.convertToModelMBeanNotificationInfo(mn)}; } else if (mapValue instanceof Collection) { - Collection col = (Collection) mapValue; + Collection col = (Collection) mapValue; List result = new ArrayList(); for (Object colValue : col) { if (!(colValue instanceof ManagedNotification)) { diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractMBeanInfoAssembler.java index c0a95abb4ff7..0c4d024652b5 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ protected void checkManagedBean(Object managedBean) throws IllegalArgumentExcept * @return the bean class to expose * @see org.springframework.aop.support.AopUtils#getTargetClass(Object) */ - protected Class getTargetClass(Object managedBean) { + protected Class getTargetClass(Object managedBean) { return AopUtils.getTargetClass(managedBean); } diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java index a701a5d0f623..4aa5e8ebaff7 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractReflectiveMBeanInfoAssembler.java @@ -108,12 +108,12 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean * Constant identifier for the log field in a JMX {@link Descriptor}. */ protected static final String FIELD_LOG = "log"; - + /** * Constant identifier for the logfile field in a JMX {@link Descriptor}. */ protected static final String FIELD_LOG_FILE = "logFile"; - + /** * Constant identifier for the currency time limit field in a JMX {@link Descriptor}. */ @@ -143,12 +143,12 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean * Constant identifier for the persistName field in a JMX {@link Descriptor}. */ protected static final String FIELD_PERSIST_NAME = "persistName"; - + /** * Constant identifier for the displayName field in a JMX {@link Descriptor}. */ protected static final String FIELD_DISPLAY_NAME = "displayName"; - + /** * Constant identifier for the units field in a JMX {@link Descriptor}. */ @@ -158,7 +158,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean * Constant identifier for the metricType field in a JMX {@link Descriptor}. */ protected static final String FIELD_METRIC_TYPE = "metricType"; - + /** * Constant identifier for the custom metricCategory field in a JMX {@link Descriptor}. */ @@ -411,7 +411,7 @@ protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, S * @see #getClassToExpose(Class) * @see org.springframework.aop.framework.AopProxyUtils#proxiedUserInterfaces(Object) */ - protected Class getClassForDescriptor(Object managedBean) { + protected Class getClassForDescriptor(Object managedBean) { if (AopUtils.isJdkDynamicProxy(managedBean)) { return AopProxyUtils.proxiedUserInterfaces(managedBean)[0]; } diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java index 4605a4161a55..613b90c31bbd 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI /** * Stores the array of interfaces to use for creating the management interface. */ - private Class[] managedInterfaces; + private Class[] managedInterfaces; /** * Stores the mappings of bean keys to an array of Classes. @@ -75,7 +75,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI /** * Stores the mappings of bean keys to an array of Classes. */ - private Map resolvedInterfaceMappings; + private Map[]> resolvedInterfaceMappings; /** @@ -86,7 +86,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI * Each entry MUST be an interface. * @see #setInterfaceMappings */ - public void setManagedInterfaces(Class[] managedInterfaces) { + public void setManagedInterfaces(Class[] managedInterfaces) { if (managedInterfaces != null) { for (Class ifc : managedInterfaces) { if (!ifc.isInterface()) { @@ -125,12 +125,12 @@ public void afterPropertiesSet() { * @param mappings the specified interface mappings * @return the resolved interface mappings (with Class objects as values) */ - private Map resolveInterfaceMappings(Properties mappings) { - Map resolvedMappings = new HashMap(mappings.size()); - for (Enumeration en = mappings.propertyNames(); en.hasMoreElements();) { + private Map[]> resolveInterfaceMappings(Properties mappings) { + Map[]> resolvedMappings = new HashMap[]>(mappings.size()); + for (Enumeration en = mappings.propertyNames(); en.hasMoreElements();) { String beanKey = (String) en.nextElement(); String[] classNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey)); - Class[] classes = resolveClassNames(classNames, beanKey); + Class[] classes = resolveClassNames(classNames, beanKey); resolvedMappings.put(beanKey, classes); } return resolvedMappings; @@ -142,10 +142,10 @@ private Map resolveInterfaceMappings(Properties mappings) { * @param beanKey the bean key that the class names are associated with * @return the resolved Class */ - private Class[] resolveClassNames(String[] classNames, String beanKey) { - Class[] classes = new Class[classNames.length]; + private Class[] resolveClassNames(String[] classNames, String beanKey) { + Class[] classes = new Class[classNames.length]; for (int x = 0; x < classes.length; x++) { - Class cls = ClassUtils.resolveClassName(classNames[x].trim(), this.beanClassLoader); + Class cls = ClassUtils.resolveClassName(classNames[x].trim(), this.beanClassLoader); if (!cls.isInterface()) { throw new IllegalArgumentException( "Class [" + classNames[x] + "] mapped to bean key [" + beanKey + "] is no interface"); @@ -215,7 +215,7 @@ private boolean isPublicInInterface(Method method, String beanKey) { * interface for the given bean. */ private boolean isDeclaredInInterface(Method method, String beanKey) { - Class[] ifaces = null; + Class[] ifaces = null; if (this.resolvedInterfaceMappings != null) { ifaces = this.resolvedInterfaceMappings.get(beanKey); @@ -229,7 +229,7 @@ private boolean isDeclaredInInterface(Method method, String beanKey) { } if (ifaces != null) { - for (Class ifc : ifaces) { + for (Class ifc : ifaces) { for (Method ifcMethod : ifc.getMethods()) { if (ifcMethod.getName().equals(method.getName()) && Arrays.equals(ifcMethod.getParameterTypes(), method.getParameterTypes())) { diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java index 9f035edc5bc1..2f32716d2de7 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MetadataMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -260,7 +260,7 @@ protected MBeanParameterInfo[] getOperationParameters(Method method, String bean } MBeanParameterInfo[] parameterInfo = new MBeanParameterInfo[params.length]; - Class[] methodParameters = method.getParameterTypes(); + Class[] methodParameters = method.getParameterTypes(); for (int i = 0; i < params.length; i++) { ManagedOperationParameter param = params[i]; diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssembler.java index ba77fd95b9ae..22643c656609 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ /** * AbstractReflectiveMBeanInfoAssembler subclass that allows * method names to be explicitly excluded as MBean operations and attributes. - * + * *

    Any method not explicitly excluded from the management interface will be exposed to * JMX. JavaBean getters and setters will automatically be exposed as JMX attributes. * @@ -81,7 +81,7 @@ public void setIgnoredMethods(String[] ignoredMethodNames) { */ public void setIgnoredMethodMappings(Properties mappings) { this.ignoredMethodMappings = new HashMap>(); - for (Enumeration en = mappings.keys(); en.hasMoreElements();) { + for (Enumeration en = mappings.keys(); en.hasMoreElements();) { String beanKey = (String) en.nextElement(); String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey)); this.ignoredMethodMappings.put(beanKey, new HashSet(Arrays.asList(methodNames))); diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssembler.java index d047b4b2e8e7..ef4277a3180a 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssembler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public void setManagedMethods(String[] methodNames) { */ public void setMethodMappings(Properties mappings) { this.methodMappings = new HashMap>(); - for (Enumeration en = mappings.keys(); en.hasMoreElements();) { + for (Enumeration en = mappings.keys(); en.hasMoreElements();) { String beanKey = (String) en.nextElement(); String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey)); this.methodMappings.put(beanKey, new HashSet(Arrays.asList(methodNames))); diff --git a/spring-context/src/main/java/org/springframework/jmx/export/metadata/JmxAttributeSource.java b/spring-context/src/main/java/org/springframework/jmx/export/metadata/JmxAttributeSource.java index 6feb65bca81a..2a18efa50daa 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/metadata/JmxAttributeSource.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/metadata/JmxAttributeSource.java @@ -49,7 +49,7 @@ public interface JmxAttributeSource { * @throws InvalidMetadataException in case of invalid attributes */ ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException; - + /** * Implementations should return an instance of ManagedMetric * if the supplied Method has the corresponding metadata. @@ -89,7 +89,7 @@ public interface JmxAttributeSource { * @throws InvalidMetadataException in the case of invalid metadata */ ManagedNotification[] getManagedNotifications(Class clazz) throws InvalidMetadataException; - - - + + + } diff --git a/spring-context/src/main/java/org/springframework/jmx/export/naming/IdentityNamingStrategy.java b/spring-context/src/main/java/org/springframework/jmx/export/naming/IdentityNamingStrategy.java index 1dfa78fd2df2..17ea5d9aa75d 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/naming/IdentityNamingStrategy.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/naming/IdentityNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class IdentityNamingStrategy implements ObjectNamingStrategy { */ public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException { String domain = ClassUtils.getPackageName(managedBean.getClass()); - Hashtable keys = new Hashtable(); + Hashtable keys = new Hashtable(); keys.put(TYPE_KEY, ClassUtils.getShortName(managedBean.getClass())); keys.put(HASH_CODE_KEY, ObjectUtils.getIdentityHexString(managedBean)); return ObjectNameManager.getInstance(domain, keys); diff --git a/spring-context/src/main/java/org/springframework/jmx/export/naming/KeyNamingStrategy.java b/spring-context/src/main/java/org/springframework/jmx/export/naming/KeyNamingStrategy.java index cd70b6b67e00..7d3da3c6fa5a 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/naming/KeyNamingStrategy.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/naming/KeyNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ * ObjectNamingStrategy implementation that builds * ObjectName instances from the key used in the * "beans" map passed to MBeanExporter. - * + * *

    Can also check object name mappings, given as Properties * or as mappingLocations of properties files. The key used * to look up is the key used in MBeanExporter's "beans" map. @@ -123,7 +123,7 @@ public void afterPropertiesSet() throws IOException { } } } - + /** * Attempts to retrieve the ObjectName via the given key, trying to diff --git a/spring-context/src/main/java/org/springframework/jmx/export/naming/MetadataNamingStrategy.java b/spring-context/src/main/java/org/springframework/jmx/export/naming/MetadataNamingStrategy.java index 2f496163be16..9eeb300585be 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/naming/MetadataNamingStrategy.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/naming/MetadataNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ public void afterPropertiesSet() { * with the managed resource's Class. */ public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException { - Class managedClass = AopUtils.getTargetClass(managedBean); + Class managedClass = AopUtils.getTargetClass(managedBean); ManagedResource mr = this.attributeSource.getManagedResource(managedClass); // Check that an object name has been specified. diff --git a/spring-context/src/main/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisher.java b/spring-context/src/main/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisher.java index b4c50d237e21..29d87d7ab317 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisher.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisher.java @@ -64,7 +64,7 @@ public class ModelMBeanNotificationPublisher implements NotificationPublisher { * @param modelMBean the target {@link ModelMBean}; must not be null * @param objectName the {@link ObjectName} of the source {@link ModelMBean} * @param managedResource the managed resource exposed by the supplied {@link ModelMBean} - * @throws IllegalArgumentException if any of the parameters is null + * @throws IllegalArgumentException if any of the parameters is null */ public ModelMBeanNotificationPublisher( ModelMBeanNotificationBroadcaster modelMBean, ObjectName objectName, Object managedResource) { diff --git a/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java b/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java index a86f2a7c893f..241febcc6a0f 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/ConnectorServerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java b/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java index dd008404df31..5fa32de2d454 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -145,7 +145,7 @@ public static MBeanServer locateMBeanServer(String agentId) throws MBeanServerNo * @return the parameter types as classes * @throws ClassNotFoundException if a parameter type could not be resolved */ - public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException { + public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException { return parameterInfoToTypes(paramInfo, ClassUtils.getDefaultClassLoader()); } @@ -157,10 +157,10 @@ public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throw * @return the parameter types as classes * @throws ClassNotFoundException if a parameter type could not be resolved */ - public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader) + public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader) throws ClassNotFoundException { - Class[] types = null; + Class[] types = null; if (paramInfo != null && paramInfo.length > 0) { types = new Class[paramInfo.length]; for (int x = 0; x < paramInfo.length; x++) { @@ -178,7 +178,7 @@ public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, Class * @return the signature as array of argument types */ public static String[] getMethodSignature(Method method) { - Class[] types = method.getParameterTypes(); + Class[] types = method.getParameterTypes(); String[] signature = new String[types.length]; for (int x = 0; x < types.length; x++) { signature[x] = types[x].getName(); @@ -282,7 +282,7 @@ public static Class getMBeanInterface(Class clazz) { return null; } String mbeanInterfaceName = clazz.getName() + MBEAN_SUFFIX; - Class[] implementedInterfaces = clazz.getInterfaces(); + Class[] implementedInterfaces = clazz.getInterfaces(); for (Class iface : implementedInterfaces) { if (iface.getName().equals(mbeanInterfaceName)) { return iface; @@ -302,7 +302,7 @@ public static Class getMXBeanInterface(Class clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } - Class[] implementedInterfaces = clazz.getInterfaces(); + Class[] implementedInterfaces = clazz.getInterfaces(); for (Class iface : implementedInterfaces) { boolean isMxBean = iface.getName().endsWith(MXBEAN_SUFFIX); if (mxBeanAnnotationAvailable) { diff --git a/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBean.java b/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBean.java index 48bcd30a7b65..4436b36d53d7 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerFactoryBean.java b/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerFactoryBean.java index 3f4b1c9ab780..f0ada6fc24d0 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/MBeanServerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/support/NotificationListenerHolder.java b/spring-context/src/main/java/org/springframework/jmx/support/NotificationListenerHolder.java index ee0dd33b5c05..e2296b1c4c32 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/NotificationListenerHolder.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/NotificationListenerHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java b/spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java index 16a339f4d02b..6beffb6fbe9b 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/jmx/support/WebSphereMBeanServerFactoryBean.java b/spring-context/src/main/java/org/springframework/jmx/support/WebSphereMBeanServerFactoryBean.java index 875aebaea87e..7c5c6d8043d6 100644 --- a/spring-context/src/main/java/org/springframework/jmx/support/WebSphereMBeanServerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jmx/support/WebSphereMBeanServerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public void afterPropertiesSet() throws MBeanServerNotFoundException { /* * this.mbeanServer = AdminServiceFactory.getMBeanFactory().getMBeanServer(); */ - Class adminServiceClass = getClass().getClassLoader().loadClass(ADMIN_SERVICE_FACTORY_CLASS); + Class adminServiceClass = getClass().getClassLoader().loadClass(ADMIN_SERVICE_FACTORY_CLASS); Method getMBeanFactoryMethod = adminServiceClass.getMethod(GET_MBEAN_FACTORY_METHOD); Object mbeanFactory = getMBeanFactoryMethod.invoke(null); Method getMBeanServerMethod = mbeanFactory.getClass().getMethod(GET_MBEAN_SERVER_METHOD); diff --git a/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java b/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java index 504a96ad8c64..cd883a6fd059 100644 --- a/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ */ public class JndiObjectFactoryBean extends JndiObjectLocator implements FactoryBean, BeanClassLoaderAware { - private Class[] proxyInterfaces; + private Class[] proxyInterfaces; private boolean lookupOnStartup = true; @@ -87,7 +87,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator implements FactoryB * @see #setLookupOnStartup * @see #setCache */ - public void setProxyInterface(Class proxyInterface) { + public void setProxyInterface(Class proxyInterface) { this.proxyInterfaces = new Class[] {proxyInterface}; } @@ -100,7 +100,7 @@ public void setProxyInterface(Class proxyInterface) { * @see #setLookupOnStartup * @see #setCache */ - public void setProxyInterfaces(Class[] proxyInterfaces) { + public void setProxyInterfaces(Class[] proxyInterfaces) { this.proxyInterfaces = proxyInterfaces; } @@ -263,7 +263,7 @@ public boolean isSingleton() { * @return the merged interface as Class * @see java.lang.reflect.Proxy#getProxyClass */ - protected Class createCompositeInterface(Class[] interfaces) { + protected Class createCompositeInterface(Class[] interfaces) { return ClassUtils.createCompositeInterface(interfaces, this.beanClassLoader); } @@ -290,13 +290,13 @@ private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws Na proxyFactory.setInterfaces(jof.proxyInterfaces); } else { - Class targetClass = targetSource.getTargetClass(); + Class targetClass = targetSource.getTargetClass(); if (targetClass == null) { throw new IllegalStateException( "Cannot deactivate 'lookupOnStartup' without specifying a 'proxyInterface' or 'expectedType'"); } - Class[] ifcs = ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader); - for (Class ifc : ifcs) { + Class[] ifcs = ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader); + for (Class ifc : ifcs) { if (Modifier.isPublic(ifc.getModifiers())) { proxyFactory.addInterface(ifc); } diff --git a/spring-context/src/main/java/org/springframework/jndi/JndiObjectTargetSource.java b/spring-context/src/main/java/org/springframework/jndi/JndiObjectTargetSource.java index 86d44b56d02b..69fca1ee3ad5 100644 --- a/spring-context/src/main/java/org/springframework/jndi/JndiObjectTargetSource.java +++ b/spring-context/src/main/java/org/springframework/jndi/JndiObjectTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public class JndiObjectTargetSource extends JndiObjectLocator implements TargetS private Object cachedObject; - private Class targetClass; + private Class targetClass; /** diff --git a/spring-context/src/main/java/org/springframework/jndi/JndiTemplate.java b/spring-context/src/main/java/org/springframework/jndi/JndiTemplate.java index ad9fbf09a343..8b48528950b6 100644 --- a/spring-context/src/main/java/org/springframework/jndi/JndiTemplate.java +++ b/spring-context/src/main/java/org/springframework/jndi/JndiTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ * @see #execute */ public class JndiTemplate { - + protected final Log logger = LogFactory.getLog(getClass()); private Properties environment; @@ -127,10 +127,10 @@ public void releaseContext(Context ctx) { * @throws NamingException in case of initialization errors */ protected Context createInitialContext() throws NamingException { - Hashtable icEnv = null; + Hashtable icEnv = null; Properties env = getEnvironment(); if (env != null) { - icEnv = new Hashtable(env.size()); + icEnv = new Hashtable(env.size()); CollectionUtils.mergePropertiesIntoMap(env, icEnv); } return new InitialContext(icEnv); @@ -200,7 +200,7 @@ public Object doInContext(Context ctx) throws NamingException { } }); } - + /** * Rebind the given object to the current JNDI context, using the given name. * Overwrites any existing binding. @@ -236,5 +236,5 @@ public Object doInContext(Context ctx) throws NamingException { } }); } - + } diff --git a/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java b/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java index 1110a40bc9ce..dd4f4e2d279c 100644 --- a/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java +++ b/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/main/java/org/springframework/jndi/TypeMismatchNamingException.java b/spring-context/src/main/java/org/springframework/jndi/TypeMismatchNamingException.java index 6303b62a138f..dff7f33a72b3 100644 --- a/spring-context/src/main/java/org/springframework/jndi/TypeMismatchNamingException.java +++ b/spring-context/src/main/java/org/springframework/jndi/TypeMismatchNamingException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,9 +28,9 @@ */ public class TypeMismatchNamingException extends NamingException { - private Class requiredType; + private Class requiredType; - private Class actualType; + private Class actualType; /** @@ -40,7 +40,7 @@ public class TypeMismatchNamingException extends NamingException { * @param requiredType the required type for the lookup * @param actualType the actual type that the lookup returned */ - public TypeMismatchNamingException(String jndiName, Class requiredType, Class actualType) { + public TypeMismatchNamingException(String jndiName, Class requiredType, Class actualType) { super("Object of type [" + actualType + "] available at JNDI location [" + jndiName + "] is not assignable to [" + requiredType.getName() + "]"); this.requiredType = requiredType; @@ -59,14 +59,14 @@ public TypeMismatchNamingException(String explanation) { /** * Return the required type for the lookup, if available. */ - public final Class getRequiredType() { + public final Class getRequiredType() { return this.requiredType; } /** * Return the actual type that the lookup returned, if available. */ - public final Class getActualType() { + public final Class getActualType() { return this.actualType; } diff --git a/spring-context/src/main/java/org/springframework/jndi/package-info.java b/spring-context/src/main/java/org/springframework/jndi/package-info.java index f215120d6abd..eb6ebde08a8b 100644 --- a/spring-context/src/main/java/org/springframework/jndi/package-info.java +++ b/spring-context/src/main/java/org/springframework/jndi/package-info.java @@ -4,7 +4,7 @@ * The classes in this package make JNDI easier to use, * facilitating the accessing of configuration stored in JNDI, * and provide useful superclasses for JNDI access classes. - * + * *

    The classes in this package are discussed in Chapter 11 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-context/src/main/java/org/springframework/jndi/support/SimpleJndiBeanFactory.java b/spring-context/src/main/java/org/springframework/jndi/support/SimpleJndiBeanFactory.java index ae62286051aa..92bc8c91b1e1 100644 --- a/spring-context/src/main/java/org/springframework/jndi/support/SimpleJndiBeanFactory.java +++ b/spring-context/src/main/java/org/springframework/jndi/support/SimpleJndiBeanFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac private final Map singletonObjects = new HashMap(); /** Cache of the types of nonshareable resources: bean name --> bean type */ - private final Map resourceTypes = new HashMap(); + private final Map> resourceTypes = new HashMap>(); public SimpleJndiBeanFactory() { @@ -157,8 +157,8 @@ public boolean isPrototype(String name) throws NoSuchBeanDefinitionException { return !this.shareableResources.contains(name); } - public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException { - Class type = getType(name); + public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException { + Class type = getType(name); return (targetType == null || (type != null && targetType.isAssignableFrom(type))); } @@ -196,7 +196,7 @@ private T doGetSingleton(String name, Class requiredType) throws NamingEx } } - private Class doGetType(String name) throws NamingException { + private Class doGetType(String name) throws NamingException { if (isSingleton(name)) { Object jndiObject = doGetSingleton(name, null); return (jndiObject != null ? jndiObject.getClass() : null); @@ -208,7 +208,7 @@ private Class doGetType(String name) throws NamingException { } else { Object jndiObject = lookup(name, null); - Class type = (jndiObject != null ? jndiObject.getClass() : null); + Class type = (jndiObject != null ? jndiObject.getClass() : null); this.resourceTypes.put(name, type); return type; } diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java b/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java index c43095b0cbcb..1c75330938f2 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/CodebaseAwareObjectInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ public CodebaseAwareObjectInputStream( @Override - protected Class resolveFallbackIfPossible(String className, ClassNotFoundException ex) + protected Class resolveFallbackIfPossible(String className, ClassNotFoundException ex) throws IOException, ClassNotFoundException { // If codebaseUrl is set, try to load the class with the RMIClassLoader. diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiClientInterceptor.java b/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiClientInterceptor.java index 9c4373f12592..52d8da73f43d 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiClientInterceptor.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ */ public class JndiRmiClientInterceptor extends JndiObjectLocator implements MethodInterceptor, InitializingBean { - private Class serviceInterface; + private Class serviceInterface; private RemoteInvocationFactory remoteInvocationFactory = new DefaultRemoteInvocationFactory(); @@ -99,7 +99,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho *

    Typically required to be able to create a suitable service proxy, * but can also be optional if the lookup returns a typed stub. */ - public void setServiceInterface(Class serviceInterface) { + public void setServiceInterface(Class serviceInterface) { if (serviceInterface != null && !serviceInterface.isInterface()) { throw new IllegalArgumentException("'serviceInterface' must be an interface"); } @@ -109,7 +109,7 @@ public void setServiceInterface(Class serviceInterface) { /** * Return the interface of the service to access. */ - public Class getServiceInterface() { + public Class getServiceInterface() { return this.serviceInterface; } @@ -190,8 +190,8 @@ public void prepare() throws RemoteLookupFailureException { else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + - "] for JNDI RMI object [" + getJndiName() + "] - " + - (!isImpl ? "not " : "") + "directly implemented"); + "] for JNDI RMI object [" + getJndiName() + "] - " + + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { @@ -426,7 +426,7 @@ else if (targetEx instanceof SystemException) { * @see org.springframework.remoting.support.RemoteInvocation */ protected Object doInvoke(MethodInvocation methodInvocation, RmiInvocationHandler invocationHandler) - throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { + throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (AopUtils.isToStringMethod(methodInvocation.getMethod())) { return "RMI invoker proxy for service URL [" + getJndiName() + "]"; diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiProxyFactoryBean.java b/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiProxyFactoryBean.java index 0e718d72b3a9..fb8ced622643 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiProxyFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/JndiRmiProxyFactoryBean.java @@ -25,7 +25,7 @@ /** * {@link FactoryBean} for RMI proxies from JNDI. - * + * *

    Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects * (for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup, * this accessor also performs narrowing through {@link javax.rmi.PortableRemoteObject}. diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptor.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptor.java index f3d08416b3e0..8c3019673656 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptor.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -152,8 +152,8 @@ public void prepare() throws RemoteLookupFailureException { else if (getServiceInterface() != null) { boolean isImpl = getServiceInterface().isInstance(remoteObj); logger.debug("Using service interface [" + getServiceInterface().getName() + - "] for RMI stub [" + getServiceUrl() + "] - " + - (!isImpl ? "not " : "") + "directly implemented"); + "] for RMI stub [" + getServiceUrl() + "] - " + + (!isImpl ? "not " : "") + "directly implemented"); } } if (this.cacheStub) { @@ -345,7 +345,7 @@ protected Object doInvoke(MethodInvocation invocation, Remote stub) throws Throw } catch (RemoteException ex) { throw RmiClientInterceptorUtils.convertRmiAccessException( - invocation.getMethod(), ex, isConnectFailure(ex), getServiceUrl()); + invocation.getMethod(), ex, isConnectFailure(ex), getServiceUrl()); } catch (InvocationTargetException ex) { Throwable exToThrow = ex.getTargetException(); @@ -389,7 +389,7 @@ protected Object doInvoke(MethodInvocation invocation, Remote stub) throws Throw * @see org.springframework.remoting.support.RemoteInvocation */ protected Object doInvoke(MethodInvocation methodInvocation, RmiInvocationHandler invocationHandler) - throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { + throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (AopUtils.isToStringMethod(methodInvocation.getMethod())) { return "RMI invoker proxy for service URL [" + getServiceUrl() + "]"; diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptorUtils.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptorUtils.java index 79407ccdc99c..aae4cd0363f8 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptorUtils.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiClientInterceptorUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationHandler.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationHandler.java index 0849cd8fe89d..2772db246e03 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationHandler.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,6 @@ public interface RmiInvocationHandler extends Remote { * @throws InvocationTargetException if the method invocation resulted in an exception */ public Object invoke(RemoteInvocation invocation) - throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; + throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; } diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationWrapper.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationWrapper.java index 299f5cc6fbab..eec8eb96fa4d 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationWrapper.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiInvocationWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public RmiInvocationWrapper(Object wrappedObject, RmiBasedExporter rmiExporter) * @see RmiBasedExporter#getServiceInterface() */ public String getTargetInterfaceName() { - Class ifc = this.rmiExporter.getServiceInterface(); + Class ifc = this.rmiExporter.getServiceInterface(); return (ifc != null ? ifc.getName() : null); } @@ -67,7 +67,7 @@ public String getTargetInterfaceName() { * @see RmiBasedExporter#invoke(org.springframework.remoting.support.RemoteInvocation, Object) */ public Object invoke(RemoteInvocation invocation) - throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { + throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { return this.rmiExporter.invoke(invocation, this.wrappedObject); } diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiRegistryFactoryBean.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiRegistryFactoryBean.java index 1d400adffb1b..3509deaec342 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiRegistryFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiRegistryFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java index 299f577a5e44..306f98c841d0 100644 --- a/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java +++ b/spring-context/src/main/java/org/springframework/remoting/rmi/RmiServiceExporter.java @@ -456,4 +456,4 @@ private void unexportObjectSilently() { } } } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteAccessor.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteAccessor.java index b69f61cf1d97..3ca9166ca0db 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteAccessor.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,8 +36,7 @@ */ public abstract class RemoteAccessor extends RemotingSupport { - private Class serviceInterface; - + private Class serviceInterface; /** * Set the interface of the service to access. @@ -45,7 +44,7 @@ public abstract class RemoteAccessor extends RemotingSupport { *

    Typically required to be able to create a suitable service proxy, * but can also be optional if the lookup returns a typed proxy. */ - public void setServiceInterface(Class serviceInterface) { + public void setServiceInterface(Class serviceInterface) { if (serviceInterface != null && !serviceInterface.isInterface()) { throw new IllegalArgumentException("'serviceInterface' must be an interface"); } @@ -55,7 +54,7 @@ public void setServiceInterface(Class serviceInterface) { /** * Return the interface of the service to access. */ - public Class getServiceInterface() { + public Class getServiceInterface() { return this.serviceInterface; } diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteExporter.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteExporter.java index 79c7bda8c36d..370f4992c934 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteExporter.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public abstract class RemoteExporter extends RemotingSupport { private Object service; - private Class serviceInterface; + private Class serviceInterface; private Boolean registerTraceInterceptor; @@ -62,7 +62,7 @@ public Object getService() { * Set the interface of the service to export. * The interface must be suitable for the particular service and remoting strategy. */ - public void setServiceInterface(Class serviceInterface) { + public void setServiceInterface(Class serviceInterface) { if (serviceInterface != null && !serviceInterface.isInterface()) { throw new IllegalArgumentException("'serviceInterface' must be an interface"); } @@ -72,7 +72,7 @@ public void setServiceInterface(Class serviceInterface) { /** * Return the interface of the service to export. */ - public Class getServiceInterface() { + public Class getServiceInterface() { return this.serviceInterface; } @@ -122,7 +122,7 @@ protected void checkService() throws IllegalArgumentException { * @see #setService */ protected void checkServiceInterface() throws IllegalArgumentException { - Class serviceInterface = getServiceInterface(); + Class serviceInterface = getServiceInterface(); Object service = getService(); if (serviceInterface == null) { throw new IllegalArgumentException("Property 'serviceInterface' is required"); diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java index 491cddbcd513..f70752b21ff7 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public class RemoteInvocation implements Serializable { private String methodName; - private Class[] parameterTypes; + private Class[] parameterTypes; private Object[] arguments; @@ -70,7 +70,7 @@ public RemoteInvocation() { * @param parameterTypes the parameter types of the method * @param arguments the arguments for the invocation */ - public RemoteInvocation(String methodName, Class[] parameterTypes, Object[] arguments) { + public RemoteInvocation(String methodName, Class[] parameterTypes, Object[] arguments) { this.methodName = methodName; this.parameterTypes = parameterTypes; this.arguments = arguments; @@ -104,14 +104,14 @@ public String getMethodName() { /** * Set the parameter types of the target method. */ - public void setParameterTypes(Class[] parameterTypes) { + public void setParameterTypes(Class[] parameterTypes) { this.parameterTypes = parameterTypes; } /** * Return the parameter types of the target method. */ - public Class[] getParameterTypes() { + public Class[] getParameterTypes() { return this.parameterTypes; } diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationTraceInterceptor.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationTraceInterceptor.java index d66fe1228d70..f7a1599c81ab 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationTraceInterceptor.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationTraceInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationUtils.java b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationUtils.java index 7eb5c58c399c..e4a88cd25ba7 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationUtils.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemoteInvocationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ import java.util.HashSet; import java.util.Set; -import org.springframework.core.JdkVersion; - /** * General utilities for handling remote invocations. - * + * *

    Mainly intended for use within the remoting framework. * * @author Juergen Hoeller diff --git a/spring-context/src/main/java/org/springframework/remoting/support/RemotingSupport.java b/spring-context/src/main/java/org/springframework/remoting/support/RemotingSupport.java index 3d727eb43718..06daf2066eb3 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/RemotingSupport.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/RemotingSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java b/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java index 192d5e3fe6ae..69f4ebe82147 100644 --- a/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/remoting/support/SimpleHttpServerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java index dea788ce088a..d54eb344a2d3 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java @@ -50,8 +50,8 @@ /** * A cron-like expression, extending the usual UN*X definition to include * triggers on the second as well as minute, hour, day of month, month - * and day of week. e.g. {@code "0 * * * * MON-FRI"} means once per minute on - * weekdays (at the top of the minute - the 0th second). + * and day of week. e.g. "0 * * * * MON-FRI" means once + * per minute on weekdays (at the top of the minute - the 0th second). * @return an expression that can be parsed to a cron schedule * @see org.springframework.scheduling.support.CronSequenceGenerator */ diff --git a/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutor.java index bd413530387f..e0c520b51068 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/CustomizableThreadFactory.java b/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/CustomizableThreadFactory.java index 43f86ee55d6f..5a4dfd8239ec 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/CustomizableThreadFactory.java +++ b/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/CustomizableThreadFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ThreadPoolTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ThreadPoolTaskExecutor.java index 4512536635c4..e67542e0f928 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ThreadPoolTaskExecutor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/backportconcurrent/ThreadPoolTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java index 0c6c821baa9d..43b9d5d35a27 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,8 @@ import java.util.concurrent.Callable; import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.RejectedExecutionException; - -import org.springframework.core.task.TaskRejectedException; import org.springframework.core.task.support.TaskExecutorAdapter; import org.springframework.scheduling.SchedulingTaskExecutor; diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorConfigurationSupport.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorConfigurationSupport.java index 56bbca108fff..5e17458dc434 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorConfigurationSupport.java +++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorConfigurationSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ReschedulingRunnable.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ReschedulingRunnable.java index fba41f0778b8..a7f90b3794a7 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ReschedulingRunnable.java +++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ReschedulingRunnable.java @@ -49,7 +49,7 @@ class ReschedulingRunnable extends DelegatingErrorHandlingRunnable implements Sc private final ScheduledExecutorService executor; - private ScheduledFuture currentFuture; + private volatile ScheduledFuture currentFuture; private Date scheduledExecutionTime; @@ -63,7 +63,7 @@ public ReschedulingRunnable(Runnable delegate, Trigger trigger, ScheduledExecuto } - public ScheduledFuture schedule() { + public ScheduledFuture schedule() { synchronized (this.triggerContextMonitor) { this.scheduledExecutionTime = this.trigger.nextExecutionTime(this.triggerContext); if (this.scheduledExecutionTime == null) { diff --git a/spring-context/src/main/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParser.java index db440ed6ed24..39b86694d23d 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ /** * Parser for the 'annotation-driven' element of the 'task' namespace. - * + * * @author Mark Fisher * @author Juergen Hoeller * @author Ramnivas Laddad diff --git a/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java index 1448b3e4aa89..91d0bdaa10d2 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParser.java index 828528afab48..5e11bdcd5f35 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParser.java @@ -30,7 +30,7 @@ /** * Parser for the 'scheduled-tasks' element of the scheduling namespace. - * + * * @author Mark Fisher * @author Chris Beams * @since 3.0 @@ -74,6 +74,9 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit continue; } + RuntimeBeanReference runnableBeanRef = new RuntimeBeanReference( + createRunnableBean(ref, method, taskElement, parserContext)); + String cronAttribute = taskElement.getAttribute("cron"); String fixedDelayAttribute = taskElement.getAttribute("fixed-delay"); String fixedRateAttribute = taskElement.getAttribute("fixed-rate"); diff --git a/spring-context/src/main/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParser.java index dba85fca505d..7f76bfc83073 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ /** * Parser for the 'scheduler' element of the 'task' namespace. - * + * * @author Mark Fisher * @since 3.0 */ diff --git a/spring-context/src/main/java/org/springframework/scheduling/config/TaskNamespaceHandler.java b/spring-context/src/main/java/org/springframework/scheduling/config/TaskNamespaceHandler.java index b4c356da64b4..ee08a4c97748 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/config/TaskNamespaceHandler.java +++ b/spring-context/src/main/java/org/springframework/scheduling/config/TaskNamespaceHandler.java @@ -19,8 +19,8 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** - * NamespaceHandler for the 'task' namespace. - * + * NamespaceHandler for the 'task' namespace. + * * @author Mark Fisher * @since 3.0 */ diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java b/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java index b1753f927576..3f5459e61e8b 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java @@ -104,7 +104,7 @@ public Date next(Date date) { 4 If hour matches move on, otherwise find the next match 4.1 If next match is in the next day then roll forwards, 4.2 Reset the minutes and seconds and go to 2 - + ... */ diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java b/spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java index f23b327cf805..09df2374daa2 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java @@ -86,7 +86,7 @@ public boolean equals(Object obj) { public int hashCode() { return this.sequenceGenerator.hashCode(); } - + @Override public String toString() { return sequenceGenerator.toString(); diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java b/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java index 142b832e3ce0..3615f8b31fb1 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/MethodInvokingRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public void setBeanClassLoader(ClassLoader classLoader) { } @Override - protected Class resolveClassName(String className) throws ClassNotFoundException { + protected Class resolveClassName(String className) throws ClassNotFoundException { return ClassUtils.forName(className, this.beanClassLoader); } diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java b/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java index fe45ac212120..91a5b42e551c 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/PeriodicTrigger.java @@ -39,7 +39,7 @@ * within components that rely on the Trigger abstraction. For example, it may * be convenient to allow periodic triggers, cron-based triggers, and even * custom Trigger implementations to be used interchangeably. - * + * * @author Mark Fisher * @since 3.0 */ @@ -76,7 +76,7 @@ public PeriodicTrigger(long period, TimeUnit timeUnit) { /** * Specify the delay for the initial execution. It will be evaluated in * terms of this trigger's {@link TimeUnit}. If no time unit was explicitly - * provided upon instantiation, the default is milliseconds. + * provided upon instantiation, the default is milliseconds. */ public void setInitialDelay(long initialDelay) { this.initialDelay = this.timeUnit.toMillis(initialDelay); @@ -122,7 +122,7 @@ public boolean equals(Object obj) { public int hashCode() { return (this.fixedRate ? 17 : 29) + (int) (37 * this.period) + - (int) (41 * this.initialDelay); + (int) (41 * this.initialDelay); } } diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/TaskUtils.java b/spring-context/src/main/java/org/springframework/scheduling/support/TaskUtils.java index 2d0dcdbed6a0..81c16bc9a5b4 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/TaskUtils.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/TaskUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ * implementations. It is only public so that it may be accessed from * implementations within other packages. It is not intended for general * use and may change in the future. - * + * * @author Mark Fisher * @since 3.0 */ diff --git a/spring-context/src/main/java/org/springframework/scheduling/timer/DelegatingTimerTask.java b/spring-context/src/main/java/org/springframework/scheduling/timer/DelegatingTimerTask.java index 68880c17961b..920f137c6262 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/timer/DelegatingTimerTask.java +++ b/spring-context/src/main/java/org/springframework/scheduling/timer/DelegatingTimerTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/timer/TimerFactoryBean.java b/spring-context/src/main/java/org/springframework/scheduling/timer/TimerFactoryBean.java index 38c4f8c23a05..5e39717a6eb8 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/timer/TimerFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/scheduling/timer/TimerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scheduling/timer/TimerTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/timer/TimerTaskExecutor.java index 9603e95c3d39..70e87341c72e 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/timer/TimerTaskExecutor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/timer/TimerTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/scripting/ScriptFactory.java b/spring-context/src/main/java/org/springframework/scripting/ScriptFactory.java index e775f3035db9..59e5829205c2 100644 --- a/spring-context/src/main/java/org/springframework/scripting/ScriptFactory.java +++ b/spring-context/src/main/java/org/springframework/scripting/ScriptFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public interface ScriptFactory { * its Java interfaces (such as in the case of Groovy). * @return the interfaces for the script */ - Class[] getScriptInterfaces(); + Class[] getScriptInterfaces(); /** * Return whether the script requires a config interface to be @@ -75,7 +75,7 @@ public interface ScriptFactory { * @throws IOException if script retrieval failed * @throws ScriptCompilationException if script compilation failed */ - Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) + Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) throws IOException, ScriptCompilationException; /** @@ -91,7 +91,7 @@ Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) * @throws ScriptCompilationException if script compilation failed * @since 2.0.3 */ - Class getScriptedObjectType(ScriptSource scriptSource) + Class getScriptedObjectType(ScriptSource scriptSource) throws IOException, ScriptCompilationException; /** diff --git a/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptFactory.java b/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptFactory.java index 48dbbb8cb08b..5e123842d2d3 100644 --- a/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptFactory.java +++ b/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,11 +45,11 @@ public class BshScriptFactory implements ScriptFactory, BeanClassLoaderAware { private final String scriptSourceLocator; - private final Class[] scriptInterfaces; + private final Class[] scriptInterfaces; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); - private Class scriptClass; + private Class scriptClass; private final Object scriptClassMonitor = new Object(); @@ -78,7 +78,7 @@ public BshScriptFactory(String scriptSourceLocator) { * @param scriptInterfaces the Java interfaces that the scripted object * is supposed to implement (may be null) */ - public BshScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) { + public BshScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) { Assert.hasText(scriptSourceLocator, "'scriptSourceLocator' must not be empty"); this.scriptSourceLocator = scriptSourceLocator; this.scriptInterfaces = scriptInterfaces; @@ -93,7 +93,7 @@ public String getScriptSourceLocator() { return this.scriptSourceLocator; } - public Class[] getScriptInterfaces() { + public Class[] getScriptInterfaces() { return this.scriptInterfaces; } @@ -108,11 +108,11 @@ public boolean requiresConfigInterface() { * Load and parse the BeanShell script via {@link BshScriptUtils}. * @see BshScriptUtils#createBshObject(String, Class[], ClassLoader) */ - public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) + public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) throws IOException, ScriptCompilationException { try { - Class clazz = null; + Class clazz = null; synchronized (this.scriptClassMonitor) { boolean requiresScriptEvaluation = (this.wasModifiedForTypeCheck && this.scriptClass == null); @@ -125,7 +125,7 @@ public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfa if (result instanceof Class) { // A Class: We'll cache the Class here and create an instance // outside of the synchronized block. - this.scriptClass = (Class) result; + this.scriptClass = (Class) result; } else { // Not a Class: OK, we'll simply create BeanShell objects @@ -159,7 +159,7 @@ public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfa } } - public Class getScriptedObjectType(ScriptSource scriptSource) + public Class getScriptedObjectType(ScriptSource scriptSource) throws IOException, ScriptCompilationException { try { diff --git a/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java b/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java index 395f427eb3eb..04b6c66896f1 100644 --- a/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java +++ b/spring-context/src/main/java/org/springframework/scripting/bsh/BshScriptUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public static Object createBshObject(String scriptSource) throws EvalError { * @throws EvalError in case of BeanShell parsing failure * @see #createBshObject(String, Class[], ClassLoader) */ - public static Object createBshObject(String scriptSource, Class[] scriptInterfaces) throws EvalError { + public static Object createBshObject(String scriptSource, Class[] scriptInterfaces) throws EvalError { return createBshObject(scriptSource, scriptInterfaces, ClassUtils.getDefaultClassLoader()); } @@ -84,12 +84,12 @@ public static Object createBshObject(String scriptSource, Class[] scriptInterfac * @return the scripted Java object * @throws EvalError in case of BeanShell parsing failure */ - public static Object createBshObject(String scriptSource, Class[] scriptInterfaces, ClassLoader classLoader) + public static Object createBshObject(String scriptSource, Class[] scriptInterfaces, ClassLoader classLoader) throws EvalError { Object result = evaluateBshScript(scriptSource, scriptInterfaces, classLoader); if (result instanceof Class) { - Class clazz = (Class) result; + Class clazz = (Class) result; try { return clazz.newInstance(); } @@ -113,12 +113,12 @@ public static Object createBshObject(String scriptSource, Class[] scriptInterfac * @return the scripted Java class, or null if none could be determined * @throws EvalError in case of BeanShell parsing failure */ - static Class determineBshObjectType(String scriptSource) throws EvalError { + static Class determineBshObjectType(String scriptSource) throws EvalError { Assert.hasText(scriptSource, "Script source must not be empty"); Interpreter interpreter = new Interpreter(); Object result = interpreter.eval(scriptSource); if (result instanceof Class) { - return (Class) result; + return (Class) result; } else if (result != null) { return result.getClass(); @@ -143,7 +143,7 @@ else if (result != null) { * @return the scripted Java class or Java object * @throws EvalError in case of BeanShell parsing failure */ - static Object evaluateBshScript(String scriptSource, Class[] scriptInterfaces, ClassLoader classLoader) + static Object evaluateBshScript(String scriptSource, Class[] scriptInterfaces, ClassLoader classLoader) throws EvalError { Assert.hasText(scriptSource, "Script source must not be empty"); diff --git a/spring-context/src/main/java/org/springframework/scripting/config/LangNamespaceHandler.java b/spring-context/src/main/java/org/springframework/scripting/config/LangNamespaceHandler.java index 6c826fc14126..b222d23f16a3 100644 --- a/spring-context/src/main/java/org/springframework/scripting/config/LangNamespaceHandler.java +++ b/spring-context/src/main/java/org/springframework/scripting/config/LangNamespaceHandler.java @@ -23,7 +23,7 @@ * objects backed by dynamic languages such as Groovy, JRuby and * BeanShell. The following is an example (from the reference * documentation) that details the wiring of a Groovy backed bean: - * + * *

      * <lang:groovy id="messenger"
      *     refresh-check-delay="5000"
    @@ -31,7 +31,7 @@
      * <lang:property name="message" value="I Can Do The Frug"/>
      * </lang:groovy>
      * 
    - * + * * @author Rob Harrop * @author Juergen Hoeller * @author Mark Fisher diff --git a/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java index 487cd066bf39..ef658494ebe5 100644 --- a/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,8 @@ public ScriptBeanDefinitionParser(String scriptFactoryClassName) { * Parses the dynamic object element and returns the resulting bean definition. * Registers a {@link ScriptFactoryPostProcessor} if needed. */ - @Override + @SuppressWarnings("deprecation") + @Override protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { // Resolve the script source. String value = resolveScriptSource(element, parserContext.getReaderContext()); @@ -114,7 +115,7 @@ protected AbstractBeanDefinition parseInternal(Element element, ParserContext pa bd.setBeanClassName(this.scriptFactoryClassName); bd.setSource(parserContext.extractSource(element)); bd.setAttribute(ScriptFactoryPostProcessor.LANGUAGE_ATTRIBUTE, element.getLocalName()); - + // Determine bean scope. String scope = element.getAttribute(SCOPE_ATTRIBUTE); if (StringUtils.hasLength(scope)) { @@ -202,7 +203,7 @@ else if (beanDefinitionDefaults.getDestroyMethodName() != null) { */ private String resolveScriptSource(Element element, XmlReaderContext readerContext) { boolean hasScriptSource = element.hasAttribute(SCRIPT_SOURCE_ATTRIBUTE); - List elements = DomUtils.getChildElementsByTagName(element, INLINE_SCRIPT_ELEMENT); + List elements = DomUtils.getChildElementsByTagName(element, INLINE_SCRIPT_ELEMENT); if (hasScriptSource && !elements.isEmpty()) { readerContext.error("Only one of 'script-source' and 'inline-script' should be specified.", element); return null; @@ -211,7 +212,7 @@ else if (hasScriptSource) { return element.getAttribute(SCRIPT_SOURCE_ATTRIBUTE); } else if (!elements.isEmpty()) { - Element inlineElement = (Element) elements.get(0); + Element inlineElement = elements.get(0); return "inline:" + DomUtils.getTextValue(inlineElement); } else { diff --git a/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java b/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java index 8f91d49083cb..d0766b95f40d 100644 --- a/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java +++ b/spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public class ScriptingDefaultsParser implements BeanDefinitionParser { public BeanDefinition parse(Element element, ParserContext parserContext) { - BeanDefinition bd = + BeanDefinition bd = LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry()); String refreshCheckDelay = element.getAttribute(REFRESH_CHECK_DELAY_ATTRIBUTE); if (StringUtils.hasText(refreshCheckDelay)) { diff --git a/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java b/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java index e94152011b79..136cf61cc37b 100644 --- a/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java +++ b/spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,14 +53,14 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, BeanClassLoaderAware { private final String scriptSourceLocator; - + private final GroovyObjectCustomizer groovyObjectCustomizer; private GroovyClassLoader groovyClassLoader; - private Class scriptClass; + private Class scriptClass; - private Class scriptResultClass; + private Class scriptResultClass; private CachedResultHolder cachedResult; @@ -131,7 +131,7 @@ public String getScriptSourceLocator() { * hence we don't need to explicitly expose interfaces here. * @return null always */ - public Class[] getScriptInterfaces() { + public Class[] getScriptInterfaces() { return null; } @@ -148,11 +148,11 @@ public boolean requiresConfigInterface() { * Loads and parses the Groovy script via the GroovyClassLoader. * @see groovy.lang.GroovyClassLoader */ - public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) + public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) throws IOException, ScriptCompilationException { try { - Class scriptClassToExecute = null; + Class scriptClassToExecute = null; synchronized (this.scriptClassMonitor) { this.wasModifiedForTypeCheck = false; @@ -189,7 +189,7 @@ public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfa } } - public Class getScriptedObjectType(ScriptSource scriptSource) + public Class getScriptedObjectType(ScriptSource scriptSource) throws IOException, ScriptCompilationException { try { @@ -233,7 +233,7 @@ public boolean requiresScriptedObjectRefresh(ScriptSource scriptSource) { * or the result of running the script instance) * @throws ScriptCompilationException in case of instantiation failure */ - protected Object executeScript(ScriptSource scriptSource, Class scriptClass) throws ScriptCompilationException { + protected Object executeScript(ScriptSource scriptSource, Class scriptClass) throws ScriptCompilationException { try { GroovyObject goo = (GroovyObject) scriptClass.newInstance(); diff --git a/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptFactory.java b/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptFactory.java index 3611f04e5c3e..f83b36fbc064 100644 --- a/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptFactory.java +++ b/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public class JRubyScriptFactory implements ScriptFactory, BeanClassLoaderAware { private final String scriptSourceLocator; - private final Class[] scriptInterfaces; + private final Class[] scriptInterfaces; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -59,7 +59,7 @@ public class JRubyScriptFactory implements ScriptFactory, BeanClassLoaderAware { * @param scriptInterfaces the Java interfaces that the scripted object * is supposed to implement */ - public JRubyScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) { + public JRubyScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) { Assert.hasText(scriptSourceLocator, "'scriptSourceLocator' must not be empty"); Assert.notEmpty(scriptInterfaces, "'scriptInterfaces' must not be empty"); this.scriptSourceLocator = scriptSourceLocator; @@ -76,7 +76,7 @@ public String getScriptSourceLocator() { return this.scriptSourceLocator; } - public Class[] getScriptInterfaces() { + public Class[] getScriptInterfaces() { return this.scriptInterfaces; } @@ -91,7 +91,7 @@ public boolean requiresConfigInterface() { * Load and parse the JRuby script via JRubyScriptUtils. * @see JRubyScriptUtils#createJRubyObject(String, Class[], ClassLoader) */ - public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) + public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfaces) throws IOException, ScriptCompilationException { try { return JRubyScriptUtils.createJRubyObject( @@ -108,9 +108,8 @@ public Object getScriptedObject(ScriptSource scriptSource, Class[] actualInterfa } } - public Class getScriptedObjectType(ScriptSource scriptSource) + public Class getScriptedObjectType(ScriptSource scriptSource) throws IOException, ScriptCompilationException { - return null; } diff --git a/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java b/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java index bf916f35f056..91c9be45a54f 100644 --- a/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java +++ b/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public abstract class JRubyScriptUtils { * @throws JumpException in case of JRuby parsing failure * @see ClassUtils#getDefaultClassLoader() */ - public static Object createJRubyObject(String scriptSource, Class[] interfaces) throws JumpException { + public static Object createJRubyObject(String scriptSource, Class[] interfaces) throws JumpException { return createJRubyObject(scriptSource, interfaces, ClassUtils.getDefaultClassLoader()); } @@ -75,12 +75,13 @@ public static Object createJRubyObject(String scriptSource, Class[] interfaces) * @return the scripted Java object * @throws JumpException in case of JRuby parsing failure */ - public static Object createJRubyObject(String scriptSource, Class[] interfaces, ClassLoader classLoader) { + public static Object createJRubyObject(String scriptSource, Class[] interfaces, ClassLoader classLoader) { Ruby ruby = initializeRuntime(); Node scriptRootNode = ruby.parseEval(scriptSource, "", null, 0); // keep using the deprecated runNormally variant for JRuby 1.1/1.2 compatibility... - IRubyObject rubyObject = ruby.runNormally(scriptRootNode, false); + @SuppressWarnings("deprecation") + IRubyObject rubyObject = ruby.runNormally(scriptRootNode, false); if (rubyObject instanceof RubyNil) { String className = findClassName(scriptRootNode); @@ -206,7 +207,7 @@ private IRubyObject[] convertToRuby(Object[] javaArgs) { return rubyArgs; } - private Object convertFromRuby(IRubyObject rubyResult, Class returnType) { + private Object convertFromRuby(IRubyObject rubyResult, Class returnType) { Object result = JavaEmbedUtils.rubyToJava(this.ruby, rubyResult, returnType); if (result instanceof RubyArray && returnType.isArray()) { result = convertFromRubyArray(((RubyArray) result).toJavaArray(), returnType); @@ -214,8 +215,8 @@ private Object convertFromRuby(IRubyObject rubyResult, Class returnType) { return result; } - private Object convertFromRubyArray(IRubyObject[] rubyArray, Class returnType) { - Class targetType = returnType.getComponentType(); + private Object convertFromRubyArray(IRubyObject[] rubyArray, Class returnType) { + Class targetType = returnType.getComponentType(); Object javaArray = Array.newInstance(targetType, rubyArray.length); for (int i = 0; i < rubyArray.length; i++) { IRubyObject rubyObject = rubyArray[i]; diff --git a/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java b/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java index 13ab4dc9075f..af3c695a3be2 100644 --- a/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java +++ b/spring-context/src/main/java/org/springframework/scripting/support/ResourceScriptSource.java @@ -115,7 +115,7 @@ public String suggestedClassName() { /** * Sets the encoding used for reading the script resource. The default value is "UTF-8". * A null value, implies the platform default. - * + * * @param encoding charset encoding used for reading the script. */ public void setEncoding(String encoding) { @@ -126,4 +126,4 @@ public void setEncoding(String encoding) { public String toString() { return this.resource.toString(); } -} \ No newline at end of file +} diff --git a/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java b/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java index 90626e55435d..344965d8dbc3 100644 --- a/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java @@ -193,7 +193,7 @@ public void setDefaultRefreshCheckDelay(long defaultRefreshCheckDelay) { } /** - * Flag to signal that refreshable proxies should be created to proxy the target class not its interfaces. + * Flag to signal that refreshable proxies should be created to proxy the target class not its interfaces. * @param defaultProxyTargetClass the flag value to set */ public void setDefaultProxyTargetClass(boolean defaultProxyTargetClass) { @@ -235,7 +235,7 @@ public int getOrder() { } @Override - public Class predictBeanType(Class beanClass, String beanName) { + public Class predictBeanType(Class beanClass, String beanName) { // We only apply special treatment to ScriptFactory implementations here. if (!ScriptFactory.class.isAssignableFrom(beanClass)) { return null; @@ -250,9 +250,9 @@ public Class predictBeanType(Class beanClass, String beanName) { ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); - Class[] interfaces = scriptFactory.getScriptInterfaces(); + Class[] interfaces = scriptFactory.getScriptInterfaces(); - Class scriptedType = scriptFactory.getScriptedObjectType(scriptSource); + Class scriptedType = scriptFactory.getScriptedObjectType(scriptSource); if (scriptedType != null) { return scriptedType; } else if (!ObjectUtils.isEmpty(interfaces)) { @@ -283,7 +283,7 @@ public Class predictBeanType(Class beanClass, String beanName) { } @Override - public Object postProcessBeforeInstantiation(Class beanClass, String beanName) { + public Object postProcessBeforeInstantiation(Class beanClass, String beanName) { // We only apply special treatment to ScriptFactory implementations here. if (!ScriptFactory.class.isAssignableFrom(beanClass)) { return null; @@ -298,7 +298,7 @@ public Object postProcessBeforeInstantiation(Class beanClass, String beanName) { ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); boolean isFactoryBean = false; try { - Class scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource); + Class scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource); // Returned type may be null if the factory is unable to determine the type. if (scriptedObjectType != null) { isFactoryBean = FactoryBean.class.isAssignableFrom(scriptedObjectType); @@ -310,7 +310,7 @@ public Object postProcessBeforeInstantiation(Class beanClass, String beanName) { long refreshCheckDelay = resolveRefreshCheckDelay(bd); if (refreshCheckDelay >= 0) { - Class[] interfaces = scriptFactory.getScriptInterfaces(); + Class[] interfaces = scriptFactory.getScriptInterfaces(); RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory, scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean); boolean proxyTargetClass = resolveProxyTargetClass(bd); @@ -478,12 +478,12 @@ protected ScriptSource convertToScriptSource(String beanName, String scriptSourc * @see org.springframework.cglib.proxy.InterfaceMaker * @see org.springframework.beans.BeanUtils#findPropertyType */ - protected Class createConfigInterface(BeanDefinition bd, Class[] interfaces) { + protected Class createConfigInterface(BeanDefinition bd, Class[] interfaces) { InterfaceMaker maker = new InterfaceMaker(); PropertyValue[] pvs = bd.getPropertyValues().getPropertyValues(); for (PropertyValue pv : pvs) { String propertyName = pv.getName(); - Class propertyType = BeanUtils.findPropertyType(propertyName, interfaces); + Class propertyType = BeanUtils.findPropertyType(propertyName, interfaces); String setterName = "set" + StringUtils.capitalize(propertyName); Signature signature = new Signature(setterName, Type.VOID_TYPE, new Type[] { Type.getType(propertyType) }); maker.add(signature, new Type[0]); @@ -511,7 +511,7 @@ protected Class createConfigInterface(BeanDefinition bd, Class[] interfaces) { * @return the merged interface as Class * @see java.lang.reflect.Proxy#getProxyClass */ - protected Class createCompositeInterface(Class[] interfaces) { + protected Class createCompositeInterface(Class[] interfaces) { return ClassUtils.createCompositeInterface(interfaces, this.beanClassLoader); } @@ -527,7 +527,7 @@ protected Class createCompositeInterface(Class[] interfaces) { * @see org.springframework.scripting.ScriptFactory#getScriptedObject */ protected BeanDefinition createScriptedObjectBeanDefinition(BeanDefinition bd, String scriptFactoryBeanName, - ScriptSource scriptSource, Class[] interfaces) { + ScriptSource scriptSource, Class[] interfaces) { GenericBeanDefinition objectBd = new GenericBeanDefinition(bd); objectBd.setFactoryBeanName(scriptFactoryBeanName); @@ -546,7 +546,7 @@ protected BeanDefinition createScriptedObjectBeanDefinition(BeanDefinition bd, S * @return the generated proxy * @see RefreshableScriptTargetSource */ - protected Object createRefreshableProxy(TargetSource ts, Class[] interfaces, boolean proxyTargetClass) { + protected Object createRefreshableProxy(TargetSource ts, Class[] interfaces, boolean proxyTargetClass) { ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.setTargetSource(ts); ClassLoader classLoader = this.beanClassLoader; diff --git a/spring-context/src/main/java/org/springframework/stereotype/package-info.java b/spring-context/src/main/java/org/springframework/stereotype/package-info.java index ca9644652afb..420bb1909716 100644 --- a/spring-context/src/main/java/org/springframework/stereotype/package-info.java +++ b/spring-context/src/main/java/org/springframework/stereotype/package-info.java @@ -3,7 +3,7 @@ * * Annotations denoting the roles of types or methods in the overall architecture * (at a conceptual, rather than implementation, level). - * + * *

    Intended for use by tools and aspects (making an ideal target for pointcuts). * */ diff --git a/spring-context/src/main/java/org/springframework/ui/ModelMap.java b/spring-context/src/main/java/org/springframework/ui/ModelMap.java index d9dcdecc33d8..ddf6d1f0cc2e 100644 --- a/spring-context/src/main/java/org/springframework/ui/ModelMap.java +++ b/spring-context/src/main/java/org/springframework/ui/ModelMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ public ModelMap addAttribute(String attributeName, Object attributeValue) { */ public ModelMap addAttribute(Object attributeValue) { Assert.notNull(attributeValue, "Model object must not be null"); - if (attributeValue instanceof Collection && ((Collection) attributeValue).isEmpty()) { + if (attributeValue instanceof Collection && ((Collection) attributeValue).isEmpty()) { return this; } return addAttribute(Conventions.getVariableName(attributeValue), attributeValue); @@ -165,7 +165,7 @@ public ModelMap addObject(Object modelObject) { * @deprecated as of Spring 2.5, in favor of {@link #addAllAttributes(Collection)} */ @Deprecated - public ModelMap addAllObjects(Collection objects) { + public ModelMap addAllObjects(Collection objects) { return addAllAttributes(objects); } @@ -173,7 +173,7 @@ public ModelMap addAllObjects(Collection objects) { * @deprecated as of Spring 2.5, in favor of {@link #addAllAttributes(Map)} */ @Deprecated - public ModelMap addAllObjects(Map objects) { + public ModelMap addAllObjects(Map objects) { return addAllAttributes(objects); } diff --git a/spring-context/src/main/java/org/springframework/ui/context/HierarchicalThemeSource.java b/spring-context/src/main/java/org/springframework/ui/context/HierarchicalThemeSource.java index a67fc7f09a00..13c92582db86 100644 --- a/spring-context/src/main/java/org/springframework/ui/context/HierarchicalThemeSource.java +++ b/spring-context/src/main/java/org/springframework/ui/context/HierarchicalThemeSource.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/main/java/org/springframework/ui/context/package-info.java b/spring-context/src/main/java/org/springframework/ui/context/package-info.java index 0fae9ff8134c..a00d7c3fa09a 100644 --- a/spring-context/src/main/java/org/springframework/ui/context/package-info.java +++ b/spring-context/src/main/java/org/springframework/ui/context/package-info.java @@ -3,7 +3,7 @@ * * Contains classes defining the application context subinterface * for UI applications. The theme feature is added here. - * + * *

      *
    • If no UiApplicationContextUtils.THEME_SOURCE_BEAN_NAME * bean is available in the context or parent context, a default ResourceBundleThemeSource @@ -24,7 +24,7 @@ *
    • If messages in the resource bundles are in fact paths to resources(css, images, ...), make sure these resources * are directly available for the user and not, for example, under the WEB-INF directory.
    • *
    - * + * *
    Web packages add the resolution and the setting of the user current theme. * */ diff --git a/spring-context/src/main/java/org/springframework/ui/context/support/ResourceBundleThemeSource.java b/spring-context/src/main/java/org/springframework/ui/context/support/ResourceBundleThemeSource.java index 9ba069d9215b..36f402274bbf 100644 --- a/spring-context/src/main/java/org/springframework/ui/context/support/ResourceBundleThemeSource.java +++ b/spring-context/src/main/java/org/springframework/ui/context/support/ResourceBundleThemeSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/ui/context/support/UiApplicationContextUtils.java b/spring-context/src/main/java/org/springframework/ui/context/support/UiApplicationContextUtils.java index 3669b47574bf..fd27a49dfc75 100644 --- a/spring-context/src/main/java/org/springframework/ui/context/support/UiApplicationContextUtils.java +++ b/spring-context/src/main/java/org/springframework/ui/context/support/UiApplicationContextUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java b/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java index a2a82a122689..53311e519fdd 100644 --- a/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java +++ b/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java @@ -27,7 +27,7 @@ * Default implementation of the {@link Errors} and {@link BindingResult} * interfaces, for the registration and evaluation of binding errors on * JavaBean objects. - * + * *

    Performs standard JavaBean property access, also supporting nested * properties. Normally, application code will work with the * Errors interface or the BindingResult interface. diff --git a/spring-context/src/main/java/org/springframework/validation/Errors.java b/spring-context/src/main/java/org/springframework/validation/Errors.java index edd61ee7c59c..2a4f4ce26852 100644 --- a/spring-context/src/main/java/org/springframework/validation/Errors.java +++ b/spring-context/src/main/java/org/springframework/validation/Errors.java @@ -199,14 +199,14 @@ public interface Errors { /** * Are there any global errors? * @return true if there are any global errors - * @see #hasFieldErrors() + * @see #hasFieldErrors() */ boolean hasGlobalErrors(); /** * Return the number of global errors. * @return the number of global errors - * @see #getFieldErrorCount() + * @see #getFieldErrorCount() */ int getGlobalErrorCount(); @@ -225,14 +225,14 @@ public interface Errors { /** * Are there any field errors? * @return true if there are any errors associated with a field - * @see #hasGlobalErrors() + * @see #hasGlobalErrors() */ boolean hasFieldErrors(); /** * Return the number of errors associated with a field. * @return the number of errors associated with a field - * @see #getGlobalErrorCount() + * @see #getGlobalErrorCount() */ int getFieldErrorCount(); diff --git a/spring-context/src/main/java/org/springframework/validation/ObjectError.java b/spring-context/src/main/java/org/springframework/validation/ObjectError.java index b0398754db40..fb774d8496b7 100644 --- a/spring-context/src/main/java/org/springframework/validation/ObjectError.java +++ b/spring-context/src/main/java/org/springframework/validation/ObjectError.java @@ -22,7 +22,7 @@ /** * Encapsulates an object error, that is, a global reason for rejecting * an object. - * + * *

    See the {@link DefaultMessageCodesResolver} javadoc for details on * how a message code list is built for an ObjectError. * diff --git a/spring-context/src/main/java/org/springframework/validation/ValidationUtils.java b/spring-context/src/main/java/org/springframework/validation/ValidationUtils.java index e7867a7633af..b02fbcecb2f3 100644 --- a/spring-context/src/main/java/org/springframework/validation/ValidationUtils.java +++ b/spring-context/src/main/java/org/springframework/validation/ValidationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * Utility class offering convenient methods for invoking a {@link Validator} * and for rejecting empty fields. - * + * *

    Checks for an empty field in Validator implementations can become * one-liners when using {@link #rejectIfEmpty} or {@link #rejectIfEmptyOrWhitespace}. * @@ -52,7 +52,7 @@ public abstract class ValidationUtils { * the validation of the supplied object's type */ public static void invokeValidator(Validator validator, Object obj, Errors errors) { - invokeValidator(validator, obj, errors, (Class[]) null); + invokeValidator(validator, obj, errors, (Object[]) null); } /** @@ -96,7 +96,7 @@ public static void invokeValidator(Validator validator, Object obj, Errors error /** * Reject the given field with the given error code if the value is empty. *

    An 'empty' value in this context means either null or - * the empty string "". + * the empty string "". *

    The object whose field is being validated does not need to be passed * in because the {@link Errors} instance can resolve field values by itself * (it will usually hold an internal reference to the target object). @@ -112,7 +112,7 @@ public static void rejectIfEmpty(Errors errors, String field, String errorCode) * Reject the given field with the given error code and default message * if the value is empty. *

    An 'empty' value in this context means either null or - * the empty string "". + * the empty string "". *

    The object whose field is being validated does not need to be passed * in because the {@link Errors} instance can resolve field values by itself * (it will usually hold an internal reference to the target object). @@ -147,7 +147,7 @@ public static void rejectIfEmpty(Errors errors, String field, String errorCode, * Reject the given field with the given error code, error arguments * and default message if the value is empty. *

    An 'empty' value in this context means either null or - * the empty string "". + * the empty string "". *

    The object whose field is being validated does not need to be passed * in because the {@link Errors} instance can resolve field values by itself * (it will usually hold an internal reference to the target object). diff --git a/spring-context/src/main/java/org/springframework/validation/Validator.java b/spring-context/src/main/java/org/springframework/validation/Validator.java index c67c5ea8e9ef..671cd90bf6fd 100644 --- a/spring-context/src/main/java/org/springframework/validation/Validator.java +++ b/spring-context/src/main/java/org/springframework/validation/Validator.java @@ -34,13 +34,13 @@ * at least 'MINIMUM_PASSWORD_LENGTH' characters in length. * *

     public class UserLoginValidator implements Validator {
    - * 
    + *
      *    private static final int MINIMUM_PASSWORD_LENGTH = 6;
    - * 
    + *
      *    public boolean supports(Class clazz) {
      *       return UserLogin.class.isAssignableFrom(clazz);
      *    }
    - * 
    + *
      *    public void validate(Object target, Errors errors) {
      *       ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userName", "field.required");
      *       ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "field.required");
    @@ -56,7 +56,7 @@
      *
      * 

    See also the Spring reference manual for a fuller discussion of * the Validator interface and it's role in an enterprise - * application. + * application. * * @author Rod Johnson * @see Errors @@ -75,7 +75,7 @@ public interface Validator { * being asked if it can {@link #validate(Object, Errors) validate} * @return true if this {@link Validator} can indeed * {@link #validate(Object, Errors) validate} instances of the - * supplied clazz + * supplied clazz */ boolean supports(Class clazz); @@ -85,8 +85,8 @@ public interface Validator { * typically has (or would) return true. *

    The supplied {@link Errors errors} instance can be used to report * any resulting validation errors. - * @param target the object that is to be validated (can be null) - * @param errors contextual state about the validation process (never null) + * @param target the object that is to be validated (can be null) + * @param errors contextual state about the validation process (never null) * @see ValidationUtils */ void validate(Object target, Errors errors); diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessor.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessor.java index 899207cb5a7b..a886af7ec060 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocaleContextMessageInterpolator.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocaleContextMessageInterpolator.java index 06c897fc16ff..2bb8afdfaa80 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocaleContextMessageInterpolator.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocaleContextMessageInterpolator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/MessageSourceResourceBundleLocator.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/MessageSourceResourceBundleLocator.java index 83c538e38cdb..9b9dac21b5d9 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/MessageSourceResourceBundleLocator.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/MessageSourceResourceBundleLocator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java index 6e92e38fd990..c66f262f3601 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java @@ -84,7 +84,7 @@ public MethodValidationInterceptor(Validator validator) { public Object invoke(MethodInvocation invocation) throws Throwable { - Class[] groups = determineValidationGroups(invocation); + Class[] groups = determineValidationGroups(invocation); Set> result = this.validator.validateAllParameters( invocation.getThis(), invocation.getMethod(), invocation.getArguments(), groups); if (!result.isEmpty()) { @@ -106,7 +106,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { * @param invocation the current MethodInvocation * @return the applicable validation groups as a Class array */ - protected Class[] determineValidationGroups(MethodInvocation invocation) { + protected Class[] determineValidationGroups(MethodInvocation invocation) { Validated valid = AnnotationUtils.findAnnotation(invocation.getThis().getClass(), Validated.class); return (valid != null ? valid.value() : new Class[0]); } diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java index 0579acce6c08..d68c29f84242 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java @@ -91,11 +91,11 @@ public void validate(Object target, Errors errors) { @SuppressWarnings("rawtypes") public void validate(Object target, Errors errors, Object... validationHints) { - Set groups = new LinkedHashSet(); + Set> groups = new LinkedHashSet>(); if (validationHints != null) { for (Object hint : validationHints) { if (hint instanceof Class) { - groups.add((Class) hint); + groups.add((Class) hint); } } } diff --git a/spring-context/src/main/java/org/springframework/validation/support/BindingAwareModelMap.java b/spring-context/src/main/java/org/springframework/validation/support/BindingAwareModelMap.java index 4f6e20e318b4..fba5c0748b51 100644 --- a/spring-context/src/main/java/org/springframework/validation/support/BindingAwareModelMap.java +++ b/spring-context/src/main/java/org/springframework/validation/support/BindingAwareModelMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public Object put(String key, Object value) { @Override public void putAll(Map map) { - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { removeBindingResultIfNecessary(entry.getKey(), entry.getValue()); } super.putAll(map); diff --git a/spring-context/src/test/java/example/profilescan/DevComponent.java b/spring-context/src/test/java/example/profilescan/DevComponent.java index 5126e8dd6cf4..dc0cd20631a9 100644 --- a/spring-context/src/test/java/example/profilescan/DevComponent.java +++ b/spring-context/src/test/java/example/profilescan/DevComponent.java @@ -34,4 +34,4 @@ String value() default ""; -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/example/profilescan/ProfileMetaAnnotatedComponent.java b/spring-context/src/test/java/example/profilescan/ProfileMetaAnnotatedComponent.java index 68b9d2d639f1..d8eb3387e756 100644 --- a/spring-context/src/test/java/example/profilescan/ProfileMetaAnnotatedComponent.java +++ b/spring-context/src/test/java/example/profilescan/ProfileMetaAnnotatedComponent.java @@ -22,4 +22,4 @@ public class ProfileMetaAnnotatedComponent { public static final String BEAN_NAME = "profileMetaAnnotatedComponent"; -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/example/scannable/AutowiredQualifierFooService.java b/spring-context/src/test/java/example/scannable/AutowiredQualifierFooService.java index 2bdea2ecce8e..42e71891d8d9 100644 --- a/spring-context/src/test/java/example/scannable/AutowiredQualifierFooService.java +++ b/spring-context/src/test/java/example/scannable/AutowiredQualifierFooService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,8 @@ public class AutowiredQualifierFooService implements FooService { private boolean initCalled = false; - @PostConstruct + @SuppressWarnings("unused") + @PostConstruct private void init() { if (this.initCalled) { throw new IllegalStateException("Init already called"); diff --git a/spring-context/src/test/java/example/scannable/FooServiceImpl.java b/spring-context/src/test/java/example/scannable/FooServiceImpl.java index ef2b6094b314..0e9c03758906 100644 --- a/spring-context/src/test/java/example/scannable/FooServiceImpl.java +++ b/spring-context/src/test/java/example/scannable/FooServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/example/scannable/MessageBean.java b/spring-context/src/test/java/example/scannable/MessageBean.java index a1035f114fba..9a3311ac193e 100644 --- a/spring-context/src/test/java/example/scannable/MessageBean.java +++ b/spring-context/src/test/java/example/scannable/MessageBean.java @@ -23,7 +23,7 @@ public class MessageBean { private String message; - + public MessageBean() { this.message = "DEFAULT MESSAGE"; } @@ -31,7 +31,7 @@ public MessageBean() { public MessageBean(String message) { this.message = message; } - + public String getMessage() { return this.message; } diff --git a/spring-context/src/test/java/example/scannable/NamedComponent.java b/spring-context/src/test/java/example/scannable/NamedComponent.java index 1dead3490ddf..daa4b7b4da5b 100644 --- a/spring-context/src/test/java/example/scannable/NamedComponent.java +++ b/spring-context/src/test/java/example/scannable/NamedComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/example/scannable/ServiceInvocationCounter.java b/spring-context/src/test/java/example/scannable/ServiceInvocationCounter.java index 257a2d8bc526..410d865f21fc 100644 --- a/spring-context/src/test/java/example/scannable/ServiceInvocationCounter.java +++ b/spring-context/src/test/java/example/scannable/ServiceInvocationCounter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,10 +40,10 @@ public void serviceExecution() {} @Before("serviceExecution()") public void countUse() { this.useCount++; - this.threadLocalCount.set(this.useCount); + threadLocalCount.set(this.useCount); System.out.println(""); } - + public int getCount() { return this.useCount; } diff --git a/spring-context/src/test/java/example/scannable_scoped/MyScope.java b/spring-context/src/test/java/example/scannable_scoped/MyScope.java index 512740b90b45..096d43d4fd18 100644 --- a/spring-context/src/test/java/example/scannable_scoped/MyScope.java +++ b/spring-context/src/test/java/example/scannable_scoped/MyScope.java @@ -22,4 +22,4 @@ public @interface MyScope { String value() default BeanDefinition.SCOPE_SINGLETON; ScopedProxyMode proxyMode() default ScopedProxyMode.DEFAULT; -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java index 36a60c2c682a..47217e1afc42 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,9 +38,9 @@ public final class AfterAdviceBindingTests { private AdviceBindingCollaborator mockCollaborator; - + private ITestBean testBeanProxy; - + private TestBean testBeanTarget; @Before @@ -48,13 +48,13 @@ public void setUp() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); AdviceBindingTestAspect afterAdviceAspect = (AdviceBindingTestAspect) ctx.getBean("testAspect"); - + testBeanProxy = (ITestBean) ctx.getBean("testBean"); assertTrue(AopUtils.isAopProxy(testBeanProxy)); - + // we need the real target too, not just the proxy... testBeanTarget = (TestBean) ((Advised) testBeanProxy).getTargetSource().getTarget(); - + mockCollaborator = createNiceMock(AdviceBindingCollaborator.class); afterAdviceAspect.setCollaborator(mockCollaborator); } @@ -66,7 +66,7 @@ public void testOneIntArg() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testOneObjectArgBindingProxyWithThis() { mockCollaborator.oneObjectArg(this.testBeanProxy); @@ -74,7 +74,7 @@ public void testOneObjectArgBindingProxyWithThis() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testOneObjectArgBindingTarget() { mockCollaborator.oneObjectArg(this.testBeanTarget); @@ -82,7 +82,7 @@ public void testOneObjectArgBindingTarget() { testBeanProxy.getDoctor(); verify(mockCollaborator); } - + @Test public void testOneIntAndOneObjectArgs() { mockCollaborator.oneIntAndOneObject(5,this.testBeanProxy); @@ -90,7 +90,7 @@ public void testOneIntAndOneObjectArgs() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testNeedsJoinPoint() { mockCollaborator.needsJoinPoint("getAge"); @@ -98,7 +98,7 @@ public void testNeedsJoinPoint() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testNeedsJoinPointStaticPart() { mockCollaborator.needsJoinPointStaticPart("getAge"); @@ -106,5 +106,5 @@ public void testNeedsJoinPointStaticPart() { testBeanProxy.getAge(); verify(mockCollaborator); } - + } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java index a89b37711b53..82f9e4f33876 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterReturningAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public final class AfterReturningAdviceBindingTests { private TestBean testBeanTarget; private AfterReturningAdviceBindingCollaborator mockCollaborator; - + public void setAfterReturningAdviceAspect(AfterReturningAdviceBindingTestAspect anAspect) { this.afterAdviceAspect = anAspect; @@ -55,15 +55,15 @@ public void setAfterReturningAdviceAspect(AfterReturningAdviceBindingTestAspect public void setUp() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); - + afterAdviceAspect = (AfterReturningAdviceBindingTestAspect) ctx.getBean("testAspect"); - + mockCollaborator = createNiceMock(AfterReturningAdviceBindingCollaborator.class); afterAdviceAspect.setCollaborator(mockCollaborator); - + testBeanProxy = (ITestBean) ctx.getBean("testBean"); assertTrue(AopUtils.isAopProxy(testBeanProxy)); - + // we need the real target too, not just the proxy... this.testBeanTarget = (TestBean) ((Advised)testBeanProxy).getTargetSource().getTarget(); } @@ -76,7 +76,7 @@ public void testOneIntArg() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testOneObjectArg() { mockCollaborator.oneObjectArg(this.testBeanProxy); @@ -84,7 +84,7 @@ public void testOneObjectArg() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testOneIntAndOneObjectArgs() { mockCollaborator.oneIntAndOneObject(5,this.testBeanProxy); @@ -92,7 +92,7 @@ public void testOneIntAndOneObjectArgs() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testNeedsJoinPoint() { mockCollaborator.needsJoinPoint("getAge"); @@ -100,7 +100,7 @@ public void testNeedsJoinPoint() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testNeedsJoinPointStaticPart() { mockCollaborator.needsJoinPointStaticPart("getAge"); @@ -117,7 +117,7 @@ public void testReturningString() { testBeanProxy.getName(); verify(mockCollaborator); } - + @Test public void testReturningObject() { mockCollaborator.oneObjectArg(this.testBeanTarget); @@ -125,7 +125,7 @@ public void testReturningObject() { testBeanProxy.returnsThis(); verify(mockCollaborator); } - + @Test public void testReturningBean() { mockCollaborator.oneTestBeanArg(this.testBeanTarget); @@ -133,11 +133,11 @@ public void testReturningBean() { testBeanProxy.returnsThis(); verify(mockCollaborator); } - + @Test public void testReturningBeanArray() { this.testBeanTarget.setSpouse(new TestBean()); - ITestBean[] spouses = (ITestBean[]) this.testBeanTarget.getSpouses(); + ITestBean[] spouses = this.testBeanTarget.getSpouses(); mockCollaborator.testBeanArrayArg(spouses); replay(mockCollaborator); testBeanProxy.getSpouses(); @@ -149,13 +149,13 @@ public void testNoInvokeWhenReturningParameterTypeDoesNotMatch() { // we need a strict mock for this... mockCollaborator = createMock(AfterReturningAdviceBindingCollaborator.class); afterAdviceAspect.setCollaborator(mockCollaborator); - + replay(mockCollaborator); testBeanProxy.setSpouse(this.testBeanProxy); testBeanProxy.getSpouse(); verify(mockCollaborator); } - + @Test public void testReturningByType() { mockCollaborator.objectMatchNoArgs(); @@ -163,7 +163,7 @@ public void testReturningByType() { testBeanProxy.returnsThis(); verify(mockCollaborator); } - + @Test public void testReturningPrimitive() { mockCollaborator.oneInt(20); @@ -181,15 +181,15 @@ final class AfterReturningAdviceBindingTestAspect extends AdviceBindingTestAspec private AfterReturningAdviceBindingCollaborator getCollaborator() { return (AfterReturningAdviceBindingCollaborator) this.collaborator; } - + public void oneString(String name) { getCollaborator().oneString(name); } - + public void oneTestBeanArg(TestBean bean) { getCollaborator().oneTestBeanArg(bean); } - + public void testBeanArrayArg(ITestBean[] beans) { getCollaborator().testBeanArrayArg(beans); } @@ -197,11 +197,11 @@ public void testBeanArrayArg(ITestBean[] beans) { public void objectMatchNoArgs() { getCollaborator().objectMatchNoArgs(); } - + public void stringMatchNoArgs() { getCollaborator().stringMatchNoArgs(); } - + public void oneInt(int result) { getCollaborator().oneInt(result); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java index 5798fa688dcb..53cb7137442b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AfterThrowingAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,14 +43,14 @@ public final class AfterThrowingAdviceBindingTests { public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); - + testBean = (ITestBean) ctx.getBean("testBean"); afterThrowingAdviceAspect = (AfterThrowingAdviceBindingTestAspect) ctx.getBean("testAspect"); - + mockCollaborator = createNiceMock(AfterThrowingAdviceBindingCollaborator.class); afterThrowingAdviceAspect.setCollaborator(mockCollaborator); } - + @After public void tearDown() { verify(mockCollaborator); @@ -62,7 +62,7 @@ public void testSimpleAfterThrowing() throws Throwable { replay(mockCollaborator); this.testBean.exceptional(new Throwable()); } - + @Test(expected=Throwable.class) public void testAfterThrowingWithBinding() throws Throwable { Throwable t = new Throwable(); @@ -70,14 +70,14 @@ public void testAfterThrowingWithBinding() throws Throwable { replay(mockCollaborator); this.testBean.exceptional(t); } - + @Test(expected=Throwable.class) public void testAfterThrowingWithNamedTypeRestriction() throws Throwable { Throwable t = new Throwable(); // need a strict mock for this test... mockCollaborator = createMock(AfterThrowingAdviceBindingCollaborator.class); afterThrowingAdviceAspect.setCollaborator(mockCollaborator); - + mockCollaborator.noArgs(); mockCollaborator.oneThrowable(t); mockCollaborator.noArgsOnThrowableMatch(); @@ -113,7 +113,7 @@ public void testAfterThrowingWithRuntimeTypeSpecified() throws Throwable { final class AfterThrowingAdviceBindingTestAspect { - // collaborator interface that makes it easy to test this aspect is + // collaborator interface that makes it easy to test this aspect is // working as expected through mocking. public interface AfterThrowingAdviceBindingCollaborator { void noArgs(); @@ -122,29 +122,29 @@ public interface AfterThrowingAdviceBindingCollaborator { void noArgsOnThrowableMatch(); void noArgsOnRuntimeExceptionMatch(); } - + protected AfterThrowingAdviceBindingCollaborator collaborator = null; - + public void setCollaborator(AfterThrowingAdviceBindingCollaborator aCollaborator) { this.collaborator = aCollaborator; } - + public void noArgs() { this.collaborator.noArgs(); } - + public void oneThrowable(Throwable t) { this.collaborator.oneThrowable(t); } - + public void oneRuntimeException(RuntimeException ex) { this.collaborator.oneRuntimeException(ex); } - + public void noArgsOnThrowableMatch() { this.collaborator.noArgsOnThrowableMatch(); } - + public void noArgsOnRuntimeExceptionMatch() { this.collaborator.noArgsOnRuntimeExceptionMatch(); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java index 04d0a666b010..39ab2889270b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AroundAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,27 +39,27 @@ public class AroundAdviceBindingTests { private AroundAdviceBindingCollaborator mockCollaborator; - + private ITestBean testBeanProxy; - + private TestBean testBeanTarget; - + protected ApplicationContext ctx; @Before public void onSetUp() throws Exception { ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); - - AroundAdviceBindingTestAspect aroundAdviceAspect = ((AroundAdviceBindingTestAspect) ctx.getBean("testAspect")); - + + AroundAdviceBindingTestAspect aroundAdviceAspect = ((AroundAdviceBindingTestAspect) ctx.getBean("testAspect")); + ITestBean injectedTestBean = (ITestBean) ctx.getBean("testBean"); assertTrue(AopUtils.isAopProxy(injectedTestBean)); - + this.testBeanProxy = injectedTestBean; // we need the real target too, not just the proxy... - + this.testBeanTarget = (TestBean) ((Advised) testBeanProxy).getTargetSource().getTarget(); - + mockCollaborator = createNiceMock(AroundAdviceBindingCollaborator.class); aroundAdviceAspect.setCollaborator(mockCollaborator); } @@ -71,7 +71,7 @@ public void testOneIntArg() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testOneObjectArgBoundToTarget() { mockCollaborator.oneObjectArg(this.testBeanTarget); @@ -79,7 +79,7 @@ public void testOneObjectArgBoundToTarget() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testOneIntAndOneObjectArgs() { mockCollaborator.oneIntAndOneObject(5, this.testBeanProxy); @@ -87,7 +87,7 @@ public void testOneIntAndOneObjectArgs() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testJustJoinPoint() { mockCollaborator.justJoinPoint("getAge"); @@ -95,7 +95,7 @@ public void testJustJoinPoint() { testBeanProxy.getAge(); verify(mockCollaborator); } - + } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java index 1cff726a5815..0355c8f7c37b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectAndAdvicePrecedenceTests.java @@ -36,15 +36,15 @@ public final class AspectAndAdvicePrecedenceTests { private PrecedenceTestAspect highPrecedenceAspect; - + private PrecedenceTestAspect lowPrecedenceAspect; - + private SimpleSpringBeforeAdvice highPrecedenceSpringAdvice; - + private SimpleSpringBeforeAdvice lowPrecedenceSpringAdvice; - + private ITestBean testBean; - + @Before public void setUp() { @@ -176,7 +176,7 @@ public int aroundAdviceOne(ProceedingJoinPoint pjp) { this.collaborator.aroundAdviceOne(this.name); try { ret = ((Integer)pjp.proceed()).intValue(); - } + } catch(Throwable t) { throw new RuntimeException(t); } this.collaborator.aroundAdviceOne(this.name); return ret; @@ -187,7 +187,7 @@ public int aroundAdviceTwo(ProceedingJoinPoint pjp) { this.collaborator.aroundAdviceTwo(this.name); try { ret = ((Integer)pjp.proceed()).intValue(); - } + } catch(Throwable t) {throw new RuntimeException(t);} this.collaborator.aroundAdviceTwo(this.name); return ret; @@ -219,7 +219,7 @@ class SimpleSpringBeforeAdvice implements MethodBeforeAdvice, BeanNameAware { private PrecedenceTestAspect.Collaborator collaborator; private String name; - + /* (non-Javadoc) * @see org.springframework.aop.MethodBeforeAdvice#before(java.lang.reflect.Method, java.lang.Object[], java.lang.Object) */ diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java index dbe4e3e51a02..47d05c2f10e1 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisorTests.java @@ -72,4 +72,4 @@ public int getCount() { public void reset() { this.count = 0; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java index c2f76603b166..780c9022570a 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutAtAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ public final class BeanNamePointcutAtAspectTests { private ITestBean testBean1; + @SuppressWarnings("unused") private ITestBean testBean2; private ITestBean testBean3; @@ -100,5 +101,5 @@ class CounterAspect { public void increment1ForAnonymousPointcut() { count++; } - + } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java index 8d43600ab90d..d90710ea8090 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public final class BeanNamePointcutTests { private ITestBean interceptThis; private ITestBean dontInterceptThis; private TestInterceptor testInterceptor; - + private ClassPathXmlApplicationContext ctx; @@ -64,7 +64,7 @@ public void setUp() { interceptThis = (ITestBean) ctx.getBean("interceptThis"); dontInterceptThis = (ITestBean) ctx.getBean("dontInterceptThis"); testInterceptor = (TestInterceptor) ctx.getBean("testInterceptor"); - + counterAspect.reset(); } @@ -90,7 +90,7 @@ public void testNonMatchingBeanName() { public void testNonMatchingNestedBeanName() { assertFalse("Non-matching bean must *not* be advised (proxied)", this.testBeanContainingNestedBean.getDoctor() instanceof Advised); } - + @Test public void testMatchingFactoryBeanObject() { assertTrue("Matching bean must be advised (proxied)", this.testFactoryBean1 instanceof Advised); @@ -125,7 +125,7 @@ public void testPointcutAdvisorCombination() { public static class TestInterceptor implements MethodBeforeAdvice { private int interceptionCount; - + public void before(Method method, Object[] args, Object target) throws Throwable { interceptionCount++; } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java index adabfcc5ea26..d80d9555da65 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/BeforeAdviceBindingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,28 +38,28 @@ public final class BeforeAdviceBindingTests { private AdviceBindingCollaborator mockCollaborator; - + private ITestBean testBeanProxy; - + private TestBean testBeanTarget; protected String getConfigPath() { return "before-advice-tests.xml"; } - + @Before public void setUp() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); - + testBeanProxy = (ITestBean) ctx.getBean("testBean"); assertTrue(AopUtils.isAopProxy(testBeanProxy)); - + // we need the real target too, not just the proxy... testBeanTarget = (TestBean) ((Advised) testBeanProxy).getTargetSource().getTarget(); - + AdviceBindingTestAspect beforeAdviceAspect = (AdviceBindingTestAspect) ctx.getBean("testAspect"); - + mockCollaborator = createNiceMock(AdviceBindingCollaborator.class); beforeAdviceAspect.setCollaborator(mockCollaborator); } @@ -72,7 +72,7 @@ public void testOneIntArg() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testOneObjectArgBoundToProxyUsingThis() { mockCollaborator.oneObjectArg(this.testBeanProxy); @@ -80,7 +80,7 @@ public void testOneObjectArgBoundToProxyUsingThis() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testOneIntAndOneObjectArgs() { mockCollaborator.oneIntAndOneObject(5,this.testBeanTarget); @@ -88,7 +88,7 @@ public void testOneIntAndOneObjectArgs() { testBeanProxy.setAge(5); verify(mockCollaborator); } - + @Test public void testNeedsJoinPoint() { mockCollaborator.needsJoinPoint("getAge"); @@ -96,7 +96,7 @@ public void testNeedsJoinPoint() { testBeanProxy.getAge(); verify(mockCollaborator); } - + @Test public void testNeedsJoinPointStaticPart() { mockCollaborator.needsJoinPointStaticPart("getAge"); @@ -105,7 +105,7 @@ public void testNeedsJoinPointStaticPart() { verify(mockCollaborator); } - + } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java index b37f8fba3711..4c424f52b889 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclarationOrderIndependenceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ public final class DeclarationOrderIndependenceTests { private TopsyTurvyAspect aspect; private TopsyTurvyTarget target; - + @Before public void setUp() { @@ -49,12 +49,12 @@ public void setUp() { public void testTargetIsSerializable() { assertTrue("target bean is serializable",this.target instanceof Serializable); } - + @Test public void testTargetIsBeanNameAware() { assertTrue("target bean is bean name aware",this.target instanceof BeanNameAware); } - + @Test public void testBeforeAdviceFiringOk() { AspectCollaborator collab = new AspectCollaborator(); @@ -62,7 +62,7 @@ public void testBeforeAdviceFiringOk() { this.target.doSomething(); assertTrue("before advice fired",collab.beforeFired); } - + @Test public void testAroundAdviceFiringOk() { AspectCollaborator collab = new AspectCollaborator(); @@ -70,30 +70,31 @@ public void testAroundAdviceFiringOk() { this.target.getX(); assertTrue("around advice fired",collab.aroundFired); } - + @Test public void testAfterReturningFiringOk() { AspectCollaborator collab = new AspectCollaborator(); this.aspect.setCollaborator(collab); this.target.getX(); - assertTrue("after returning advice fired",collab.afterReturningFired); + assertTrue("after returning advice fired",collab.afterReturningFired); } - - + + /** public visibility is required */ public static class BeanNameAwareMixin implements BeanNameAware { - + + @SuppressWarnings("unused") private String beanName; - + /* (non-Javadoc) * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) */ public void setBeanName(String name) { this.beanName = name; } - + } - + /** public visibility is required */ @SuppressWarnings("serial") public static class SerializableMixin implements Serializable { @@ -103,15 +104,15 @@ public static class SerializableMixin implements Serializable { class TopsyTurvyAspect { - + interface Collaborator { void beforeAdviceFired(); void afterReturningAdviceFired(); void aroundAdviceFired(); } - + private Collaborator collaborator; - + public void setCollaborator(Collaborator collaborator) { this.collaborator = collaborator; } @@ -119,11 +120,11 @@ public void setCollaborator(Collaborator collaborator) { public void before() { this.collaborator.beforeAdviceFired(); } - + public void afterReturning() { this.collaborator.afterReturningAdviceFired(); } - + public Object around(ProceedingJoinPoint pjp) throws Throwable { Object ret = pjp.proceed(); this.collaborator.aroundAdviceFired(); @@ -144,21 +145,21 @@ interface TopsyTurvyTarget { class TopsyTurvyTargetImpl implements TopsyTurvyTarget { private int x = 5; - + /* (non-Javadoc) * @see org.springframework.aop.aspectj.TopsyTurvyTarget#doSomething() */ public void doSomething() { this.x = 10; } - + /* (non-Javadoc) * @see org.springframework.aop.aspectj.TopsyTurvyTarget#getX() */ public int getX() { return x; } - + } @@ -167,7 +168,7 @@ class AspectCollaborator implements TopsyTurvyAspect.Collaborator { public boolean afterReturningFired = false; public boolean aroundFired = false; public boolean beforeFired = false; - + /* (non-Javadoc) * @see org.springframework.aop.aspectj.TopsyTurvyAspect.Collaborator#afterReturningAdviceFired() */ @@ -188,5 +189,5 @@ public void aroundAdviceFired() { public void beforeAdviceFired() { this.beforeFired = true; } - + } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsDelegateRefTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsDelegateRefTests.java index 599fa63ee99e..bf495f0736ec 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsDelegateRefTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsDelegateRefTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public class DeclareParentsDelegateRefTests { protected NoMethodsBean noMethodsBean; protected Counter counter; - + @Before public void setUp() { @@ -46,7 +46,7 @@ public void setUp() { public void testIntroductionWasMade() { assertTrue("Introduction must have been made", noMethodsBean instanceof ICounter); } - + @Test public void testIntroductionDelegation() { ((ICounter)noMethodsBean).increment(); @@ -62,4 +62,4 @@ interface NoMethodsBean { class NoMethodsBeanImpl implements NoMethodsBean { } - + diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java index d4b9926cd4d8..b61a1e9c3333 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/DeclareParentsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.beans.ITestBean; -import org.springframework.beans.TestBean; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -36,22 +35,20 @@ public final class DeclareParentsTests { private ITestBean testBeanProxy; - - private TestBean testBeanTarget; private ApplicationContext ctx; @Before public void setUp() throws Exception { ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); - + testBeanProxy = (ITestBean) ctx.getBean("testBean"); assertTrue(AopUtils.isAopProxy(testBeanProxy)); - + // we need the real target too, not just the proxy... - testBeanTarget = (TestBean) ((Advised) testBeanProxy).getTargetSource().getTarget(); + ((Advised) testBeanProxy).getTargetSource().getTarget(); } - + @Test public void testIntroductionWasMade() { assertTrue("Introduction must have been made", testBeanProxy instanceof Lockable); @@ -94,4 +91,4 @@ public void checkNotLocked(Lockable mixin) { } } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java index ca987a04a4c4..0e7435362af2 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingAtAspectJTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,18 +25,18 @@ /** * Tests to check if the first implicit join point argument is correctly processed. * See SPR-3723 for more details. - * + * * @author Ramnivas Laddad * @author Chris Beams */ public final class ImplicitJPArgumentMatchingAtAspectJTests { - + @Test public void testAspect() { // nothing to really test; it is enough if we don't get error while creating app context new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); } - + @Aspect static class CounterAtAspectJAspect { @Around(value="execution(* org.springframework.beans.TestBean.*(..)) and this(bean) and args(argument)", diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.java index 8cd94420ee75..5c942d9ddc2b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ImplicitJPArgumentMatchingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,18 +22,18 @@ /** * Tests to check if the first implicit join point argument is correctly processed. * See SPR-3723 for more details. - * + * * @author Ramnivas Laddad * @author Chris Beams */ public final class ImplicitJPArgumentMatchingTests { - + @Test public void testAspect() { // nothing to really test; it is enough if we don't get error while creating app context new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); } - + static class CounterAspect { public void increment(ProceedingJoinPoint pjp, Object bean, Object argument) throws Throwable { pjp.proceed(); diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.java index 9eac5f45d4b2..4c79347978d1 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/OverloadedAdviceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ class OverloadedAdviceTestAspect { public void myBeforeAdvice(String name) { // no-op } - + public void myBeforeAdvice(int age) { // no-op } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ProceedTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/ProceedTests.java index 14a52c18d1c9..f2e4cfbc4058 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ProceedTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ProceedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public void testProceedWithArgsAcrossAspects() { interface SimpleBean { - + void setName(String name); String getName(); void setAge(int age); @@ -100,7 +100,7 @@ class SimpleBeanImpl implements SimpleBean { private float aFloat; private String name; private String sex; - + public int getAge() { return age; } @@ -136,30 +136,30 @@ public void setSex(String sex) { class ProceedTestingAspect implements Ordered { - + private String lastBeforeStringValue; private String lastAroundStringValue; private float lastBeforeFloatValue; private int order; - + public void setOrder(int order) { this.order = order; } public int getOrder() { return this.order; } - + public Object capitalize(ProceedingJoinPoint pjp, String value) throws Throwable { return pjp.proceed(new Object[] {value.toUpperCase()}); } - + public Object doubleOrQuits(ProceedingJoinPoint pjp) throws Throwable { int value = ((Integer) pjp.getArgs()[0]).intValue(); pjp.getArgs()[0] = new Integer(value * 2); return pjp.proceed(); } - + public Object addOne(ProceedingJoinPoint pjp, Float value) throws Throwable { float fv = value.floatValue(); return pjp.proceed(new Object[] {new Float(fv + 1.0F)}); } - + public void captureStringArgument(JoinPoint tjp, String arg) { if (!tjp.getArgs()[0].equals(arg)) { throw new IllegalStateException( @@ -169,7 +169,7 @@ public void captureStringArgument(JoinPoint tjp, String arg) { } this.lastBeforeStringValue = arg; } - + public Object captureStringArgumentInAround(ProceedingJoinPoint pjp, String arg) throws Throwable { if (!pjp.getArgs()[0].equals(arg)) { throw new IllegalStateException( @@ -179,7 +179,7 @@ public Object captureStringArgumentInAround(ProceedingJoinPoint pjp, String arg) this.lastAroundStringValue = arg; return pjp.proceed(); } - + public void captureFloatArgument(JoinPoint tjp, float arg) { float tjpArg = ((Float) tjp.getArgs()[0]).floatValue(); if (Math.abs(tjpArg - arg) > 0.000001) { @@ -190,15 +190,15 @@ public void captureFloatArgument(JoinPoint tjp, float arg) { } this.lastBeforeFloatValue = arg; } - + public String getLastBeforeStringValue() { return this.lastBeforeStringValue; } - + public String getLastAroundStringValue() { return this.lastAroundStringValue; } - + public float getLastBeforeFloatValue() { return this.lastBeforeFloatValue; } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/PropertyDependentAspectTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/PropertyDependentAspectTests.java index 39cc9b3486cf..6c3b78af3c69 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/PropertyDependentAspectTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/PropertyDependentAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ class JoinPointMonitorAspect { * is sufficient to reproduce the bug. */ private ICounter counter; - + int beforeExecutions; int aroundExecutions; @@ -121,7 +121,7 @@ class JoinPointMonitorAtAspectJAspect { * is sufficient to reproduce the bug. */ private ICounter counter; - + int beforeExecutions; int aroundExecutions; @@ -144,4 +144,4 @@ public void setCounter(ICounter counter) { this.counter = counter; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/SharedPointcutWithArgsMismatchTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/SharedPointcutWithArgsMismatchTests.java index 53700685629c..93fd2a2b596d 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/SharedPointcutWithArgsMismatchTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/SharedPointcutWithArgsMismatchTests.java @@ -22,7 +22,7 @@ /** * See SPR-1682. - * + * * @author Adrian Colyer * @author Chris Beams */ @@ -30,7 +30,7 @@ public final class SharedPointcutWithArgsMismatchTests { private ToBeAdvised toBeAdvised; - + @Before public void setUp() { ClassPathXmlApplicationContext ctx = diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/SubtypeSensitiveMatchingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/SubtypeSensitiveMatchingTests.java index d587ab8ccf58..9987e35556ee 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/SubtypeSensitiveMatchingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/SubtypeSensitiveMatchingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ public final class SubtypeSensitiveMatchingTests { private SerializableFoo serializableBean; private Bar bar; - + @Before public void setUp() { @@ -52,13 +52,13 @@ public void testBeansAreProxiedOnStaticMatch() { assertTrue("bean with serializable type should be proxied", this.serializableBean instanceof Advised); } - + @Test public void testBeansThatDoNotMatchBasedSolelyOnRuntimeTypeAreNotProxied() { assertFalse("bean with non-serializable type should not be proxied", - this.nonSerializableBean instanceof Advised); + this.nonSerializableBean instanceof Advised); } - + @Test public void testBeansThatDoNotMatchBasedOnOtherTestAreProxied() { assertTrue("bean with args check should be proxied", @@ -73,14 +73,14 @@ interface NonSerializableFoo { void foo(); } interface SerializableFoo extends Serializable { void foo(); } class SubtypeMatchingTestClassA implements NonSerializableFoo { - + public void foo() {} - + } @SuppressWarnings("serial") class SubtypeMatchingTestClassB implements SerializableFoo { - + public void foo() {} } @@ -90,5 +90,5 @@ interface Bar { void bar(Object o); } class SubtypeMatchingTestClassC implements Bar { public void bar(Object o) {} - -} \ No newline at end of file + +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java index c20e47a55afc..f440f0490b0c 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java @@ -38,7 +38,7 @@ public final class TargetPointcutSelectionTests { public TestAspect testAspectForTestImpl1; public TestAspect testAspectForAbstractTestImpl; public TestInterceptor testInterceptor; - + @Before public void setUp() { @@ -49,12 +49,12 @@ public void setUp() { testAspectForTestImpl1 = (TestAspect) ctx.getBean("testAspectForTestImpl1"); testAspectForAbstractTestImpl = (TestAspect) ctx.getBean("testAspectForAbstractTestImpl"); testInterceptor = (TestInterceptor) ctx.getBean("testInterceptor"); - + testAspectForTestImpl1.count = 0; testAspectForAbstractTestImpl.count = 0; testInterceptor.count = 0; } - + @Test public void testTargetSelectionForMatchedType() { testImpl1.interfaceMethod(); @@ -76,7 +76,7 @@ public static interface TestInterface { public void interfaceMethod(); } - + // Reproducing bug requires that the class specified in target() pointcut doesn't // include the advised method's implementation (instead a base class should include it) @@ -85,7 +85,7 @@ public static abstract class AbstractTestImpl implements TestInterface { public void interfaceMethod() { } } - + public static class TestImpl1 extends AbstractTestImpl { } @@ -98,12 +98,12 @@ public static class TestImpl2 extends AbstractTestImpl { public static class TestAspect { public int count; - + public void increment() { count++; } } - + public static class TestInterceptor extends TestAspect implements MethodInterceptor { diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.java index 8008dbccfd1a..6633bb808eab 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.java @@ -34,9 +34,9 @@ public final class ThisAndTargetSelectionOnlyPointcutsAtAspectJTests { public TestInterface testBean; public TestInterface testAnnotatedClassBean; public TestInterface testAnnotatedMethodBean; - + protected Counter counter; - + @org.junit.Before public void setUp() { ClassPathXmlApplicationContext ctx = @@ -89,8 +89,8 @@ public void testThisAsInterfaceAndTargetAsClassCounterMatch() { testBean.doIt(); assertEquals(1, counter.thisAsInterfaceAndTargetAsInterfaceCounter); } - - + + @Test public void testAtTargetClassAnnotationMatch() { testAnnotatedClassBean.doIt(); @@ -102,7 +102,7 @@ public void testAtAnnotationMethodAnnotationMatch() { testAnnotatedMethodBean.doIt(); assertEquals(1, counter.atAnnotationMethodAnnotationCounter); } - + public static interface TestInterface { public void doIt(); } @@ -111,12 +111,12 @@ public static class TestImpl implements TestInterface { public void doIt() { } } - + @Retention(RetentionPolicy.RUNTIME) public static @interface TestAnnotation { - + } - + @TestAnnotation public static class AnnotatedClassTestImpl implements TestInterface { public void doIt() { @@ -128,7 +128,7 @@ public static class AnnotatedMethodTestImpl implements TestInterface { public void doIt() { } } - + @Aspect public static class Counter { int thisAsClassCounter; @@ -140,7 +140,7 @@ public static class Counter { int thisAsInterfaceAndTargetAsClassCounter; int atTargetClassAnnotationCounter; int atAnnotationMethodAnnotationCounter; - + public void reset() { thisAsClassCounter = 0; thisAsInterfaceCounter = 0; @@ -152,7 +152,7 @@ public void reset() { atTargetClassAnnotationCounter = 0; atAnnotationMethodAnnotationCounter = 0; } - + @Before("this(org.springframework.aop.aspectj.ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.TestImpl)") public void incrementThisAsClassCounter() { thisAsClassCounter++; @@ -162,7 +162,7 @@ public void incrementThisAsClassCounter() { public void incrementThisAsInterfaceCounter() { thisAsInterfaceCounter++; } - + @Before("target(org.springframework.aop.aspectj.ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.TestImpl)") public void incrementTargetAsClassCounter() { targetAsClassCounter++; @@ -184,22 +184,22 @@ public void incrementThisAsClassAndTargetAsClassCounter() { public void incrementThisAsInterfaceAndTargetAsInterfaceCounter() { thisAsInterfaceAndTargetAsInterfaceCounter++; } - + @Before("this(org.springframework.aop.aspectj.ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.TestInterface) " + "&& target(org.springframework.aop.aspectj.ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.TestImpl)") public void incrementThisAsInterfaceAndTargetAsClassCounter() { thisAsInterfaceAndTargetAsClassCounter++; } - + @Before("@target(org.springframework.aop.aspectj.ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.TestAnnotation)") public void incrementAtTargetClassAnnotationCounter() { atTargetClassAnnotationCounter++; } - + @Before("@annotation(org.springframework.aop.aspectj.ThisAndTargetSelectionOnlyPointcutsAtAspectJTests.TestAnnotation)") public void incrementAtAnnotationMethodAnnotationCounter() { atAnnotationMethodAnnotationCounter++; } - + } } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsTests.java index 398046ddb2f1..a36407334568 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/ThisAndTargetSelectionOnlyPointcutsTests.java @@ -27,9 +27,9 @@ * @author Chris Beams */ public final class ThisAndTargetSelectionOnlyPointcutsTests { - + private TestInterface testBean; - + private Counter thisAsClassCounter; private Counter thisAsInterfaceCounter; private Counter targetAsClassCounter; @@ -37,28 +37,28 @@ public final class ThisAndTargetSelectionOnlyPointcutsTests { private Counter thisAsClassAndTargetAsClassCounter; private Counter thisAsInterfaceAndTargetAsInterfaceCounter; private Counter thisAsInterfaceAndTargetAsClassCounter; - + @Before public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); testBean = (TestInterface) ctx.getBean("testBean"); - + thisAsClassCounter = (Counter) ctx.getBean("thisAsClassCounter"); thisAsInterfaceCounter = (Counter) ctx.getBean("thisAsInterfaceCounter"); targetAsClassCounter = (Counter) ctx.getBean("targetAsClassCounter"); targetAsInterfaceCounter = (Counter) ctx.getBean("targetAsInterfaceCounter"); - + thisAsClassAndTargetAsClassCounter = (Counter) ctx.getBean("thisAsClassAndTargetAsClassCounter"); thisAsInterfaceAndTargetAsInterfaceCounter = (Counter) ctx.getBean("thisAsInterfaceAndTargetAsInterfaceCounter"); thisAsInterfaceAndTargetAsClassCounter = (Counter) ctx.getBean("thisAsInterfaceAndTargetAsClassCounter"); - + thisAsClassCounter.reset(); thisAsInterfaceCounter.reset(); targetAsClassCounter.reset(); targetAsInterfaceCounter.reset(); - + thisAsClassAndTargetAsClassCounter.reset(); thisAsInterfaceAndTargetAsInterfaceCounter.reset(); thisAsInterfaceAndTargetAsClassCounter.reset(); @@ -105,7 +105,7 @@ public void testThisAsInterfaceAndTargetAsClassCounterMatch() { testBean.doIt(); assertEquals(1, thisAsInterfaceAndTargetAsInterfaceCounter.getCount()); } - + } @@ -117,4 +117,4 @@ interface TestInterface { class TestImpl implements TestInterface { public void doIt() { } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/_TestTypes.java b/spring-context/src/test/java/org/springframework/aop/aspectj/_TestTypes.java index 3ad14e51d5e0..6db0d18e9d83 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/_TestTypes.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/_TestTypes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,12 +21,12 @@ /** * Definitions of testing types for use in within this package. * Wherever possible, test types should be defined local to the java - * file that makes use of them. In some cases however, a test type may - * need to be shared across tests. Such types reside here, with the + * file that makes use of them. In some cases however, a test type may + * need to be shared across tests. Such types reside here, with the * intention of reducing the surface area of java files within this - * package. This allows developers to think about tests first, and deal + * package. This allows developers to think about tests first, and deal * with these second class testing artifacts on an as-needed basis. - * + * * Types here should be defined as package-private top level classes in * order to avoid needing to fully qualify, e.g.: _TestTypes$Foo. * @@ -49,24 +49,24 @@ class AdviceBindingTestAspect { public void setCollaborator(AdviceBindingCollaborator aCollaborator) { this.collaborator = aCollaborator; } - + // "advice" methods public void oneIntArg(int age) { this.collaborator.oneIntArg(age); } - + public void oneObjectArg(Object bean) { this.collaborator.oneObjectArg(bean); } - + public void oneIntAndOneObject(int x, Object o) { this.collaborator.oneIntAndOneObject(x,o); } - + public void needsJoinPoint(JoinPoint tjp) { this.collaborator.needsJoinPoint(tjp.getSignature().getName()); } - + public void needsJoinPointStaticPart(JoinPoint.StaticPart tjpsp) { this.collaborator.needsJoinPointStaticPart(tjpsp.getSignature().getName()); } @@ -108,7 +108,7 @@ interface ICounter { /** * A simple counter for use in simple tests (for example, how many times an advice was executed) - * + * * @author Ramnivas Laddad */ final class Counter implements ICounter { @@ -121,7 +121,7 @@ public Counter() { public void increment() { count++; } - + public void decrement() { count--; } @@ -133,7 +133,7 @@ public int getCount() { public void setCount(int counter) { this.count = counter; } - + public void reset() { this.count = 0; } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationBindingTests.java index af3310eaa35e..0829446808fd 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationBindingTests.java @@ -34,7 +34,7 @@ public final class AnnotationBindingTests { public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + testBean = (AnnotatedTestBean) ctx.getBean("testBean"); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationPointcutTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationPointcutTests.java index b2bf8acec7ad..925038414ecb 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationPointcutTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AnnotationPointcutTests.java @@ -36,7 +36,7 @@ public final class AnnotationPointcutTests { public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + testBean = (AnnotatedTestBean) ctx.getBean("testBean"); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java index 9507d4889160..37c927f9f6d4 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectImplementingInterfaceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,10 +36,10 @@ public final class AspectImplementingInterfaceTests { public void testProxyCreation() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + ITestBean testBean = (ITestBean) ctx.getBean("testBean"); AnInterface interfaceExtendingAspect = (AnInterface) ctx.getBean("interfaceExtendingAspect"); - + assertTrue(testBean instanceof Advised); assertFalse(interfaceExtendingAspect instanceof Advised); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java index 9524e6dce3e1..f609c08b3e7d 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorAndLazyInitTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public final class AspectJAutoProxyCreatorAndLazyInitTargetSourceTests { public void testAdrian() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + ITestBean adrian = (ITestBean) ctx.getBean("adrian"); assertEquals(0, LazyTestBean.instantiations); assertNotNull(adrian); diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java index 96b55873b7b0..7a4f89fe5fd7 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -180,7 +180,7 @@ public void testAspectsAndAdvisorNotAppliedToManySingletonsIsFastEnough() { public void testAspectsAndAdvisorAreAppliedEvenIfComingFromParentFactory() { ClassPathXmlApplicationContext ac = newContext("aspectsPlusAdvisor.xml"); GenericApplicationContext childAc = new GenericApplicationContext(ac); - // Create a child factory with a bean that should be woven + // Create a child factory with a bean that should be woven RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); bd.getPropertyValues().addPropertyValue(new PropertyValue("name", "Adrian")) .addPropertyValue(new PropertyValue("age", new Integer(34))); @@ -297,7 +297,7 @@ public void testAdviceUsingJoinPoint() { adrian1.getAge(); AdviceUsingThisJoinPoint aspectInstance = (AdviceUsingThisJoinPoint) bf.getBean("aspect"); //(AdviceUsingThisJoinPoint) Aspects.aspectOf(AdviceUsingThisJoinPoint.class); - //assertEquals("method-execution(int TestBean.getAge())",aspectInstance.getLastMethodEntered()); + //assertEquals("method-execution(int TestBean.getAge())",aspectInstance.getLastMethodEntered()); assertTrue(aspectInstance.getLastMethodEntered().indexOf("TestBean.getAge())") != 0); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java index 0c6b68d805f6..0fb8839434e6 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAfterThrowingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAnnotationBindingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAnnotationBindingTests.java index 29867330f833..f32c305e350a 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAnnotationBindingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AtAspectJAnnotationBindingTests.java @@ -76,8 +76,8 @@ public Object doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnn) Object result = pjp.proceed(); return (result instanceof String ? annValue + " " + result : result); } - -} + +} class ResourceArrayFactoryBean implements FactoryBean { @@ -96,4 +96,4 @@ public boolean isSingleton() { return true; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/_TestTypes.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/_TestTypes.java index 78eede824c69..f0dd015c549c 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/_TestTypes.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/_TestTypes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ /** * Definitions of testing types for use in within this package. * Wherever possible, test types should be defined local to the java - * file that makes use of them. In some cases however, a test type may - * need to be shared across tests. Such types reside here, with the + * file that makes use of them. In some cases however, a test type may + * need to be shared across tests. Such types reside here, with the * intention of reducing the surface area of java files within this - * package. This allows developers to think about tests first, and deal + * package. This allows developers to think about tests first, and deal * with these second class testing artifacts on an as-needed basis. - * + * * Types here should be defined as package-private top level classes in * order to avoid needing to fully qualify, e.g.: _TestTypes$Foo. * diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java index 5051cac166e3..14ca674632f4 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/benchmark/BenchmarkTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ import org.springframework.util.StopWatch; /** - * Integration tests for AspectJ auto proxying. Includes mixing with Spring AOP + * Integration tests for AspectJ auto proxying. Includes mixing with Spring AOP * Advisors to demonstrate that existing autoproxying contract is honoured. * * @author Rod Johnson * @author Chris Beams */ public final class BenchmarkTests { - + private static final Class CLASS = BenchmarkTests.class; private static final String ASPECTJ_CONTEXT = CLASS.getSimpleName() + "-aspectj.xml"; @@ -56,27 +56,27 @@ public final class BenchmarkTests { public void testRepeatedAroundAdviceInvocationsWithAspectJ() { testRepeatedAroundAdviceInvocations(ASPECTJ_CONTEXT, getCount(), "AspectJ"); } - + @Test public void testRepeatedAroundAdviceInvocationsWithSpringAop() { testRepeatedAroundAdviceInvocations(SPRING_AOP_CONTEXT, getCount(), "Spring AOP"); } - + @Test public void testRepeatedBeforeAdviceInvocationsWithAspectJ() { testBeforeAdviceWithoutJoinPoint(ASPECTJ_CONTEXT, getCount(), "AspectJ"); } - + @Test public void testRepeatedBeforeAdviceInvocationsWithSpringAop() { testBeforeAdviceWithoutJoinPoint(SPRING_AOP_CONTEXT, getCount(), "Spring AOP"); } - + @Test public void testRepeatedAfterReturningAdviceInvocationsWithAspectJ() { testAfterReturningAdviceWithoutJoinPoint(ASPECTJ_CONTEXT, getCount(), "AspectJ"); } - + @Test public void testRepeatedAfterReturningAdviceInvocationsWithSpringAop() { testAfterReturningAdviceWithoutJoinPoint(SPRING_AOP_CONTEXT, getCount(), "Spring AOP"); @@ -86,12 +86,12 @@ public void testRepeatedAfterReturningAdviceInvocationsWithSpringAop() { public void testRepeatedMixWithAspectJ() { testMix(ASPECTJ_CONTEXT, getCount(), "AspectJ"); } - + @Test public void testRepeatedMixWithSpringAop() { testMix(SPRING_AOP_CONTEXT, getCount(), "Spring AOP"); } - + /** * Change the return number to a higher number to make this test useful. */ @@ -105,85 +105,85 @@ private long testRepeatedAroundAdviceInvocations(String file, int howmany, Strin StopWatch sw = new StopWatch(); sw.start(howmany + " repeated around advice invocations with " + technology); ITestBean adrian = (ITestBean) bf.getBean("adrian"); - + assertTrue(AopUtils.isAopProxy(adrian)); assertEquals(68, adrian.getAge()); - + for (int i = 0; i < howmany; i++) { adrian.getAge(); } - + sw.stop(); System.out.println(sw.prettyPrint()); return sw.getLastTaskTimeMillis(); } - + private long testBeforeAdviceWithoutJoinPoint(String file, int howmany, String technology) { ClassPathXmlApplicationContext bf = new ClassPathXmlApplicationContext(file, CLASS); StopWatch sw = new StopWatch(); sw.start(howmany + " repeated before advice invocations with " + technology); ITestBean adrian = (ITestBean) bf.getBean("adrian"); - + assertTrue(AopUtils.isAopProxy(adrian)); Advised a = (Advised) adrian; assertTrue(a.getAdvisors().length >= 3); assertEquals("adrian", adrian.getName()); - + for (int i = 0; i < howmany; i++) { adrian.getName(); } - + sw.stop(); System.out.println(sw.prettyPrint()); return sw.getLastTaskTimeMillis(); } - + private long testAfterReturningAdviceWithoutJoinPoint(String file, int howmany, String technology) { ClassPathXmlApplicationContext bf = new ClassPathXmlApplicationContext(file, CLASS); StopWatch sw = new StopWatch(); sw.start(howmany + " repeated after returning advice invocations with " + technology); ITestBean adrian = (ITestBean) bf.getBean("adrian"); - + assertTrue(AopUtils.isAopProxy(adrian)); Advised a = (Advised) adrian; assertTrue(a.getAdvisors().length >= 3); // Hits joinpoint adrian.setAge(25); - + for (int i = 0; i < howmany; i++) { adrian.setAge(i); } - + sw.stop(); System.out.println(sw.prettyPrint()); return sw.getLastTaskTimeMillis(); } - + private long testMix(String file, int howmany, String technology) { ClassPathXmlApplicationContext bf = new ClassPathXmlApplicationContext(file, CLASS); StopWatch sw = new StopWatch(); sw.start(howmany + " repeated mixed invocations with " + technology); ITestBean adrian = (ITestBean) bf.getBean("adrian"); - + assertTrue(AopUtils.isAopProxy(adrian)); Advised a = (Advised) adrian; assertTrue(a.getAdvisors().length >= 3); - + for (int i = 0; i < howmany; i++) { // Hit all 3 joinpoints adrian.getAge(); adrian.getName(); adrian.setAge(i); - + // Invoke three non-advised methods adrian.getDoctor(); adrian.getLawyer(); adrian.getSpouse(); } - + sw.stop(); System.out.println(sw.prettyPrint()); return sw.getLastTaskTimeMillis(); @@ -193,19 +193,19 @@ private long testMix(String file, int howmany, String technology) { class MultiplyReturnValueInterceptor implements MethodInterceptor { - + private int multiple = 2; - + public int invocations; - + public void setMultiple(int multiple) { this.multiple = multiple; } - + public int getMultiple() { return this.multiple; } - + public Object invoke(MethodInvocation mi) throws Throwable { ++invocations; int result = (Integer) mi.proceed(); @@ -216,13 +216,13 @@ public Object invoke(MethodInvocation mi) throws Throwable { class TraceAfterReturningAdvice implements AfterReturningAdvice { - + public int afterTakesInt; - + public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { ++afterTakesInt; } - + public static Advisor advisor() { return new DefaultPointcutAdvisor( new StaticMethodMatcherPointcut() { @@ -239,16 +239,16 @@ public boolean matches(Method method, Class targetClass) { @Aspect class TraceAspect { - + public int beforeStringReturn; - + public int afterTakesInt; - + @Before("execution(String *.*(..))") public void traceWithoutJoinPoint() { ++beforeStringReturn; } - + @AfterReturning("execution(void *.*(int))") public void traceWithoutJoinPoint2() { ++afterTakesInt; @@ -258,13 +258,13 @@ public void traceWithoutJoinPoint2() { class TraceBeforeAdvice implements MethodBeforeAdvice { - + public int beforeStringReturn; - + public void before(Method method, Object[] args, Object target) throws Throwable { ++beforeStringReturn; } - + public static Advisor advisor() { return new DefaultPointcutAdvisor( new StaticMethodMatcherPointcut() { diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/spr3064/SPR3064Tests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/spr3064/SPR3064Tests.java index e2e6b5270ff9..74fb4ecdfebb 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/spr3064/SPR3064Tests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/spr3064/SPR3064Tests.java @@ -1,5 +1,5 @@ /** - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,14 +34,14 @@ public final class SPR3064Tests { private Service service; - + @Test public void testServiceIsAdvised() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); - + service = (Service) ctx.getBean("service"); - + try { this.service.serveMe(); fail("service operation has not been advised by transaction interceptor"); @@ -50,7 +50,7 @@ public void testServiceIsAdvised() { assertEquals("advice invoked",ex.getMessage()); } } - + } @@ -62,7 +62,7 @@ public void testServiceIsAdvised() { @Aspect class TransactionInterceptor { - + @Around(value="execution(* *..Service.*(..)) && @annotation(transaction)") public Object around(ProceedingJoinPoint pjp, Transaction transaction) throws Throwable { throw new RuntimeException("advice invoked"); @@ -73,7 +73,7 @@ public Object around(ProceedingJoinPoint pjp, Transaction transaction) throws Th interface Service { - + void serveMe(); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java index 8e2d35d9d2eb..336523137aea 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/AfterReturningGenericTypeMatchingTests.java @@ -51,10 +51,10 @@ public final class AfterReturningGenericTypeMatchingTests { public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + counterAspect = (CounterAspect) ctx.getBean("counterAspect"); counterAspect.reset(); - + testBean = (GenericReturnTypeVariationClass) ctx.getBean("testBean"); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericBridgeMethodMatchingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericBridgeMethodMatchingTests.java index ce7790ab7687..4e0d80690581 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericBridgeMethodMatchingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericBridgeMethodMatchingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,10 +50,10 @@ public class GenericBridgeMethodMatchingTests { public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + counterAspect = (GenericCounterAspect) ctx.getBean("counterAspect"); counterAspect.count = 0; - + testBean = (DerivedInterface) ctx.getBean("testBean"); } diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericParameterMatchingTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericParameterMatchingTests.java index 011095b95db6..6260e98b0610 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericParameterMatchingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/generic/GenericParameterMatchingTests.java @@ -45,14 +45,14 @@ public final class GenericParameterMatchingTests { public void setUp() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass()); - + counterAspect = (CounterAspect) ctx.getBean("counterAspect"); counterAspect.reset(); - + testBean = (GenericInterface) ctx.getBean("testBean"); } - + @Test public void testGenericInterfaceGenericArgExecution() { testBean.save(""); @@ -64,7 +64,7 @@ public void testGenericInterfaceGenericCollectionArgExecution() { testBean.saveAll(null); assertEquals(1, counterAspect.genericInterfaceGenericCollectionArgExecutionCount); } - + @Test public void testGenericInterfaceSubtypeGenericCollectionArgExecution() { testBean.saveAll(null); @@ -96,21 +96,21 @@ static class CounterAspect { int genericInterfaceGenericArgExecutionCount; int genericInterfaceGenericCollectionArgExecutionCount; int genericInterfaceSubtypeGenericCollectionArgExecutionCount; - + public void reset() { genericInterfaceGenericArgExecutionCount = 0; genericInterfaceGenericCollectionArgExecutionCount = 0; genericInterfaceSubtypeGenericCollectionArgExecutionCount = 0; } - + @Pointcut("execution(* org.springframework.aop.aspectj.generic.GenericParameterMatchingTests.GenericInterface.save(..))") - public void genericInterfaceGenericArgExecution() {} - + public void genericInterfaceGenericArgExecution() {} + @Pointcut("execution(* org.springframework.aop.aspectj.generic.GenericParameterMatchingTests.GenericInterface.saveAll(..))") - public void GenericInterfaceGenericCollectionArgExecution() {} + public void GenericInterfaceGenericCollectionArgExecution() {} @Pointcut("execution(* org.springframework.aop.aspectj.generic.GenericParameterMatchingTests.GenericInterface+.saveAll(..))") - public void genericInterfaceSubtypeGenericCollectionArgExecution() {} + public void genericInterfaceSubtypeGenericCollectionArgExecution() {} @Before("genericInterfaceGenericArgExecution()") public void incrementGenericInterfaceGenericArgExecution() { diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests.java index 01ffc09ec777..9a0ddffb8f99 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerAdviceTypeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public final class AopNamespaceHandlerAdviceTypeTests { public void testParsingOfAdviceTypes() { new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-ok.xml", getClass()); } - + @Test public void testParsingOfAdviceTypesWithError() { try { diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests.java index 030d2539e2eb..45bd83f77e57 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerArgNamesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public final class AopNamespaceHandlerArgNamesTests { public void testArgNamesOK() { new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-ok.xml", getClass()); } - + @Test public void testArgNamesError() { try { diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java index 417512a71ef2..2bce8ddd6670 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests.java index 3e1d3f0a47f8..fed5ac1eb5ef 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerReturningTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public final class AopNamespaceHandlerReturningTests { public void testReturningOnReturningAdvice() { new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-ok.xml", getClass()); } - + @Test public void testParseReturningOnOtherAdviceType() { try { diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java index 21dd905a33a0..25381dc1a980 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ /** * Unit tests for aop namespace. - * + * * @author Rob Harrop * @author Chris Beams */ @@ -40,7 +40,7 @@ public class AopNamespaceHandlerTests { private ApplicationContext context; - + @Before public void setUp() { this.context = @@ -128,7 +128,7 @@ public void myAroundAdvice(ProceedingJoinPoint pjp) throws Throwable { this.aroundCount++; pjp.proceed(); } - + public void myAfterReturningAdvice(int age) { this.afterCount++; } @@ -136,11 +136,11 @@ public void myAfterReturningAdvice(int age) { public void myAfterThrowingAdvice(RuntimeException ex) { this.afterCount++; } - + public void mySetAgeAdvice(int newAge, ITestBean bean) { // no-op } - + public int getBeforeCount() { return this.beforeCount; } diff --git a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests.java b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests.java index 7533dc41966b..4af0a3b292ff 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerThrowingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public final class AopNamespaceHandlerThrowingTests { public void testThrowingOnThrowingAdvice() { new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-ok.xml", getClass()); } - + @Test public void testParseThrowingOnOtherAdviceType() { try { diff --git a/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java index 2a469823c936..e5b70f6b1ccd 100644 --- a/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,15 +35,15 @@ public final class MethodLocatingFactoryBeanTests { private static final String BEAN_NAME = "string"; private MethodLocatingFactoryBean factory; private BeanFactory beanFactory; - + @Before public void setUp() { factory = new MethodLocatingFactoryBean(); - + // methods must set up expectations and call replay() manually for this mock beanFactory = createMock(BeanFactory.class); } - + @After public void tearDown() { verify(beanFactory); @@ -64,7 +64,7 @@ public void testGetObjectType() { @Test(expected=IllegalArgumentException.class) public void testWithNullTargetBeanName() { replay(beanFactory); - + factory.setMethodName("toString()"); factory.setBeanFactory(beanFactory); } @@ -72,7 +72,7 @@ public void testWithNullTargetBeanName() { @Test(expected=IllegalArgumentException.class) public void testWithEmptyTargetBeanName() { replay(beanFactory); - + factory.setTargetBeanName(""); factory.setMethodName("toString()"); factory.setBeanFactory(beanFactory); @@ -81,7 +81,7 @@ public void testWithEmptyTargetBeanName() { @Test(expected=IllegalArgumentException.class) public void testWithNullTargetMethodName() { replay(beanFactory); - + factory.setTargetBeanName(BEAN_NAME); factory.setBeanFactory(beanFactory); } @@ -89,7 +89,7 @@ public void testWithNullTargetMethodName() { @Test(expected=IllegalArgumentException.class) public void testWithEmptyTargetMethodName() { replay(beanFactory); - + factory.setTargetBeanName(BEAN_NAME); factory.setMethodName(""); factory.setBeanFactory(beanFactory); @@ -99,17 +99,18 @@ public void testWithEmptyTargetMethodName() { public void testWhenTargetBeanClassCannotBeResolved() { expect(beanFactory.getType(BEAN_NAME)).andReturn(null); replay(beanFactory); - + factory.setTargetBeanName(BEAN_NAME); factory.setMethodName("toString()"); factory.setBeanFactory(beanFactory); } + @SuppressWarnings("unchecked") @Test public void testSunnyDayPath() throws Exception { - expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); + expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); replay(beanFactory); - + factory.setTargetBeanName(BEAN_NAME); factory.setMethodName("toString()"); factory.setBeanFactory(beanFactory); @@ -120,11 +121,12 @@ public void testSunnyDayPath() throws Exception { assertEquals("Bingo", method.invoke("Bingo")); } + @SuppressWarnings("unchecked") @Test(expected=IllegalArgumentException.class) public void testWhereMethodCannotBeResolved() { - expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); + expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); replay(beanFactory); - + factory.setTargetBeanName(BEAN_NAME); factory.setMethodName("loadOfOld()"); factory.setBeanFactory(beanFactory); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java index 622805857d19..5faa6ae2b015 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java @@ -169,7 +169,7 @@ public void testManyProxies() { testManyProxies(howMany); sw.stop(); System.out.println(sw.getTotalTimeMillis()); - assertTrue("Proxy creation was too slow", sw.getTotalTimeMillis() < 5000); + assertTrue("Proxy creation was too slow", sw.getTotalTimeMillis() < 5000); } private void testManyProxies(int howMany) { @@ -512,6 +512,9 @@ public Object invoke(MethodInvocation invocation) throws Throwable { catch (UndeclaredThrowableException thrown) { assertEquals("exception matches", unexpectedException, thrown.getUndeclaredThrowable()); } + //catch (net.sf.cglib.proxy.UndeclaredThrowableException thrown) { + // assertEquals("exception matches", unexpectedException, thrown.getUndeclaredThrowable()); + //} catch (Exception ex) { ex.printStackTrace(); fail("Didn't expect exception: " + ex); @@ -544,6 +547,9 @@ public Object invoke(MethodInvocation invocation) throws Throwable { catch (RuntimeException thrown) { assertEquals("exception matches", unexpectedException, thrown); } + //catch (net.sf.cglib.proxy.UndeclaredThrowableException thrown) { + // assertEquals("exception matches", unexpectedException, thrown.getUndeclaredThrowable()); + //} } /** @@ -591,7 +597,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { //assertTrue(target.invocation.getProxy() == tb); // ((IOther) tb).absquatulate(); - //MethodInvocation minv = tii.invocation; + //MethodInvocation minv = tii.invocation; //assertTrue("invoked on iother, not " + minv.getMethod().getDeclaringClass(), minv.getMethod().getDeclaringClass() == IOther.class); //assertTrue(target.invocation == tii.invocation); } @@ -797,7 +803,7 @@ public void testCannotAddIntroductionAdviceWithUnimplementedInterface() throws T } /** - * Note that an introduction can't throw an unexpected checked exception, + * Note that an introduction can't throw an unexpected checked exception, * as it's constained by the interface. */ @Test @@ -1268,8 +1274,8 @@ public Object getTarget() throws Exception { return target; } - public void releaseTarget(Object target) throws Exception { - } + public void releaseTarget(Object target) throws Exception { + } }); // Just test anything: it will fail if context wasn't found @@ -1422,7 +1428,7 @@ public boolean matches(Method m, Class targetClass) { } assertEquals(6, cca.getCalls()); } - + @Test public void testBeforeAdviceThrowsException() { final RuntimeException rex = new RuntimeException(); @@ -1733,6 +1739,8 @@ public boolean matches(Method m, Class clazz) { protected static class TestStaticPointcutAdvice extends StaticMethodMatcherPointcutAdvisor { private String pattern; + + @SuppressWarnings("unused") private int count; public TestStaticPointcutAdvice(MethodInterceptor mi, String pattern) { @@ -1909,31 +1917,31 @@ public void noAdvice() { } } - + @SuppressWarnings("serial") public static class CountingMultiAdvice extends MethodCounter implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice { - + public void before(Method m, Object[] args, Object target) throws Throwable { count(m); } - + public void afterReturning(Object o, Method m, Object[] args, Object target) throws Throwable { count(m); } - + public void afterThrowing(IOException ex) throws Throwable { count(IOException.class.getName()); } - + public void afterThrowing(UncheckedException ex) throws Throwable { count(UncheckedException.class.getName()); } - + } - - + + @SuppressWarnings("serial") public static class CountingThrowsAdvice extends MethodCounter implements ThrowsAdvice { @@ -1946,36 +1954,36 @@ public void afterThrowing(UncheckedException ex) throws Throwable { } } - + @SuppressWarnings("serial") static class UncheckedException extends RuntimeException { - + } - + @SuppressWarnings("serial") static class SpecializedUncheckedException extends UncheckedException { public SpecializedUncheckedException(String string, SQLException exception) { } - + } - - + + static class MockTargetSource implements TargetSource { - + private Object target; - + public int gets; - + public int releases; - + public void reset() { this.target = null; gets = releases = 0; } - + public void setTarget(Object target) { this.target = target; } @@ -2003,7 +2011,7 @@ public void releaseTarget(Object pTarget) throws Exception { throw new RuntimeException("Released wrong target"); ++releases; } - + /** * Check that gets and releases match * @@ -2021,8 +2029,8 @@ public boolean isStatic() { } } - - + + static abstract class ExposedInvocationTestBean extends TestBean { public String getName() { @@ -2036,18 +2044,18 @@ public void absquatulate() { assertions(invocation); super.absquatulate(); } - + protected abstract void assertions(MethodInvocation invocation); } - - + + static class InvocationCheckExposedInvocationTestBean extends ExposedInvocationTestBean { protected void assertions(MethodInvocation invocation) { TestCase.assertTrue(invocation.getThis() == this); - TestCase.assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(), + TestCase.assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(), ITestBean.class.isAssignableFrom(invocation.getMethod().getDeclaringClass())); } } - + } diff --git a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java index 8a2106c58fde..8d06b13dd515 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java @@ -55,7 +55,7 @@ @SuppressWarnings("serial") public final class CglibProxyTests extends AbstractAopProxyTests implements Serializable { - private static final String DEPENDENCY_CHECK_CONTEXT = CglibProxyTests.class.getSimpleName() + "-with-dependency-checking.xml"; + private static final String DEPENDENCY_CHECK_CONTEXT = CglibProxyTests.class.getSimpleName() + "-with-dependency-checking.xml"; protected Object createProxy(ProxyCreatorSupport as) { @@ -134,6 +134,7 @@ public void testProxyCanBeClassNotInterface() throws Exception { @Test public void testCglibProxyingGivesMeaningfulExceptionIfAskedToProxyNonvisibleClass() { class YouCantSeeThis { + @SuppressWarnings("unused") void hidden() { } } @@ -227,7 +228,7 @@ public boolean equals(Object obj) { return (ITestBean) pf.getProxy(); } - + @Test public void testMultipleProxiesForIntroductionAdvisor() { TestBean target = new TestBean(); @@ -243,7 +244,7 @@ public void testMultipleProxiesForIntroductionAdvisor() { private ITestBean getIntroductionAdvisorProxy(TestBean target) { ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); pf.setProxyTargetClass(true); - + pf.addAdvisor(new LockMixinAdvisor()); pf.setTarget(target); pf.setFrozen(true); @@ -462,15 +463,15 @@ public String getName() { class NoArgCtorTestBean { private boolean called = false; - + public NoArgCtorTestBean(String x, int y) { called = true; } - + public boolean wasCalled() { return called; } - + public void reset() { called = false; } diff --git a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java index 2e394ed68f77..cd1fe39c57ce 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,16 +48,16 @@ protected Object createProxy(ProxyCreatorSupport as) { assertTrue("Should be a JDK proxy: " + proxy.getClass(), AopUtils.isJdkDynamicProxy(proxy)); return proxy; } - + protected AopProxy createAopProxy(AdvisedSupport as) { return new JdkDynamicAopProxy(as); } - + public void testNullConfig() { try { new JdkDynamicAopProxy(null); fail("Shouldn't allow null interceptors"); - } + } catch (IllegalArgumentException ex) { // Ok } @@ -91,16 +91,16 @@ public void testInterceptorIsInvokedWithNoTarget() throws Throwable { assertTrue("correct return value", tb.getAge() == age); verify(mi); } - + public void testTargetCanGetInvocationWithPrivateClass() throws Throwable { final ExposedInvocationTestBean expectedTarget = new ExposedInvocationTestBean() { protected void assertions(MethodInvocation invocation) { assertTrue(invocation.getThis() == this); - assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(), + assertTrue("Invocation should be on ITestBean: " + invocation.getMethod(), invocation.getMethod().getDeclaringClass() == ITestBean.class); } }; - + AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class, IOther.class }); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); TrapTargetInterceptor tii = new TrapTargetInterceptor() { @@ -118,7 +118,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { tb.getName(); // Not safe to trap invocation //assertTrue(tii.invocation == target.invocation); - + //assertTrue(target.invocation.getProxy() == tb); // ((IOther) tb).absquatulate(); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java index 45d575bb4aee..852a37f99982 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationListener; import org.springframework.context.TestListener; import org.springframework.core.io.ClassPathResource; @@ -71,10 +71,10 @@ * @author Chris Beams */ public final class ProxyFactoryBeanTests { - + private static final Class CLASS = ProxyFactoryBeanTests.class; private static final String CLASSNAME = CLASS.getSimpleName(); - + private static final String CONTEXT = CLASSNAME + "-context.xml"; private static final String SERIALIZATION_CONTEXT = CLASSNAME + "-serialization.xml"; private static final String AUTOWIRING_CONTEXT = CLASSNAME + "-autowiring.xml"; @@ -86,14 +86,14 @@ public final class ProxyFactoryBeanTests { private static final String PROTOTYPE_CONTEXT = CLASSNAME + "-prototype.xml"; private static final String THROWS_ADVICE_CONTEXT = CLASSNAME + "-throws-advice.xml"; private static final String INNER_BEAN_TARGET_CONTEXT = CLASSNAME + "-inner-bean-target.xml"; - + private BeanFactory factory; @Before public void setUp() throws Exception { DefaultListableBeanFactory parent = new DefaultListableBeanFactory(); parent.registerBeanDefinition("target2", new RootBeanDefinition(TestListener.class)); - this.factory = new XmlBeanFactory(new ClassPathResource(CONTEXT, getClass()), parent); + this.factory = createBeanFactory(CONTEXT, parent); } @Test @@ -133,7 +133,7 @@ public void testDoubleTargetSourcesAreRejected() { private void testDoubleTargetSourceIsRejected(String name) { try { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(DBL_TARGETSOURCE_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(DBL_TARGETSOURCE_CONTEXT); bf.getBean(name); fail("Should not allow TargetSource to be specified in interceptorNames as well as targetSource property"); } @@ -147,7 +147,7 @@ private void testDoubleTargetSourceIsRejected(String name) { @Test public void testTargetSourceNotAtEndOfInterceptorNamesIsRejected() { try { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(NOTLAST_TARGETSOURCE_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(NOTLAST_TARGETSOURCE_CONTEXT); bf.getBean("targetSourceNotLast"); fail("TargetSource or non-advised object must be last in interceptorNames"); } @@ -160,7 +160,7 @@ public void testTargetSourceNotAtEndOfInterceptorNamesIsRejected() { @Test public void testGetObjectTypeWithDirectTarget() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(TARGETSOURCE_CONTEXT); // We have a counting before advice here CountingBeforeAdvice cba = (CountingBeforeAdvice) bf.getBean("countingBeforeAdvice"); @@ -176,7 +176,7 @@ public void testGetObjectTypeWithDirectTarget() { @Test public void testGetObjectTypeWithTargetViaTargetSource() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(TARGETSOURCE_CONTEXT); ITestBean tb = (ITestBean) bf.getBean("viaTargetSource"); assertTrue(tb.getName().equals("Adam")); ProxyFactoryBean pfb = (ProxyFactoryBean) bf.getBean("&viaTargetSource"); @@ -185,7 +185,7 @@ public void testGetObjectTypeWithTargetViaTargetSource() { @Test public void testGetObjectTypeWithNoTargetOrTargetSource() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(TARGETSOURCE_CONTEXT); ITestBean tb = (ITestBean) bf.getBean("noTarget"); try { @@ -243,10 +243,10 @@ public void testPrototypeInstancesAreNotEqual() { * be a prototype */ private Object testPrototypeInstancesAreIndependent(String beanName) { - // Initial count value set in bean factory XML + // Initial count value set in bean factory XML int INITIAL_COUNT = 10; - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(PROTOTYPE_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(PROTOTYPE_CONTEXT); // Check it works without AOP SideEffectBean raw = (SideEffectBean) bf.getBean("prototypeTarget"); @@ -301,7 +301,7 @@ public void testCanGetFactoryReferenceAndManipulate() { assertTrue("Has correct object type", ITestBean.class.isAssignableFrom(factory.getType("test1"))); ITestBean tb = (ITestBean) factory.getBean("test1"); - // no exception + // no exception tb.hashCode(); final Exception ex = new UnsupportedOperationException("invoke"); @@ -313,12 +313,12 @@ public Object invoke(MethodInvocation invocation) throws Throwable { }); assertEquals("Have correct advisor count", 2, config.getAdvisors().length); - tb = (ITestBean) factory.getBean("test1"); + tb = (ITestBean) factory.getBean("test1"); try { // Will fail now tb.toString(); fail("Evil interceptor added programmatically should fail all method calls"); - } + } catch (Exception thrown) { assertTrue(thrown == ex); } @@ -337,7 +337,7 @@ public DependsOnITestBean(ITestBean tb) { */ @Test public void testTargetAsInnerBean() { - ListableBeanFactory bf = new XmlBeanFactory(new ClassPathResource(INNER_BEAN_TARGET_CONTEXT, CLASS)); + ListableBeanFactory bf = createBeanFactory(INNER_BEAN_TARGET_CONTEXT); ITestBean itb = (ITestBean) bf.getBean("testBean"); assertEquals("innerBeanTarget", itb.getName()); assertEquals("Only have proxy and interceptor: no target", 3, bf.getBeanDefinitionCount()); @@ -440,7 +440,7 @@ public void testMethodPointcuts() { @Test public void testCanAddThrowsAdviceWithoutAdvisor() throws Throwable { - BeanFactory f = new XmlBeanFactory(new ClassPathResource(THROWS_ADVICE_CONTEXT, CLASS)); + BeanFactory f = createBeanFactory(THROWS_ADVICE_CONTEXT); MyThrowsHandler th = (MyThrowsHandler) f.getBean("throwsAdvice"); CountingBeforeAdvice cba = (CountingBeforeAdvice) f.getBean("countingBeforeAdvice"); assertEquals(0, cba.getCalls()); @@ -497,7 +497,7 @@ public void testNoInterceptorNamesWithTarget() { @Test public void testEmptyInterceptorNames() { - XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource(INVALID_CONTEXT, CLASS)); + DefaultListableBeanFactory factory = createBeanFactory(INVALID_CONTEXT); try { factory.getBean("emptyInterceptorNames"); fail("Interceptor names cannot be empty"); @@ -512,7 +512,7 @@ public void testEmptyInterceptorNames() { */ @Test public void testGlobalsWithoutTarget() { - XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource(INVALID_CONTEXT, CLASS)); + DefaultListableBeanFactory factory = createBeanFactory(INVALID_CONTEXT); try { factory.getBean("globalsWithoutTarget"); fail("Should require target name"); @@ -539,7 +539,7 @@ public void testGlobalsCanAddAspectInterfaces() { // 2 globals + 2 explicit assertEquals("Have 2 globals and 2 explicit advisors", 3, pfb.getAdvisors().length); - ApplicationListener l = (ApplicationListener) factory.getBean("validGlobals"); + ApplicationListener l = (ApplicationListener) factory.getBean("validGlobals"); agi = (AddedGlobalInterface) l; assertTrue(agi.globalsAdded() == -1); @@ -553,7 +553,7 @@ public void testGlobalsCanAddAspectInterfaces() { @Test public void testSerializableSingletonProxy() throws Exception { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(SERIALIZATION_CONTEXT); Person p = (Person) bf.getBean("serializableSingleton"); assertSame("Should be a Singleton", p, bf.getBean("serializableSingleton")); Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(p); @@ -570,12 +570,12 @@ public void testSerializableSingletonProxy() throws Exception { // Remove offending interceptor... assertTrue(((Advised) p).removeAdvice(nop)); - assertTrue("Serializable again because offending interceptor was removed", SerializationTestUtils.isSerializable(p)); + assertTrue("Serializable again because offending interceptor was removed", SerializationTestUtils.isSerializable(p)); } @Test public void testSerializablePrototypeProxy() throws Exception { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(SERIALIZATION_CONTEXT); Person p = (Person) bf.getBean("serializablePrototype"); assertNotSame("Should not be a Singleton", p, bf.getBean("serializablePrototype")); Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(p); @@ -586,7 +586,7 @@ public void testSerializablePrototypeProxy() throws Exception { @Test public void testSerializableSingletonProxyFactoryBean() throws Exception { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(SERIALIZATION_CONTEXT); Person p = (Person) bf.getBean("serializableSingleton"); ProxyFactoryBean pfb = (ProxyFactoryBean) bf.getBean("&serializableSingleton"); ProxyFactoryBean pfb2 = (ProxyFactoryBean) SerializationTestUtils.serializeAndDeserialize(pfb); @@ -598,14 +598,14 @@ public void testSerializableSingletonProxyFactoryBean() throws Exception { @Test public void testProxyNotSerializableBecauseOfAdvice() throws Exception { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(SERIALIZATION_CONTEXT); Person p = (Person) bf.getBean("interceptorNotSerializableSingleton"); assertFalse("Not serializable because an interceptor isn't serializable", SerializationTestUtils.isSerializable(p)); } @Test public void testPrototypeAdvisor() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(CONTEXT); ITestBean bean1 = (ITestBean) bf.getBean("prototypeTestBeanProxy"); ITestBean bean2 = (ITestBean) bf.getBean("prototypeTestBeanProxy"); @@ -636,7 +636,7 @@ public void testPrototypeAdvisor() { @Test public void testPrototypeInterceptorSingletonTarget() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(CONTEXT); ITestBean bean1 = (ITestBean) bf.getBean("prototypeTestBeanProxySingletonTarget"); ITestBean bean2 = (ITestBean) bf.getBean("prototypeTestBeanProxySingletonTarget"); @@ -670,16 +670,16 @@ public void testPrototypeInterceptorSingletonTarget() { */ @Test public void testInnerBeanTargetUsingAutowiring() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(AUTOWIRING_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(AUTOWIRING_CONTEXT); bf.getBean("testBean"); } @Test public void testFrozenFactoryBean() { - BeanFactory bf = new XmlBeanFactory(new ClassPathResource(FROZEN_CONTEXT, CLASS)); + BeanFactory bf = createBeanFactory(FROZEN_CONTEXT); - Advised advised = (Advised)bf.getBean("frozen"); - assertTrue("The proxy should be frozen", advised.isFrozen()); + Advised advised = (Advised) bf.getBean("frozen"); + assertTrue("The proxy should be frozen", advised.isFrozen()); } @Test @@ -691,6 +691,19 @@ public void testDetectsInterfaces() throws Exception { ITestBean proxy = (ITestBean) fb.getObject(); assertTrue(AopUtils.isJdkDynamicProxy(proxy)); } + + private DefaultListableBeanFactory createBeanFactory(String resource) { + return createBeanFactory(resource, null); + } + + private DefaultListableBeanFactory createBeanFactory(String resource, + DefaultListableBeanFactory parent) { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(parent); + new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(new ClassPathResource( + resource, getClass())); + return beanFactory; + } + /** * Fires only on void methods. Saves list of methods intercepted. */ @@ -728,7 +741,7 @@ public interface AddedGlobalInterface { /** - * Use as a global interceptor. Checks that + * Use as a global interceptor. Checks that * global interceptors can add aspect interfaces. * NB: Add only via global interceptors in XML file. */ diff --git a/spring-context/src/test/java/org/springframework/aop/framework/_TestTypes.java b/spring-context/src/test/java/org/springframework/aop/framework/_TestTypes.java index ea9f35a7889e..1e188555f175 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/_TestTypes.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/_TestTypes.java @@ -3,12 +3,12 @@ /** * Definitions of testing types for use in within this package. * Wherever possible, test types should be defined local to the java - * file that makes use of them. In some cases however, a test type may - * need to be shared across tests. Such types reside here, with the + * file that makes use of them. In some cases however, a test type may + * need to be shared across tests. Such types reside here, with the * intention of reducing the surface area of java files within this - * package. This allows developers to think about tests first, and deal + * package. This allows developers to think about tests first, and deal * with these second class testing artifacts on an as-needed basis. - * + * * Types here should be defined as package-private top level classes in * order to avoid needing to fully qualify, e.g.: _TestTypes$Foo. * @@ -26,7 +26,7 @@ interface IEcho { class Echo implements IEcho { private int a; - + public int echoException(int i, Throwable t) throws Throwable { if (t != null) throw t; @@ -38,4 +38,4 @@ public void setA(int a) { public int getA() { return a; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java index 39dc7410b81e..ac4f32f48256 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java @@ -135,4 +135,5 @@ public Object invoke(MethodInvocation mi) throws Throwable { advice.before(); return mi.proceed(); } + } diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java index 675c2c79af6d..1dd11c1583d8 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,8 +40,8 @@ /** * Tests for auto proxy creation by advisor recognition. - * - * @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorIntegrationTests; + * + * @see org.springframework.aop.framework.autoproxy.AdvisorAutoProxyCreatorIntegrationTests * * @author Rod Johnson * @author Dave Syer @@ -51,16 +51,13 @@ public final class AdvisorAutoProxyCreatorTests { private static final Class CLASS = AdvisorAutoProxyCreatorTests.class; private static final String CLASSNAME = CLASS.getSimpleName(); - + private static final String DEFAULT_CONTEXT = CLASSNAME + "-context.xml"; private static final String COMMON_INTERCEPTORS_CONTEXT = CLASSNAME + "-common-interceptors.xml"; private static final String CUSTOM_TARGETSOURCE_CONTEXT = CLASSNAME + "-custom-targetsource.xml"; private static final String QUICK_TARGETSOURCE_CONTEXT = CLASSNAME + "-quick-targetsource.xml"; private static final String OPTIMIZED_CONTEXT = CLASSNAME + "-optimized.xml"; - private static final String ADVISOR_APC_BEAN_NAME = "aapc"; - private static final String TXMANAGER_BEAN_NAME = "txManager"; - /** * Return a bean factory with attributes and EnterpriseServices configured. */ @@ -85,7 +82,7 @@ public void testCommonInterceptorAndAdvisor() throws Exception { ITestBean test2 = (ITestBean) bf.getBean("test2"); Lockable lockable2 = (Lockable) test2; - + // Locking should be independent; nop is shared assertFalse(lockable1.locked()); assertFalse(lockable2.locked()); @@ -151,7 +148,7 @@ public void testQuickTargetSourceCreator() throws Exception { assertEquals("Rod", test.getName()); // Check that references survived pooling assertEquals("Kerry", test.getSpouse().getName()); - + // Now test the pooled one test = (ITestBean) bf.getBean(":test"); assertTrue(AopUtils.isAopProxy(test)); @@ -160,7 +157,7 @@ public void testQuickTargetSourceCreator() throws Exception { assertEquals("Rod", test.getName()); // Check that references survived pooling assertEquals("Kerry", test.getSpouse().getName()); - + // Now test the ThreadLocal one test = (ITestBean) bf.getBean("%test"); assertTrue(AopUtils.isAopProxy(test)); @@ -169,7 +166,7 @@ public void testQuickTargetSourceCreator() throws Exception { assertEquals("Rod", test.getName()); // Check that references survived pooling assertEquals("Kerry", test.getSpouse().getName()); - + // Now test the Prototype TargetSource test = (ITestBean) bf.getBean("!test"); assertTrue(AopUtils.isAopProxy(test)); @@ -186,7 +183,7 @@ public void testQuickTargetSourceCreator() throws Exception { assertEquals("Kerry", test2.getSpouse().getName()); bf.close(); } - + @Test public void testWithOptimizedProxy() throws Exception { BeanFactory beanFactory = new ClassPathXmlApplicationContext(OPTIMIZED_CONTEXT, CLASS); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java index f8b0e7a01ff8..398cde8beff4 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java @@ -55,7 +55,8 @@ public void testBeanNameAutoProxyCreator() { proxyCreator.getPropertyValues().add("beanNames", "singletonToBeProxied,innerBean,singletonFactoryToBeProxied"); sac.getDefaultListableBeanFactory().registerBeanDefinition("beanNameAutoProxyCreator", proxyCreator); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); + bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE); RootBeanDefinition innerBean = new RootBeanDefinition(TestBean.class); bd.getPropertyValues().add("spouse", new BeanDefinitionHolder(innerBean, "innerBean")); sac.getDefaultListableBeanFactory().registerBeanDefinition("singletonToBeProxied", bd); diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java index 93a4b20b322c..68efb61b235d 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public void testJdkIntroduction() { assertEquals(age, tb.getAge()); assertTrue("Introduction was made", tb instanceof TimeStamped); assertEquals(0, ((TimeStamped) tb).getTimeStamp()); - assertEquals(3, nop.getCount()); + assertEquals(3, nop.getCount()); assertEquals("introductionUsingJdk", tb.getName()); ITestBean tb2 = (ITestBean) beanFactory.getBean("second-introductionUsingJdk"); @@ -124,10 +124,10 @@ public void testJdkIntroductionAppliesToCreatedObjectsNotFactoryBean() { assertEquals(age, tb.getAge()); assertTrue("Introduction was made", tb instanceof TimeStamped); assertEquals(0, ((TimeStamped) tb).getTimeStamp()); - assertEquals(3, nop.getCount()); - + assertEquals(3, nop.getCount()); + ITestBean tb2 = (ITestBean) beanFactory.getBean("second-introductionUsingJdk"); - + // Check two per-instance mixins were distinct Lockable lockable1 = (Lockable) tb; Lockable lockable2 = (Lockable) tb2; @@ -171,7 +171,7 @@ public void testWithFrozenProxy() { assertTrue(((Advised)testBean).isFrozen()); } - private void jdkAssertions(ITestBean tb, int nopInterceptorCount) { + private void jdkAssertions(ITestBean tb, int nopInterceptorCount) { NopInterceptor nop = (NopInterceptor) beanFactory.getBean("nopInterceptor"); assertEquals(0, nop.getCount()); assertTrue(AopUtils.isJdkDynamicProxy(tb)); @@ -194,7 +194,7 @@ private void cglibAssertions(TestBean tb) { tb.setAge(age); assertEquals(age, tb.getAge()); assertEquals(2, nop.getCount()); - assertEquals(2, cba.getCalls()); + assertEquals(2, cba.getCalls()); } } @@ -223,4 +223,4 @@ public boolean isSingleton() { return true; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java index 8c3cfa094b1f..2f63ee32b264 100644 --- a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,8 @@ import org.springframework.beans.ITestBean; import org.springframework.beans.TestBean; import org.springframework.beans.factory.config.SimpleMapScope; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.util.SerializationTestUtils; @@ -39,10 +39,10 @@ * @author Chris Beams */ public class ScopedProxyTests { - + private static final Class CLASS = ScopedProxyTests.class; private static final String CLASSNAME = CLASS.getSimpleName(); - + private static final ClassPathResource LIST_CONTEXT = new ClassPathResource(CLASSNAME + "-list.xml", CLASS); private static final ClassPathResource MAP_CONTEXT = new ClassPathResource(CLASSNAME + "-map.xml", CLASS); private static final ClassPathResource OVERRIDE_CONTEXT = new ClassPathResource(CLASSNAME + "-override.xml", CLASS); @@ -51,14 +51,16 @@ public class ScopedProxyTests { /* SPR-2108 */ @Test public void testProxyAssignable() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(MAP_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT); Object baseMap = bf.getBean("singletonMap"); assertTrue(baseMap instanceof Map); } @Test public void testSimpleProxy() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(MAP_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT); Object simpleMap = bf.getBean("simpleMap"); assertTrue(simpleMap instanceof Map); assertTrue(simpleMap instanceof HashMap); @@ -82,7 +84,8 @@ public void testScopedOverride() throws Exception { @Test public void testJdkScopedProxy() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(TESTBEAN_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(TESTBEAN_CONTEXT); bf.setSerializationId("X"); SimpleMapScope scope = new SimpleMapScope(); bf.registerScope("request", scope); @@ -111,7 +114,8 @@ public void testJdkScopedProxy() throws Exception { @Test public void testCglibScopedProxy() throws Exception { - XmlBeanFactory bf = new XmlBeanFactory(LIST_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(LIST_CONTEXT); bf.setSerializationId("Y"); SimpleMapScope scope = new SimpleMapScope(); bf.registerScope("request", scope); @@ -126,7 +130,8 @@ public void testCglibScopedProxy() throws Exception { assertTrue(scope.getMap().containsKey("scopedTarget.scopedList")); assertEquals(ArrayList.class, scope.getMap().get("scopedTarget.scopedList").getClass()); - ArrayList deserialized = (ArrayList) SerializationTestUtils.serializeAndDeserialize(tb.getFriends()); + @SuppressWarnings("unchecked") + ArrayList deserialized = (ArrayList) SerializationTestUtils.serializeAndDeserialize(tb.getFriends()); assertNotNull(deserialized); assertTrue(AopUtils.isCglibProxy(deserialized)); assertTrue(deserialized.contains("myFriend")); diff --git a/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java b/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java index 1cada3e6d8ba..a31f6a8a37cb 100644 --- a/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,8 @@ import org.springframework.aop.framework.Advised; import org.springframework.beans.Person; import org.springframework.beans.SerializablePerson; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.util.SerializationTestUtils; @@ -50,11 +51,12 @@ public class CommonsPoolTargetSourceTests { */ private static final int INITIAL_COUNT = 10; - private XmlBeanFactory beanFactory; + private DefaultListableBeanFactory beanFactory; @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass())); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass())); } /** diff --git a/spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java b/spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java index bb5e71f5cd07..18ddbd3b78be 100644 --- a/spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java +++ b/spring-context/src/test/java/org/springframework/beans/BeanWithObjectProperty.java @@ -32,4 +32,4 @@ public void setObject(Object object) { this.object = object; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/Colour.java b/spring-context/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..8ee70cc536c4 100644 --- a/spring-context/src/test/java/org/springframework/beans/Colour.java +++ b/spring-context/src/test/java/org/springframework/beans/Colour.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ /** * @author Rob Harrop */ +@SuppressWarnings("deprecation") public class Colour extends ShortCodedLabeledEnum { public static final Colour RED = new Colour(0, "RED"); @@ -32,4 +33,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java index 2bb41a9d5b68..db326041c361 100644 --- a/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/DerivedTestBean.java @@ -82,4 +82,4 @@ public boolean wasDestroyed() { return destroyed; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java b/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java index 61f911902c7b..f367fb5d6e32 100644 --- a/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java +++ b/spring-context/src/test/java/org/springframework/beans/FieldAccessBean.java @@ -41,4 +41,4 @@ public TestBean getSpouse() { return spouse; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/IOther.java b/spring-context/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-context/src/test/java/org/springframework/beans/IOther.java +++ b/spring-context/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/ITestBean.java b/spring-context/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-context/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..f547813f0fb2 100644 --- a/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,18 +34,17 @@ public class IndexedTestBean { private TestBean[] array; - private Collection collection; + private Collection collection; - private List list; + private List list; - private Set set; + private Set set; - private SortedSet sortedSet; + private SortedSet sortedSet; - private Map map; - - private SortedMap sortedMap; + private Map map; + private SortedMap sortedMap; public IndexedTestBean() { this(true); @@ -69,17 +68,17 @@ public void populate() { TestBean tbX = new TestBean("nameX", 0); TestBean tbY = new TestBean("nameY", 0); this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); + this.list = new ArrayList(); this.list.add(tb2); this.list.add(tb3); - this.set = new TreeSet(); + this.set = new TreeSet(); this.set.add(tb6); this.set.add(tb7); - this.map = new HashMap(); + this.map = new HashMap(); this.map.put("key1", tb4); this.map.put("key2", tb5); this.map.put("key.3", tb5); - List list = new ArrayList(); + List list = new ArrayList(); list.add(tbX); list.add(tbY); this.map.put("key4", list); @@ -94,52 +93,52 @@ public void setArray(TestBean[] array) { this.array = array; } - public Collection getCollection() { + public Collection getCollection() { return collection; } - public void setCollection(Collection collection) { + public void setCollection(Collection collection) { this.collection = collection; } - public List getList() { + public List getList() { return list; } - public void setList(List list) { + public void setList(List list) { this.list = list; } - public Set getSet() { + public Set getSet() { return set; } - public void setSet(Set set) { + public void setSet(Set set) { this.set = set; } - public SortedSet getSortedSet() { + public SortedSet getSortedSet() { return sortedSet; } - public void setSortedSet(SortedSet sortedSet) { + public void setSortedSet(SortedSet sortedSet) { this.sortedSet = sortedSet; } - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public SortedMap getSortedMap() { + public SortedMap getSortedMap() { return sortedMap; } - public void setSortedMap(SortedMap sortedMap) { + public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/Person.java b/spring-context/src/test/java/org/springframework/beans/Person.java index 3ebce5e2ea0a..763cfa92e134 100644 --- a/spring-context/src/test/java/org/springframework/beans/Person.java +++ b/spring-context/src/test/java/org/springframework/beans/Person.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,4 +33,4 @@ public interface Person { * returned. */ Object echo(Object o) throws Throwable; -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java b/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java index 36351352aab8..275cc2750529 100644 --- a/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java +++ b/spring-context/src/test/java/org/springframework/beans/SerializablePerson.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -61,4 +61,4 @@ public boolean equals(Object other) { return p.age == age && ObjectUtils.nullSafeEquals(name, p.name); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/TestBean.java b/spring-context/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..38bc8a9d8578 100644 --- a/spring-context/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/TestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ * @author Juergen Hoeller * @since 15 April 2001 */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { +public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { private String beanName; @@ -70,13 +70,13 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Float myFloat = new Float(0.0); - private Collection friends = new LinkedList(); + private Collection friends = new LinkedList(); - private Set someSet = new HashSet(); + private Set someSet = new HashSet(); - private Map someMap = new HashMap(); + private Map someMap = new HashMap(); - private List someList = new ArrayList(); + private List someList = new ArrayList(); private Properties someProperties = new Properties(); @@ -94,9 +94,9 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Boolean someBoolean; - private List otherColours; + private List otherColours; - private List pets; + private List pets; public TestBean() { @@ -120,15 +120,15 @@ public TestBean(ITestBean spouse, Properties someProperties) { this.someProperties = someProperties; } - public TestBean(List someList) { + public TestBean(List someList) { this.someList = someList; } - public TestBean(Set someSet) { + public TestBean(Set someSet) { this.someSet = someSet; } - public TestBean(Map someMap) { + public TestBean(Map someMap) { this.someMap = someMap; } @@ -262,35 +262,35 @@ public void setMyFloat(Float myFloat) { this.myFloat = myFloat; } - public Collection getFriends() { + public Collection getFriends() { return friends; } - public void setFriends(Collection friends) { + public void setFriends(Collection friends) { this.friends = friends; } - public Set getSomeSet() { + public Set getSomeSet() { return someSet; } - public void setSomeSet(Set someSet) { + public void setSomeSet(Set someSet) { this.someSet = someSet; } - public Map getSomeMap() { + public Map getSomeMap() { return someMap; } - public void setSomeMap(Map someMap) { + public void setSomeMap(Map someMap) { this.someMap = someMap; } - public List getSomeList() { + public List getSomeList() { return someList; } - public void setSomeList(List someList) { + public void setSomeList(List someList) { this.someList = someList; } @@ -350,19 +350,19 @@ public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { this.nestedIndexedBean = nestedIndexedBean; } - public List getOtherColours() { + public List getOtherColours() { return otherColours; } - public void setOtherColours(List otherColours) { + public void setOtherColours(List otherColours) { this.otherColours = otherColours; } - public List getPets() { + public List getPets() { return pets; } - public void setPets(List pets) { + public void setPets(List pets) { this.pets = pets; } @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java index a04d1796443a..93253e6ecfa5 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,7 +113,7 @@ public void testGetInstanceByMatchingClass() { public void testGetInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -147,7 +147,7 @@ public void testGetSharedInstanceByMatchingClassNoCatch() { public void testGetSharedInstanceByNonmatchingClass() { try { - Object o = getBeanFactory().getBean("rod", BeanFactory.class); + getBeanFactory().getBean("rod", BeanFactory.class); fail("Rod bean is not of type BeanFactory; getBeanInstance(rod, BeanFactory.class) should throw BeanNotOfRequiredTypeException"); } catch (BeanNotOfRequiredTypeException ex) { @@ -191,7 +191,7 @@ public void testPrototypeInstancesAreIndependent() { public void testNotThere() { assertFalse(getBeanFactory().containsBean("Mr Squiggle")); try { - Object o = getBeanFactory().getBean("Mr Squiggle"); + getBeanFactory().getBean("Mr Squiggle"); fail("Can't find missing bean"); } catch (BeansException ex) { @@ -215,7 +215,7 @@ public void testValidEmpty() { public void xtestTypeMismatch() { try { - Object o = getBeanFactory().getBean("typeMismatch"); + getBeanFactory().getBean("typeMismatch"); fail("Shouldn't succeed with type mismatch"); } catch (BeanCreationException wex) { @@ -269,7 +269,7 @@ public void testGetFactoryItself() throws Exception { * @throws Exception */ public void testFactoryIsInitialized() throws Exception { - TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory"); + getBeanFactory().getBean("singletonFactory"); DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory"); assertTrue("Factory was initialized because it implemented InitializingBean", factory.wasInitialized()); } @@ -326,4 +326,4 @@ public void setAsText(String text) { } } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java index d683491a1f64..a4c2a6d5b311 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java @@ -83,4 +83,4 @@ public void testContainsBeanDefinition() { Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java index 020e683d7d82..1277697b175c 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,8 @@ * @author Rod Johnson * @since 10.03.2003 */ -public class DummyFactory - implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { - +public class DummyFactory implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { + public static final String SINGLETON_NAME = "Factory singleton"; private static boolean prototypeCreated; @@ -125,7 +124,7 @@ public void afterPropertiesSet() { } this.initialized = true; } - + /** * Was this initialized by invocation of the * afterPropertiesSet() method from the InitializingBean interface? @@ -144,7 +143,7 @@ public static boolean wasPrototypeCreated() { * and prototype mode. * @see org.springframework.beans.factory.FactoryBean#getObject() */ - public Object getObject() throws BeansException { + public TestBean getObject() throws BeansException { if (isSingleton()) { return this.testBean; } @@ -158,7 +157,7 @@ public Object getObject() throws BeansException { } } - public Class getObjectType() { + public Class getObjectType() { return TestBean.class; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java b/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java index 3bac49498b5b..4b59cc0722a0 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/HasMap.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,35 +27,35 @@ * @since 05.06.2003 */ public class HasMap { - - private Map map; - private Set set; + private Map map; + + private Set set; private Properties props; - + private Object[] objectArray; - - private Class[] classArray; - + + private Class[] classArray; + private Integer[] intArray; private HasMap() { } - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public Set getSet() { + public Set getSet() { return set; } - public void setSet(Set set) { + public void setSet(Set set) { this.set = set; } @@ -75,11 +75,11 @@ public void setObjectArray(Object[] objectArray) { this.objectArray = objectArray; } - public Class[] getClassArray() { + public Class[] getClassArray() { return classArray; } - public void setClassArray(Class[] classArray) { + public void setClassArray(Class[] classArray) { this.classArray = classArray; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java b/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java index 19b7da62f8d3..89d35d4c8fe8 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/LifecycleBean.java @@ -155,4 +155,4 @@ public Object postProcessAfterInitialization(Object bean, String name) throws Be } } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java b/spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java index 1dedf6624c20..1dcc1aaf72d2 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/MustBeInitialized.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,15 +23,15 @@ */ public class MustBeInitialized implements InitializingBean { - private boolean inited; - + private boolean inited; + /** * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { this.inited = true; } - + /** * Dummy business method that will fail unless the factory * managed the bean's lifecycle correctly diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java b/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java index 9bdca2165cdd..0e8a09a5a78e 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/access/SingletonBeanFactoryLocatorTests.java @@ -32,7 +32,7 @@ public class SingletonBeanFactoryLocatorTests { public void testBasicFunctionality() { SingletonBeanFactoryLocator facLoc = new SingletonBeanFactoryLocator( "classpath*:" + ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); - + basicFunctionalityTest(facLoc); } @@ -75,7 +75,7 @@ public void testGetInstance() { BeanFactoryLocator facLoc = SingletonBeanFactoryLocator.getInstance( ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); getInstanceTest1(facLoc); - + facLoc = SingletonBeanFactoryLocator.getInstance( "classpath*:/" + ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); getInstanceTest2(facLoc); @@ -84,7 +84,7 @@ public void testGetInstance() { facLoc = SingletonBeanFactoryLocator.getInstance( "classpath:" + ClassUtils.addResourcePathToPackagePath(getClass(), "ref1.xml")); getInstanceTest3(facLoc); - + } /** @@ -103,12 +103,12 @@ protected void getInstanceTest1(BeanFactoryLocator facLoc) { fac = bfr3.getFactory(); tb = (TestBean) fac.getBean("beans1.bean1"); assertTrue(tb.getName().equals("was beans1.bean1")); - + BeanFactoryReference bfr4 = facLoc.useBeanFactory("a.qualified.name.which.is.an.alias"); fac = bfr4.getFactory(); tb = (TestBean) fac.getBean("beans1.bean1"); assertTrue(tb.getName().equals("was beans1.bean1")); - + bfr.release(); bfr3.release(); bfr2.release(); @@ -146,7 +146,7 @@ protected void getInstanceTest2(BeanFactoryLocator facLoc) { bfr4.release(); bfr3.release(); } - + /** * Worker method so subclass can use it too */ diff --git a/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java b/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java index eaf1d5ec0b07..5504e7440f82 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,14 +20,14 @@ /** * Scrap bean for use in tests. - * + * * @author Colin Sampaleanu */ public class TestBean { private String name; - private List list; + private List list; private Object objRef; @@ -48,14 +48,14 @@ public void setName(String name) { /** * @return Returns the list. */ - public List getList() { + public List getList() { return list; } /** * @param list The list to set. */ - public void setList(List list) { + public void setList(List list) { this.list = list; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java b/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java index 42fb9fd89d58..4c5ec9e7b343 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import java.io.Serializable; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -30,20 +29,20 @@ */ public class SimpleMapScope implements Scope, Serializable { - private final Map map = new HashMap(); + private final Map map = new HashMap(); - private final List callbacks = new LinkedList(); + private final List callbacks = new LinkedList(); public SimpleMapScope() { } - public final Map getMap() { + public final Map getMap() { return this.map; } - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { synchronized (this.map) { Object scopedObject = this.map.get(name); if (scopedObject == null) { @@ -69,8 +68,7 @@ public Object resolveContextualObject(String key) { } public void close() { - for (Iterator it = this.callbacks.iterator(); it.hasNext();) { - Runnable runnable = (Runnable) it.next(); + for (Runnable runnable : this.callbacks) { runnable.run(); } } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java index 74d6b48540ec..b76df5aae9a1 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,32 +19,31 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.springframework.core.CollectionFactory; - /** * @author Rob Harrop * @author Juergen Hoeller */ public class CollectingReaderEventListener implements ReaderEventListener { - private final List defaults = new LinkedList(); + private final List defaults = new LinkedList(); - private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8); + private final Map componentDefinitions = new LinkedHashMap(8); - private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8); + private final Map> aliasMap = new LinkedHashMap>(8); - private final List imports = new LinkedList(); + private final List imports = new LinkedList(); public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { this.defaults.add(defaultsDefinition); } - public List getDefaults() { + public List getDefaults() { return Collections.unmodifiableList(this.defaults); } @@ -53,25 +52,25 @@ public void componentRegistered(ComponentDefinition componentDefinition) { } public ComponentDefinition getComponentDefinition(String name) { - return (ComponentDefinition) this.componentDefinitions.get(name); + return this.componentDefinitions.get(name); } public ComponentDefinition[] getComponentDefinitions() { - Collection collection = this.componentDefinitions.values(); - return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]); + Collection collection = this.componentDefinitions.values(); + return collection.toArray(new ComponentDefinition[collection.size()]); } public void aliasRegistered(AliasDefinition aliasDefinition) { - List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); + List aliases = this.aliasMap.get(aliasDefinition.getBeanName()); if(aliases == null) { - aliases = new ArrayList(); + aliases = new ArrayList(); this.aliasMap.put(aliasDefinition.getBeanName(), aliases); } aliases.add(aliasDefinition); } - public List getAliases(String beanName) { - List aliases = (List) this.aliasMap.get(beanName); + public List getAliases(String beanName) { + List aliases = this.aliasMap.get(beanName); return aliases == null ? null : Collections.unmodifiableList(aliases); } @@ -79,7 +78,7 @@ public void importProcessed(ImportDefinition importDefinition) { this.imports.add(importDefinition); } - public List getImports() { + public List getImports() { return Collections.unmodifiableList(this.imports); } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java b/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java index 92921dbfb193..00dc41872e61 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ * @since 3.0 */ public class InjectAnnotationAutowireContextTests { - + private static final String JUERGEN = "juergen"; private static final String MARK = "mark"; @@ -56,7 +56,7 @@ public void testAutowiredFieldWithSingleNonQualifiedCandidate() { cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -76,7 +76,7 @@ public void testAutowiredMethodParameterWithSingleNonQualifiedCandidate() { cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -96,7 +96,7 @@ public void testAutowiredConstructorArgumentWithSingleNonQualifiedCandidate() { cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -132,11 +132,11 @@ public void testAutowiredMethodParameterWithSingleQualifiedCandidate() { RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); person.addQualifier(new AutowireCandidateQualifier(TestQualifier.class)); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedMethodParameterTestBean bean = + QualifiedMethodParameterTestBean bean = (QualifiedMethodParameterTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -186,11 +186,11 @@ public void testAutowiredConstructorArgumentWithSingleQualifiedCandidate() { RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); person.addQualifier(new AutowireCandidateQualifier(TestQualifier.class)); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedConstructorArgumentTestBean bean = + QualifiedConstructorArgumentTestBean bean = (QualifiedConstructorArgumentTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -206,7 +206,7 @@ public void testAutowiredFieldWithMultipleNonQualifiedCandidates() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -230,7 +230,7 @@ public void testAutowiredMethodParameterWithMultipleNonQualifiedCandidates() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -254,7 +254,7 @@ public void testAutowiredConstructorArgumentWithMultipleNonQualifiedCandidates() RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -279,7 +279,7 @@ public void testAutowiredFieldResolvesQualifiedCandidate() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); @@ -299,11 +299,11 @@ public void testAutowiredMethodParameterResolvesQualifiedCandidate() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedMethodParameterTestBean bean = + QualifiedMethodParameterTestBean bean = (QualifiedMethodParameterTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -320,11 +320,11 @@ public void testAutowiredConstructorArgumentResolvesQualifiedCandidate() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedConstructorArgumentTestBean bean = + QualifiedConstructorArgumentTestBean bean = (QualifiedConstructorArgumentTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -342,11 +342,11 @@ public void testAutowiredFieldResolvesQualifiedCandidateWithDefaultValueAndNoVal RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithDefaultValueTestBean bean = + QualifiedFieldWithDefaultValueTestBean bean = (QualifiedFieldWithDefaultValueTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -364,7 +364,7 @@ public void testAutowiredFieldDoesNotResolveCandidateWithDefaultValueAndConflict RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -390,11 +390,11 @@ public void testAutowiredFieldResolvesWithDefaultValueAndExplicitDefaultValueOnB RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithDefaultValueTestBean bean = + QualifiedFieldWithDefaultValueTestBean bean = (QualifiedFieldWithDefaultValueTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -416,11 +416,11 @@ public void testAutowiredFieldResolvesWithMultipleQualifierValues() { person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithMultipleAttributesTestBean bean = + QualifiedFieldWithMultipleAttributesTestBean bean = (QualifiedFieldWithMultipleAttributesTestBean) context.getBean("autowired"); assertEquals(MARK, bean.getPerson().getName()); } @@ -443,7 +443,7 @@ public void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndConfli person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -474,11 +474,11 @@ public void testAutowiredFieldResolvesWithMultipleQualifierValuesAndExplicitDefa person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithMultipleAttributesTestBean bean = + QualifiedFieldWithMultipleAttributesTestBean bean = (QualifiedFieldWithMultipleAttributesTestBean) context.getBean("autowired"); assertEquals(MARK, bean.getPerson().getName()); } @@ -501,7 +501,7 @@ public void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndMultip person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -527,7 +527,7 @@ public void testAutowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueA person2.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "juergen")); context.registerBeanDefinition("juergen1", person1); context.registerBeanDefinition("juergen2", person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -541,22 +541,22 @@ public void testAutowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueA } - private static class QualifiedFieldTestBean { + public static class QualifiedFieldTestBean { @Inject @TestQualifier private Person person; - + public Person getPerson() { return this.person; } } - private static class QualifiedMethodParameterTestBean { + public static class QualifiedMethodParameterTestBean { private Person person; - + @Inject public void setPerson(@TestQualifier Person person) { this.person = person; @@ -566,17 +566,17 @@ public Person getPerson() { return this.person; } } - - - private static class QualifiedConstructorArgumentTestBean { + + + public static class QualifiedConstructorArgumentTestBean { private Person person; - + @Inject public QualifiedConstructorArgumentTestBean(@TestQualifier Person person) { this.person = person; } - + public Person getPerson() { return this.person; } @@ -589,7 +589,7 @@ public static class QualifiedFieldWithDefaultValueTestBean { @Inject @TestQualifierWithDefaultValue private Person person; - + public Person getPerson() { return this.person; } @@ -601,18 +601,18 @@ public static class QualifiedFieldWithMultipleAttributesTestBean { @Inject @TestQualifierWithMultipleAttributes(number=123) private Person person; - + public Person getPerson() { return this.person; } } - private static class QualifiedFieldWithBaseQualifierDefaultValueTestBean { + public static class QualifiedFieldWithBaseQualifierDefaultValueTestBean { @Inject private Person person; - + public Person getPerson() { return this.person; } @@ -628,14 +628,14 @@ public QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean( @Named("juergen") Person person) { this.person = person; } - + public Person getPerson() { return this.person; } } - private static class Person { + public static class Person { private String name; @@ -650,7 +650,7 @@ public String getName() { @TestQualifier - private static class QualifiedPerson extends Person { + public static class QualifiedPerson extends Person { public QualifiedPerson() { super(null); diff --git a/spring-context/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireContextTests.java b/spring-context/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireContextTests.java index b3fc360aa333..aff253dc2b90 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireContextTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireContextTests.java @@ -38,13 +38,13 @@ /** * Integration tests for handling {@link Qualifier} annotations. - * + * * @author Mark Fisher * @author Juergen Hoeller * @author Chris Beams */ public class QualifierAnnotationAutowireContextTests { - + private static final String JUERGEN = "juergen"; private static final String MARK = "mark"; @@ -57,7 +57,7 @@ public void testAutowiredFieldWithSingleNonQualifiedCandidate() { cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -77,7 +77,7 @@ public void testAutowiredMethodParameterWithSingleNonQualifiedCandidate() { cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -97,7 +97,7 @@ public void testAutowiredConstructorArgumentWithSingleNonQualifiedCandidate() { cavs.addGenericArgumentValue(JUERGEN); RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -133,11 +133,11 @@ public void testAutowiredMethodParameterWithSingleQualifiedCandidate() { RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); person.addQualifier(new AutowireCandidateQualifier(TestQualifier.class)); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedMethodParameterTestBean bean = + QualifiedMethodParameterTestBean bean = (QualifiedMethodParameterTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -187,11 +187,11 @@ public void testAutowiredConstructorArgumentWithSingleQualifiedCandidate() { RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null); person.addQualifier(new AutowireCandidateQualifier(TestQualifier.class)); context.registerBeanDefinition(JUERGEN, person); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedConstructorArgumentTestBean bean = + QualifiedConstructorArgumentTestBean bean = (QualifiedConstructorArgumentTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -207,7 +207,7 @@ public void testAutowiredFieldWithMultipleNonQualifiedCandidates() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -231,7 +231,7 @@ public void testAutowiredMethodParameterWithMultipleNonQualifiedCandidates() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -255,7 +255,7 @@ public void testAutowiredConstructorArgumentWithMultipleNonQualifiedCandidates() RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -320,11 +320,11 @@ public void testAutowiredMethodParameterResolvesQualifiedCandidate() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedMethodParameterTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedMethodParameterTestBean bean = + QualifiedMethodParameterTestBean bean = (QualifiedMethodParameterTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -341,11 +341,11 @@ public void testAutowiredConstructorArgumentResolvesQualifiedCandidate() { RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedConstructorArgumentTestBean bean = + QualifiedConstructorArgumentTestBean bean = (QualifiedConstructorArgumentTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -363,11 +363,11 @@ public void testAutowiredFieldResolvesQualifiedCandidateWithDefaultValueAndNoVal RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithDefaultValueTestBean bean = + QualifiedFieldWithDefaultValueTestBean bean = (QualifiedFieldWithDefaultValueTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -385,7 +385,7 @@ public void testAutowiredFieldDoesNotResolveCandidateWithDefaultValueAndConflict RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -411,11 +411,11 @@ public void testAutowiredFieldResolvesWithDefaultValueAndExplicitDefaultValueOnB RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithDefaultValueTestBean bean = + QualifiedFieldWithDefaultValueTestBean bean = (QualifiedFieldWithDefaultValueTestBean) context.getBean("autowired"); assertEquals(JUERGEN, bean.getPerson().getName()); } @@ -437,11 +437,11 @@ public void testAutowiredFieldResolvesWithMultipleQualifierValues() { person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithMultipleAttributesTestBean bean = + QualifiedFieldWithMultipleAttributesTestBean bean = (QualifiedFieldWithMultipleAttributesTestBean) context.getBean("autowired"); assertEquals(MARK, bean.getPerson().getName()); } @@ -464,7 +464,7 @@ public void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndConfli person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -495,11 +495,11 @@ public void testAutowiredFieldResolvesWithMultipleQualifierValuesAndExplicitDefa person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithMultipleAttributesTestBean bean = + QualifiedFieldWithMultipleAttributesTestBean bean = (QualifiedFieldWithMultipleAttributesTestBean) context.getBean("autowired"); assertEquals(MARK, bean.getPerson().getName()); } @@ -522,7 +522,7 @@ public void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndMultip person2.addQualifier(qualifier2); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithMultipleAttributesTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -547,11 +547,11 @@ public void testAutowiredFieldResolvesWithBaseQualifierAndDefaultValue() { person2.addQualifier(new AutowireCandidateQualifier(Qualifier.class)); context.registerBeanDefinition(JUERGEN, person1); context.registerBeanDefinition(MARK, person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedFieldWithBaseQualifierDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedFieldWithBaseQualifierDefaultValueTestBean bean = + QualifiedFieldWithBaseQualifierDefaultValueTestBean bean = (QualifiedFieldWithBaseQualifierDefaultValueTestBean) context.getBean("autowired"); assertEquals(MARK, bean.getPerson().getName()); } @@ -569,11 +569,11 @@ public void testAutowiredFieldResolvesWithBaseQualifierAndNonDefaultValue() { person2.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "not really juergen")); context.registerBeanDefinition("juergen1", person1); context.registerBeanDefinition("juergen2", person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); context.refresh(); - QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean bean = + QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean bean = (QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean) context.getBean("autowired"); assertEquals("the real juergen", bean.getPerson().getName()); } @@ -591,7 +591,7 @@ public void testAutowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueA person2.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "juergen")); context.registerBeanDefinition("juergen1", person1); context.registerBeanDefinition("juergen2", person2); - context.registerBeanDefinition("autowired", + context.registerBeanDefinition("autowired", new RootBeanDefinition(QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean.class)); AnnotationConfigUtils.registerAnnotationConfigProcessors(context); try { @@ -605,22 +605,11 @@ public void testAutowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueA } - private static class QualifiedFieldTestBean { + public static class QualifiedFieldTestBean { @Autowired @TestQualifier private Person person; - - public Person getPerson() { - return this.person; - } - } - - - private static class MetaQualifiedFieldTestBean { - - @MyAutowired - private Person person; public Person getPerson() { return this.person; @@ -628,17 +617,10 @@ public Person getPerson() { } - @Autowired - @TestQualifier - @Retention(RetentionPolicy.RUNTIME) - public static @interface MyAutowired { - } - - - private static class QualifiedMethodParameterTestBean { + public static class QualifiedMethodParameterTestBean { private Person person; - + @Autowired public void setPerson(@TestQualifier Person person) { this.person = person; @@ -648,17 +630,17 @@ public Person getPerson() { return this.person; } } - - - private static class QualifiedConstructorArgumentTestBean { + + + public static class QualifiedConstructorArgumentTestBean { private Person person; - + @Autowired public QualifiedConstructorArgumentTestBean(@TestQualifier Person person) { this.person = person; } - + public Person getPerson() { return this.person; } @@ -671,7 +653,7 @@ public static class QualifiedFieldWithDefaultValueTestBean { @Autowired @TestQualifierWithDefaultValue private Person person; - + public Person getPerson() { return this.person; } @@ -683,7 +665,7 @@ public static class QualifiedFieldWithMultipleAttributesTestBean { @Autowired @TestQualifierWithMultipleAttributes(number=123) private Person person; - + public Person getPerson() { return this.person; } @@ -695,7 +677,7 @@ private static class QualifiedFieldWithBaseQualifierDefaultValueTestBean { @Autowired @Qualifier private Person person; - + public Person getPerson() { return this.person; } @@ -711,7 +693,7 @@ public QualifiedConstructorArgumentWithBaseQualifierNonDefaultValueTestBean( @Qualifier("juergen") Person person) { this.person = person; } - + public Person getPerson() { return this.person; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java index ff45fc570073..f17b3dfc89ee 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ /** * Simple bean used to test dependency checking. - * + * * Note: would be defined within {@link XmlBeanFactoryTestTypes}, but must be a public type * in order to satisfy test dependencies. * @@ -31,11 +31,11 @@ * @since 04.09.2003 */ public final class DependenciesBean implements BeanFactoryAware { - + private int age; - + private String name; - + private TestBean spouse; private BeanFactory beanFactory; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java index ceb416775fd0..96adebee0f7f 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/LookupMethodWrappedByCglibProxyTests.java @@ -33,10 +33,10 @@ * @author Chris Beams */ public final class LookupMethodWrappedByCglibProxyTests { - + private static final Class CLASS = LookupMethodWrappedByCglibProxyTests.class; private static final String CLASSNAME = CLASS.getSimpleName(); - + private static final String CONTEXT = CLASSNAME + "-context.xml"; private ApplicationContext applicationContext; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java index 587b492fd2ae..30f3f06288aa 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,7 +120,7 @@ public void testQualifiedByAlias() { context.refresh(); QualifiedByAliasTestBean testBean = (QualifiedByAliasTestBean) context.getBean("testBean"); Person person = testBean.getStooge(); - assertEquals("LarryBean", person.getName()); + assertEquals("LarryBean", person.getName()); } @Test @@ -199,7 +199,7 @@ public void testInterfaceWithOneQualifiedFactoryAndOneQualifiedBean() { } - private static class NonQualifiedTestBean { + public static class NonQualifiedTestBean { @Autowired private Person anonymous; @@ -210,7 +210,7 @@ public Person getAnonymous() { } - private static class QualifiedByValueTestBean { + public static class QualifiedByValueTestBean { @Autowired @Qualifier("larry") private Person larry; @@ -221,7 +221,7 @@ public Person getLarry() { } - private static class QualifiedByBeanNameTestBean { + public static class QualifiedByBeanNameTestBean { @Autowired @Qualifier("larryBean") private Person larry; @@ -235,7 +235,7 @@ public Person getLarry() { } - private static class QualifiedByFieldNameTestBean { + public static class QualifiedByFieldNameTestBean { @Autowired private Person larryBean; @@ -246,7 +246,7 @@ public Person getLarry() { } - private static class QualifiedByParameterNameTestBean { + public static class QualifiedByParameterNameTestBean { private Person larryBean; @@ -261,7 +261,7 @@ public Person getLarry() { } - private static class QualifiedByAliasTestBean { + public static class QualifiedByAliasTestBean { @Autowired @Qualifier("stooge") private Person stooge; @@ -272,7 +272,7 @@ public Person getStooge() { } - private static class QualifiedByAnnotationTestBean { + public static class QualifiedByAnnotationTestBean { @Autowired @Qualifier("special") private Person larry; @@ -283,7 +283,7 @@ public Person getLarry() { } - private static class QualifiedByCustomValueTestBean { + public static class QualifiedByCustomValueTestBean { @Autowired @SimpleValueQualifier("curly") private Person curly; @@ -294,7 +294,7 @@ public Person getCurly() { } - private static class QualifiedByAnnotationValueTestBean { + public static class QualifiedByAnnotationValueTestBean { @Autowired @SimpleValueQualifier("special") private Person larry; @@ -305,7 +305,7 @@ public Person getLarry() { } - private static class QualifiedByAttributesTestBean { + public static class QualifiedByAttributesTestBean { @Autowired @MultipleAttributeQualifier(name="moe", age=42) private Person moeSenior; @@ -323,7 +323,7 @@ public Person getMoeJunior() { } - private static class Person { + public static class Person { private String name; @@ -339,7 +339,7 @@ public void setName(String name) { @Qualifier("special") @SimpleValueQualifier("special") - private static class SpecialPerson extends Person { + public static class SpecialPerson extends Person { } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java index b1e6c818f0d6..8aeb4276ed12 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerWithExpressionLanguageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java index cebec37bd664..b0f3e202ca4b 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java @@ -222,10 +222,12 @@ public DerivedConstructorDependenciesBean(TestBean spouse1, TestBean spouse2, In setName(name); } + @SuppressWarnings("unused") private void init() { this.initialized = true; } + @SuppressWarnings("unused") private void destroy() { this.destroyed = true; } @@ -364,8 +366,9 @@ static FactoryMethods newInstance(TestBean tb, int num, Integer something) { return new FactoryMethods(tb, null, num); } + @SuppressWarnings("unused") private static List listInstance() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } @@ -401,6 +404,7 @@ protected TestBean protectedGetTestBean() { return this.tb; } + @SuppressWarnings("unused") private TestBean privateGetTestBean() { return this.tb; } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java index 91c0c5f4b3f8..bd25539f2124 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java @@ -82,6 +82,7 @@ * @author Rick Evans * @author Chris Beams */ +@SuppressWarnings("deprecation") public final class XmlBeanFactoryTests { private static final Class CLASS = XmlBeanFactoryTests.class; @@ -116,7 +117,6 @@ public final class XmlBeanFactoryTests { private static final ClassPathResource NO_SUCH_FACTORY_METHOD_CONTEXT = classPathResource("-noSuchFactoryMethod.xml"); private static final ClassPathResource RECURSIVE_IMPORT_CONTEXT = classPathResource("-recursiveImport.xml"); private static final ClassPathResource RESOURCE_CONTEXT = classPathResource("-resource.xml"); - private static final ClassPathResource RESOURCE_IMPORT_CONTEXT = classPathResource("-resourceImport.xml"); private static final ClassPathResource SATISFIED_ALL_DEP_CONTEXT = classPathResource("-satisfiedAllDepCheck.xml"); private static final ClassPathResource SATISFIED_OBJECT_DEP_CONTEXT = classPathResource("-satisfiedObjectDepCheck.xml"); private static final ClassPathResource SATISFIED_SIMPLE_DEP_CONTEXT = classPathResource("-satisfiedSimpleDepCheck.xml"); @@ -134,7 +134,8 @@ private static ClassPathResource classPathResource(String suffix) { } /* SPR-2368 */ - public @Test void testCollectionsReferredToAsRefLocals() throws Exception { + @Test + public void testCollectionsReferredToAsRefLocals() throws Exception { XmlBeanFactory factory = new XmlBeanFactory(COLLECTIONS_XSD_CONTEXT); factory.preInstantiateSingletons(); } @@ -1742,7 +1743,7 @@ public LenientDependencyTestBean(DerivedTestBean tb) { this.tb = tb; } - public LenientDependencyTestBean(Map[] m) { + public LenientDependencyTestBean(Map[] m) { throw new IllegalStateException("Don't pick this constructor"); } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java index f4ee8ec40554..769b34c565a0 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/support/CustomNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,18 +63,18 @@ /** * Unit tests for custom XML namespace handler implementations. - * + * * @author Rob Harrop * @author Rick Evans * @author Chris Beams * @author Juergen Hoeller */ public class CustomNamespaceHandlerTests { - + private static final Class CLASS = CustomNamespaceHandlerTests.class; private static final String CLASSNAME = CLASS.getSimpleName(); private static final String FQ_PATH = "org/springframework/beans/factory/xml/support"; - + private static final String NS_PROPS = format("%s/%s.properties", FQ_PATH, CLASSNAME); private static final String NS_XML = format("%s/%s-context.xml", FQ_PATH, CLASSNAME); private static final String TEST_XSD = format("%s/%s.xsd", FQ_PATH, CLASSNAME); @@ -211,7 +211,7 @@ public InputSource resolveEntity(String publicId, String systemId) throws IOExce /** * Custom namespace handler implementation. - * + * * @author Rob Harrop */ final class TestNamespaceHandler extends NamespaceHandlerSupport { diff --git a/spring-context/src/test/java/org/springframework/cache/annotation/AnnotationCacheOperationSourceTests.java b/spring-context/src/test/java/org/springframework/cache/annotation/AnnotationCacheOperationSourceTests.java index 4c1632aacd57..12980ad940f1 100644 --- a/spring-context/src/test/java/org/springframework/cache/annotation/AnnotationCacheOperationSourceTests.java +++ b/spring-context/src/test/java/org/springframework/cache/annotation/AnnotationCacheOperationSourceTests.java @@ -90,7 +90,7 @@ public void testMultipleStereotypes() throws Exception { assertTrue(next.getCacheNames().contains("bar")); } - private static class AnnotatedClass { + public static class AnnotatedClass { @Cacheable("test") public void singular() { } @@ -137,4 +137,4 @@ public void multipleCaching() { @CacheEvict(value = "bar") public @interface EvictBar { } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/cache/concurrent/ConcurrentMapCacheManagerTests.java b/spring-context/src/test/java/org/springframework/cache/concurrent/ConcurrentMapCacheManagerTests.java index cc0c96307040..fbb7da9c8f3d 100644 --- a/spring-context/src/test/java/org/springframework/cache/concurrent/ConcurrentMapCacheManagerTests.java +++ b/spring-context/src/test/java/org/springframework/cache/concurrent/ConcurrentMapCacheManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java b/spring-context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java index 4bc0c888b31a..3ca31a47b95f 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java +++ b/spring-context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 the original author or authors. + * Copyright 2010-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -618,4 +618,4 @@ public void testMultiConditionalCacheAndEvict() { public void testClassMultiConditionalCacheAndEvict() { testMultiConditionalCacheAndEvict(ccs); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java b/spring-context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java index 80fa6f50e214..1fec32ba3b79 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java +++ b/spring-context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 the original author or authors. + * Copyright 2010-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,7 +116,7 @@ public Object multiCache(Object arg1) { return counter.getAndIncrement(); } - @Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#a0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") }) + @Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#a0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") }) public Object multiEvict(Object arg1) { return counter.getAndIncrement(); } @@ -135,4 +135,4 @@ public Object multiConditionalCacheAndEvict(Object arg1) { public Object multiUpdate(Object arg1) { return arg1; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/cache/config/AnnotationTests.java b/spring-context/src/test/java/org/springframework/cache/config/AnnotationTests.java index 04c07fd2083f..71bb3fe680a4 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/AnnotationTests.java +++ b/spring-context/src/test/java/org/springframework/cache/config/AnnotationTests.java @@ -30,4 +30,4 @@ protected ApplicationContext getApplicationContext() { return new GenericXmlApplicationContext( "/org/springframework/cache/config/annotationDrivenCacheConfig.xml"); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java b/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java index 870bdde66bab..bd61e7435a99 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java +++ b/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java @@ -18,7 +18,7 @@ /** * Basic service interface. - * + * * @author Costin Leau */ public interface CacheableService { @@ -59,12 +59,12 @@ public interface CacheableService { // multi annotations T multiCache(Object arg1); - + T multiEvict(Object arg1); T multiCacheAndEvict(Object arg1); - + T multiConditionalCacheAndEvict(Object arg1); T multiUpdate(Object arg1); -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java b/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java index fc754b6c3d19..0ee8d7efeeb0 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java +++ b/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java @@ -25,7 +25,7 @@ /** * Simple cacheable service - * + * * @author Costin Leau */ public class DefaultCacheableService implements CacheableService { @@ -141,4 +141,4 @@ public Long multiConditionalCacheAndEvict(Object arg1) { public Long multiUpdate(Object arg1) { return Long.valueOf(arg1.toString()); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvalutatorTest.java b/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvalutatorTest.java index b52f364746a4..b462f3447d83 100644 --- a/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvalutatorTest.java +++ b/spring-context/src/test/java/org/springframework/cache/interceptor/ExpressionEvalutatorTest.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import org.junit.Test; @@ -31,8 +32,6 @@ import org.springframework.expression.EvaluationContext; import org.springframework.util.ReflectionUtils; -import edu.emory.mathcs.backport.java.util.Collections; - public class ExpressionEvalutatorTest { private ExpressionEvaluator eval = new ExpressionEvaluator(); @@ -64,7 +63,7 @@ public void testMultipleCachingEval() throws Exception { Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class, Object.class); Object[] args = new Object[] { new Object(), new Object() }; - Collection map = Collections.singleton(new ConcurrentMapCache("test")); + Collection map = Collections.singleton(new ConcurrentMapCache("test")); EvaluationContext evalCtx = eval.createEvaluationContext(map, method, args, target, target.getClass()); Collection ops = getOps("multipleCaching"); @@ -78,9 +77,9 @@ public void testMultipleCachingEval() throws Exception { assertEquals(args[1], keyB); } - private static class AnnotatedClass { + public static class AnnotatedClass { @Caching(cacheable = { @Cacheable(value = "test", key = "#a"), @Cacheable(value = "test", key = "#b") }) public void multipleCaching(Object a, Object b) { } } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/ACATester.java b/spring-context/src/test/java/org/springframework/context/ACATester.java index 1bda64a785fd..3faf3ba364b2 100644 --- a/spring-context/src/test/java/org/springframework/context/ACATester.java +++ b/spring-context/src/test/java/org/springframework/context/ACATester.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ import java.util.Locale; public class ACATester implements ApplicationContextAware { - + private ApplicationContext ac; public void setApplicationContext(ApplicationContext ctx) throws ApplicationContextException { diff --git a/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java index d014d770e165..2a2e861e85f5 100644 --- a/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/AbstractApplicationContextTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,7 +94,7 @@ public void testGrandparentDefinitionFound() throws Exception { } public void testGrandparentTypedDefinitionFound() throws Exception { - TestBean dad = (TestBean) applicationContext.getBean("father", TestBean.class); + TestBean dad = applicationContext.getBean("father", TestBean.class); assertTrue("Dad has correct name", dad.getName().equals("Albert")); } diff --git a/spring-context/src/test/java/org/springframework/context/BeanThatListens.java b/spring-context/src/test/java/org/springframework/context/BeanThatListens.java index 9ab3f8ea40da..49f44c56282e 100644 --- a/spring-context/src/test/java/org/springframework/context/BeanThatListens.java +++ b/spring-context/src/test/java/org/springframework/context/BeanThatListens.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ * @author Thomas Risberg * @author Juergen Hoeller */ -public class BeanThatListens implements ApplicationListener { +public class BeanThatListens implements ApplicationListener { private BeanThatBroadcasts beanThatBroadcasts; @@ -36,7 +36,7 @@ public BeanThatListens() { public BeanThatListens(BeanThatBroadcasts beanThatBroadcasts) { this.beanThatBroadcasts = beanThatBroadcasts; - Map beans = beanThatBroadcasts.applicationContext.getBeansOfType(BeanThatListens.class); + Map beans = beanThatBroadcasts.applicationContext.getBeansOfType(BeanThatListens.class); if (!beans.isEmpty()) { throw new IllegalStateException("Shouldn't have found any BeanThatListens instances"); } diff --git a/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java b/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java index c3aba92b5f82..720a7cd9b4b0 100644 --- a/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java +++ b/spring-context/src/test/java/org/springframework/context/LifecycleContextBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,12 +22,12 @@ /** * Simple bean to test ApplicationContext lifecycle methods for beans - * + * * @author Colin Sampaleanu * @since 03.07.2004 */ public class LifecycleContextBean extends LifecycleBean implements ApplicationContextAware { - + protected ApplicationContext owningContext; public void setBeanFactory(BeanFactory beanFactory) { @@ -35,18 +35,18 @@ public void setBeanFactory(BeanFactory beanFactory) { if (this.owningContext != null) throw new RuntimeException("Factory called setBeanFactory after setApplicationContext"); } - + public void afterPropertiesSet() { super.afterPropertiesSet(); if (this.owningContext == null) throw new RuntimeException("Factory didn't call setAppliationContext before afterPropertiesSet on lifecycle bean"); } - + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (this.owningFactory == null) throw new RuntimeException("Factory called setApplicationContext before setBeanFactory"); - + this.owningContext = applicationContext; } - + } diff --git a/spring-context/src/test/java/org/springframework/context/TestListener.java b/spring-context/src/test/java/org/springframework/context/TestListener.java index b9f57f730873..01392e91deaa 100644 --- a/spring-context/src/test/java/org/springframework/context/TestListener.java +++ b/spring-context/src/test/java/org/springframework/context/TestListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ * @author Rod Johnson * @since January 21, 2001 */ -public class TestListener implements ApplicationListener { +public class TestListener implements ApplicationListener { private int eventCount; diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextBeanFactoryReferenceTests.java b/spring-context/src/test/java/org/springframework/context/access/ContextBeanFactoryReferenceTests.java index ca79f530b3fc..c244f24e006b 100644 --- a/spring-context/src/test/java/org/springframework/context/access/ContextBeanFactoryReferenceTests.java +++ b/spring-context/src/test/java/org/springframework/context/access/ContextBeanFactoryReferenceTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,12 +24,12 @@ /** * Unit test for {@link ContextBeanFactoryReference} - * + * * @author Colin Sampaleanu * @author Chris Beams */ public class ContextBeanFactoryReferenceTests { - + @Test public void testAllOperations() { ConfigurableApplicationContext ctx = createMock(ConfigurableApplicationContext.class); diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java index 2f6728e96d19..08e450fc718b 100644 --- a/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java +++ b/spring-context/src/test/java/org/springframework/context/access/ContextJndiBeanFactoryLocatorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,15 +35,15 @@ public final class ContextJndiBeanFactoryLocatorTests extends TestCase { private static final String BEAN_FACTORY_PATH_ENVIRONMENT_KEY = "java:comp/env/ejb/BeanFactoryPath"; - + private static final Class CLASS = ContextJndiBeanFactoryLocatorTests.class; private static final String CLASSNAME = CLASS.getSimpleName(); - + private static final String FQ_PATH = "/org/springframework/context/access/"; - + private static final String COLLECTIONS_CONTEXT = FQ_PATH + CLASSNAME + "-collections.xml"; private static final String PARENT_CONTEXT = FQ_PATH + CLASSNAME + "-parent.xml"; - + public void testBeanFactoryPathRequiredFromJndiEnvironment() throws Exception { // Set up initial context but don't bind anything @@ -60,7 +60,7 @@ public void testBeanFactoryPathRequiredFromJndiEnvironment() throws Exception { } } - public void testBeanFactoryPathFromJndiEnvironmentNotFound() throws Exception { + public void testBeanFactoryPathFromJndiEnvironmentNotFound() throws Exception { SimpleNamingContextBuilder sncb = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); String bogusPath = "RUBBISH/com/xxxx/framework/server/test1.xml"; @@ -163,4 +163,4 @@ public Collection getJumble() { return jumble; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java b/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java index 6d2b96e92b70..dad31e1cb63f 100644 --- a/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java +++ b/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,8 @@ import org.springframework.beans.factory.access.BeanFactoryLocator; import org.springframework.beans.factory.access.BeanFactoryReference; import org.springframework.beans.factory.access.SingletonBeanFactoryLocatorTests; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.util.ClassUtils; @@ -34,24 +35,28 @@ * @author Chris Beams */ public class ContextSingletonBeanFactoryLocatorTests extends SingletonBeanFactoryLocatorTests { - + private static final Class CLASS = ContextSingletonBeanFactoryLocatorTests.class; private static final String CONTEXT = CLASS.getSimpleName() + "-context.xml"; - + @Test public void testBaseBeanFactoryDefs() { // Just test the base BeanFactory/AppContext defs we are going to work // with in other tests. - new XmlBeanFactory(new ClassPathResource("/org/springframework/beans/factory/access/beans1.xml")); - new XmlBeanFactory(new ClassPathResource("/org/springframework/beans/factory/access/beans2.xml")); + DefaultListableBeanFactory bf1 = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf1).loadBeanDefinitions(new ClassPathResource( + "/org/springframework/beans/factory/access/beans1.xml")); + DefaultListableBeanFactory bf2 = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf2).loadBeanDefinitions(new ClassPathResource( + "/org/springframework/beans/factory/access/beans2.xml")); } @Test public void testBasicFunctionality() { ContextSingletonBeanFactoryLocator facLoc = new ContextSingletonBeanFactoryLocator( "classpath*:" + ClassUtils.addResourcePathToPackagePath(CLASS, CONTEXT)); - + basicFunctionalityTest(facLoc); BeanFactoryReference bfr = facLoc.useBeanFactory("a.qualified.name.of.some.sort"); @@ -77,7 +82,7 @@ public void testGetInstance() { BeanFactoryLocator facLoc = ContextSingletonBeanFactoryLocator.getInstance( ClassUtils.addResourcePathToPackagePath(CLASS, CONTEXT)); getInstanceTest1(facLoc); - + facLoc = ContextSingletonBeanFactoryLocator.getInstance( "classpath*:" + ClassUtils.addResourcePathToPackagePath(CLASS, CONTEXT)); getInstanceTest2(facLoc); diff --git a/spring-context/src/test/java/org/springframework/context/access/DefaultLocatorFactoryTests.java b/spring-context/src/test/java/org/springframework/context/access/DefaultLocatorFactoryTests.java index 6b5eafee15bb..eee36e9d9bc0 100644 --- a/spring-context/src/test/java/org/springframework/context/access/DefaultLocatorFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/context/access/DefaultLocatorFactoryTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java index 57d42c88c8ed..bfbc2c9ef655 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AbstractCircularImportDetectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ /** * TCK-style unit tests for handling circular use of the {@link Import} annotation. Explore * subclass hierarchy for specific concrete implementations. - * + * * @author Chris Beams */ public abstract class AbstractCircularImportDetectionTests { @@ -37,7 +37,7 @@ public abstract class AbstractCircularImportDetectionTests { protected abstract ConfigurationClassParser newParser(); protected abstract String loadAsConfigurationSource(Class clazz) throws Exception; - + @Test public void simpleCircularImportIsDetected() throws Exception { boolean threw = false; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java index fe528621aacd..d862c322914d 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public void nullGetBeanParameterIsDisallowed() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class); context.getBean((Class)null); } - + @Test public void scanAndRefresh() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java index 87921285875e..84e6a6de9ef1 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java index 7d31e003d02f..16565d9b1d7e 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.context.annotation; -import java.lang.annotation.Documented; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Retention; import java.lang.annotation.ElementType; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java index 36a9b1eed8e1..01e25e803002 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AsmCircularImportDetectionTests.java @@ -24,11 +24,11 @@ /** * Unit test proving that ASM-based {@link ConfigurationClassParser} correctly detects circular use of * the {@link Import @Import} annotation. - * + * *

    While this test is the only subclass of {@link AbstractCircularImportDetectionTests}, the * hierarchy remains in place in case a JDT-based ConfigurationParser implementation needs to be * developed. - * + * * @author Chris Beams */ public class AsmCircularImportDetectionTests extends AbstractCircularImportDetectionTests { diff --git a/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java b/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java index 4797aae61be9..f0f7e08c0a8f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/BeanMethodPolymorphismTests.java @@ -21,8 +21,8 @@ * * Bean-annotated methods should be able to be overloaded, though supporting this * is more subtle. Essentially, it must be unambiguous to the container which bean - * method to call. A simple way to think about this is that no one Configuration - * class may declare two bean methods with the same name. In the case of inheritance, + * method to call. A simple way to think about this is that no one Configuration + * class may declare two bean methods with the same name. In the case of inheritance, * the most specific subclass bean method will always be the one that is invoked. * * @author Chris Beams @@ -31,7 +31,7 @@ public class BeanMethodPolymorphismTests { @Test public void beanMethodOverloadingWithoutInheritance() { - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "hiding" }) @Configuration class Config { @Bean String aString() { return "na"; } @Bean String aString(Integer dependency) { return "na"; } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java index 50b8cd20459d..13f5d7ed8ebb 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java index 36d950e11027..1f81d31669d9 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ClassPathFactoryBeanDefinitionScannerTests.java @@ -57,7 +57,7 @@ public void testSingletonScopedFactoryMethod() { TestBean tb2 = (TestBean)context.getBean("publicInstance"); //2 assertEquals("publicInstance", tb2.getName()); assertSame(tb2, tb); - + tb = (TestBean)context.getBean("protectedInstance"); //3 assertEquals("protectedInstance", tb.getName()); assertSame(tb, context.getBean("protectedInstance")); @@ -72,7 +72,7 @@ public void testSingletonScopedFactoryMethod() { tb2 = context.getBean("privateInstance", TestBean.class); //4 assertEquals(2, tb2.getAge()); assertNotSame(tb2, tb); - + Object bean = context.getBean("requestScopedInstance"); //5 assertTrue(AopUtils.isCglibProxy(bean)); assertTrue(bean instanceof ScopedObject); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java index daacc42cd573..5843ade8773f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java @@ -432,6 +432,7 @@ public static class AnnotatedInitDestroyBean { public boolean destroyCalled = false; + @SuppressWarnings("unused") @PostConstruct private void init() { if (this.initCalled) { @@ -440,6 +441,7 @@ private void init() { this.initCalled = true; } + @SuppressWarnings("unused") @PreDestroy private void destroy() { if (this.destroyCalled) { @@ -503,6 +505,7 @@ protected void init2() { this.init2Called = true; } + @SuppressWarnings("unused") @PostConstruct private void init() { if (this.init3Called) { @@ -522,6 +525,7 @@ protected void destroy2() { this.destroy2Called = true; } + @SuppressWarnings("unused") @PreDestroy private void destroy() { if (this.destroyCalled) { @@ -571,7 +575,8 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } - @Resource(name="${tb}", type=ITestBean.class) + @SuppressWarnings("unused") + @Resource(name = "${tb}", type = ITestBean.class) private void setTestBean4(ITestBean testBean4) { this.testBean4 = testBean4; } @@ -632,7 +637,8 @@ public void setTestBean2(TestBean testBean2) { super.setTestBean2(testBean2); } - @EJB(beanName="testBean3", beanInterface=ITestBean.class) + @SuppressWarnings("unused") + @EJB(beanName = "testBean3", beanInterface = ITestBean.class) private void setTestBean4(ITestBean testBean4) { this.testBean4 = testBean4; } @@ -665,21 +671,21 @@ protected void destroy2() { } - private static class NamedResourceInjectionBean { + public static class NamedResourceInjectionBean { @Resource(name="testBean9") private INestedTestBean testBean; } - private static class ConvertedResourceInjectionBean { + public static class ConvertedResourceInjectionBean { @Resource(name="value") private int value; } - private static class NullFactory { + public static class NullFactory { public static Object create() { return null; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationTests.java index f686a69bdcdd..0f34693938b4 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationTests.java @@ -58,4 +58,4 @@ class MyConfig { } @ComponentScan(basePackageClasses=example.scannable.NamedComponent.class) -class SimpleConfig { } \ No newline at end of file +class SimpleConfig { } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java index 28fdcccca0ab..2e3fd3989ebe 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserBeanDefinitionDefaultsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -214,7 +214,7 @@ public void testDefaultNonExistingInitAndDestroyMethodsDefined() { } - private static class DefaultsTestBean { + public static class DefaultsTestBean { static int INIT_COUNT; @@ -276,7 +276,7 @@ public PropertyDependencyTestBean getPropertyDependency2() { } - private static class PropertyDependencyTestBean { + public static class PropertyDependencyTestBean { private String name; @@ -290,7 +290,7 @@ public String getName() { } - private static class ConstructorDependencyTestBean { + public static class ConstructorDependencyTestBean { private String name; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java index 4cbfd9b34e7b..7ac4cbaad4f3 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserTests.java index 4181cc2233c2..75bef42a0f8f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserTests.java @@ -124,7 +124,7 @@ public void testComponentScanRespectsProfileAnnotation() { @Target({ElementType.TYPE, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) - public static @interface CustomAnnotation { + public static @interface CustomAnnotation { } @@ -141,7 +141,7 @@ public CustomAnnotationDependencyBean getDependency() { @CustomAnnotation - public static class CustomAnnotationDependencyBean { + public static class CustomAnnotationDependencyBean { } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserWithUserDefinedStrategiesTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserWithUserDefinedStrategiesTests.java index 1925dd4afcea..c7916866d169 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserWithUserDefinedStrategiesTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserWithUserDefinedStrategiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,5 +68,5 @@ public void testInvalidClassNameScopeMetadataResolver() { // expected } } - -} \ No newline at end of file + +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java index d52a9db656f6..e23f452b800d 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationWithFactoryBeanAndAutowiringTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationWithFactoryBeanAndAutowiringTests.java old mode 100755 new mode 100644 index 14d1932dca60..a97c743ac962 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationWithFactoryBeanAndAutowiringTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationWithFactoryBeanAndAutowiringTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/DoubleScanTests.java b/spring-context/src/test/java/org/springframework/context/annotation/DoubleScanTests.java index 143ce5ffa454..f6daef956862 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/DoubleScanTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/DoubleScanTests.java @@ -27,4 +27,4 @@ protected String[] getConfigLocations() { return new String[] {"doubleScanTests.xml"}; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/EnableAspectJAutoProxyTests.java b/spring-context/src/test/java/org/springframework/context/annotation/EnableAspectJAutoProxyTests.java index 11e2a0f843fe..19dbc7180997 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/EnableAspectJAutoProxyTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/EnableAspectJAutoProxyTests.java @@ -81,4 +81,4 @@ private void aspectIsApplied(ApplicationContext ctx) throws Exception { fooService.foo(1); assertEquals(3, counter.getCount()); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java b/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java index 4546a22de081..7fa9f413f777 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/FooServiceDependentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,10 @@ public void setFooService(FooService fooService) { this.fooService = fooService; } + public FooService getFooService() { + return fooService; + } + public org.springframework.beans.TestBean convert(String source) { return new org.springframework.beans.TestBean(source); } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/InvalidConfigurationClassDefinitionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/InvalidConfigurationClassDefinitionTests.java index 8e3e909b2735..4ed063772634 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/InvalidConfigurationClassDefinitionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/InvalidConfigurationClassDefinitionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/annotation/NestedConfigurationClassTests.java b/spring-context/src/test/java/org/springframework/context/annotation/NestedConfigurationClassTests.java index fd0adecba094..ac7629023930 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/NestedConfigurationClassTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/NestedConfigurationClassTests.java @@ -138,4 +138,4 @@ public TestBean overrideBean() { } } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java b/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java index fc186b8e434d..51c513b28960 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ * @author Juergen Hoeller */ public class SimpleConfigTests { - + @Test public void testFooService() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getConfigLocations(), getClass()); @@ -42,7 +42,7 @@ public void testFooService() throws Exception { String value = fooService.foo(1); assertEquals("bar", value); - Future future = fooService.asyncFoo(1); + Future future = fooService.asyncFoo(1); assertTrue(future instanceof FutureTask); assertEquals("bar", future.get()); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/SimpleScanTests.java b/spring-context/src/test/java/org/springframework/context/annotation/SimpleScanTests.java index d0bb3a8c594f..22c7cbc8244b 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/SimpleScanTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/SimpleScanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,10 +38,10 @@ protected String[] getConfigLocations() { @Test public void testFooService() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getConfigLocations(), getClass()); - + FooService fooService = (FooService) ctx.getBean("fooServiceImpl"); ServiceInvocationCounter serviceInvocationCounter = (ServiceInvocationCounter) ctx.getBean("serviceInvocationCounter"); - + assertEquals(0, serviceInvocationCounter.getCount()); assertTrue(fooService.isInitCalled()); @@ -50,7 +50,7 @@ public void testFooService() throws Exception { String value = fooService.foo(1); assertEquals("bar", value); assertEquals(2, serviceInvocationCounter.getCount()); - + fooService.foo(1); assertEquals(3, serviceInvocationCounter.getCount()); } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/Spr6602Tests.java b/spring-context/src/test/java/org/springframework/context/annotation/Spr6602Tests.java index 50453f6b5d27..0ceace3065e6 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/Spr6602Tests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/Spr6602Tests.java @@ -99,4 +99,4 @@ public boolean isSingleton() { } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/componentscan/level1/Level1Config.java b/spring-context/src/test/java/org/springframework/context/annotation/componentscan/level1/Level1Config.java index 0ec8a5b75756..1a1dc978d1c0 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/componentscan/level1/Level1Config.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/componentscan/level1/Level1Config.java @@ -28,4 +28,4 @@ public class Level1Config { public TestBean level1Bean() { return new TestBean("level1Bean"); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java index da56d717dab5..7b6456c7f243 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,9 @@ import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @@ -37,16 +38,18 @@ /** * System tests covering use of {@link Autowired} and {@link Value} within * {@link Configuration} classes. - * + * * @author Chris Beams * @author Juergen Hoeller */ +@SuppressWarnings("deprecation") public class AutowiredConfigurationTests { - @Test + @Test public void testAutowiredConfigurationDependencies() { ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext( - AutowiredConfigurationTests.class.getSimpleName() + ".xml", AutowiredConfigurationTests.class); + AutowiredConfigurationTests.class.getSimpleName() + ".xml", + AutowiredConfigurationTests.class); assertThat(factory.getBean("colour", Colour.class), equalTo(Colour.RED)); assertThat(factory.getBean("testBean", TestBean.class).getName(), equalTo(Colour.RED.toString())); @@ -79,7 +82,8 @@ public Colour colour() { */ @Test(expected=BeanCreationException.class) public void testAutowiredConfigurationConstructorsAreNotSupported() { - XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("annotation-config.xml", AutowiredConstructorConfig.class)); + DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(factory).loadBeanDefinitions(new ClassPathResource("annotation-config.xml", AutowiredConstructorConfig.class)); GenericApplicationContext ctx = new GenericApplicationContext(factory); ctx.registerBeanDefinition("config1", new RootBeanDefinition(AutowiredConstructorConfig.class)); ctx.registerBeanDefinition("config2", new RootBeanDefinition(ColorConfig.class)); @@ -100,7 +104,7 @@ static class AutowiredConstructorConfig { @Test public void testValueInjection() { ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext( - "ValueInjectionTests.xml", AutowiredConfigurationTests.class); + "ValueInjectionTests.xml", AutowiredConfigurationTests.class); System.clearProperty("myProp"); @@ -155,7 +159,7 @@ public TestBean testBean2() { @Test public void testCustomProperties() { ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext( - "AutowiredConfigurationTests-custom.xml", AutowiredConfigurationTests.class); + "AutowiredConfigurationTests-custom.xml", AutowiredConfigurationTests.class); TestBean testBean = factory.getBean("testBean", TestBean.class); assertThat(testBean.getName(), equalTo("localhost")); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java index 1eddf67a4f81..f0dcbab8abb4 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanAnnotationAttributePropagationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ * Unit tests proving that the various attributes available via the {@link Bean} * annotation are correctly reflected in the {@link BeanDefinition} created when * processing the {@link Configuration} class. - * + * *

    Also includes tests proving that using {@link Lazy} and {@link Primary} * annotations in conjunction with Bean propagate their respective metadata * correctly into the resulting BeanDefinition diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanMethodQualificationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanMethodQualificationTests.java index 872cc9281afe..6aef2456d427 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanMethodQualificationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/BeanMethodQualificationTests.java @@ -36,9 +36,9 @@ import static org.junit.Assert.*; /** - * Tests proving that @Qualifier annotations work when used + * Tests proving that @Qualifier annotations work when used * with @Configuration classes on @Bean methods. - * + * * @author Chris Beams * @author Juergen Hoeller */ @@ -62,22 +62,22 @@ public void testCustom() { assertThat(pojo.testBean.getName(), equalTo("interesting")); } - @Configuration static class StandardConfig { @Bean @Lazy @Qualifier("interesting") public TestBean testBean1() { return new TestBean("interesting"); } - - @Bean @Qualifier("boring") + + @Bean + @Qualifier("boring") public TestBean testBean2() { return new TestBean("boring"); } } - @Component @Lazy - static class StandardPojo { + @Component + static class Pojo { @Autowired @Qualifier("interesting") TestBean testBean; } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java index 2b3924bb4f49..e5ff833bd53a 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,9 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.junit.Test; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ConfigurationClassPostProcessor; @@ -38,7 +39,7 @@ * {@link Bean} methods may return aspects, or Configuration classes may themselves be annotated with Aspect. * In the latter case, advice methods are declared inline within the Configuration class. This makes for a * particularly convenient syntax requiring no extra artifact for the aspect. - * + * *

    Currently it is assumed that the user is bootstrapping Configuration class processing via XML (using * annotation-config or component-scan), and thus will also use {@code } to enable * processing of the Aspect annotation. @@ -47,8 +48,11 @@ */ public class ConfigurationClassAspectIntegrationTests { private void assertAdviceWasApplied(Class configClass) { - GenericApplicationContext ctx = new GenericApplicationContext( - new XmlBeanFactory(new ClassPathResource("aspectj-autoproxy-config.xml", ConfigurationClassAspectIntegrationTests.class))); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource( + "aspectj-autoproxy-config.xml", + ConfigurationClassAspectIntegrationTests.class)); + GenericApplicationContext ctx = new GenericApplicationContext(bf); ctx.addBeanFactoryPostProcessor(new ConfigurationClassPostProcessor()); ctx.registerBeanDefinition("config", new RootBeanDefinition(configClass)); ctx.refresh(); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java index 11004182c8be..719d7a0b43db 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java @@ -272,6 +272,7 @@ public TestBean baz() { } + @SuppressWarnings("unused") static class ConfigWithPostProcessor extends ConfigWithPrototypeBean { @Value("${myProp}") @@ -281,6 +282,7 @@ static class ConfigWithPostProcessor extends ConfigWithPrototypeBean { public POBPP beanPostProcessor() { return new POBPP() { String nameSuffix = "-processed-" + myProp; + public void setNameSuffix(String nameSuffix) { this.nameSuffix = nameSuffix; } @@ -293,6 +295,7 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) { public Object postProcessAfterInitialization(Object bean, String beanName) { return bean; } + public int getOrder() { return 0; } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassWithPlaceholderConfigurerBeanTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassWithPlaceholderConfigurerBeanTests.java index c81b3d9ab865..88b712e3804f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassWithPlaceholderConfigurerBeanTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassWithPlaceholderConfigurerBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ /** * A configuration class that registers a placeholder configurer @Bean method - * cannot also have @Value fields. Logically, the config class must be instantiated + * cannot also have @Value fields. Logically, the config class must be instantiated * in order to invoke the placeholder configurer bean method, and it is a * chicken-and-egg problem to process the @Value field. * @@ -48,7 +48,7 @@ public class ConfigurationClassWithPlaceholderConfigurerBeanTests { /** * Intentionally ignored test proving that a property placeholder bean * cannot be declared in the same configuration class that has a @Value - * field in need of placeholder replacement. It's an obvious chicken-and-egg issue. + * field in need of placeholder replacement. It's an obvious chicken-and-egg issue. * The solution is to do as {@link #valueFieldsAreProcessedWhenPlaceholderConfigurerIsSegregated()} * does and segragate the two bean definitions across configuration classes. */ @@ -116,4 +116,4 @@ public PropertySourcesPlaceholderConfigurer ppc() { return new PropertySourcesPlaceholderConfigurer(); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportResourceTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportResourceTests.java index 745cd792fbd8..c064ff2a3d60 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportResourceTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportResourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,140 +42,168 @@ * @author Juergen Hoeller */ public class ImportResourceTests { - @Test - public void testImportXml() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlConfig.class); - assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean")); - assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); + + @Test + public void testImportXml() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + ImportXmlConfig.class); + assertTrue("did not contain java-declared bean", + ctx.containsBean("javaDeclaredBean")); + assertTrue("did not contain xml-declared bean", + ctx.containsBean("xmlDeclaredBean")); TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class); assertEquals("myName", tb.getName()); - } + } + + @Configuration + @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") + static class ImportXmlConfig { - @Configuration - @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") - static class ImportXmlConfig { @Value("${name}") private String name; - public @Bean TestBean javaDeclaredBean() { - return new TestBean(this.name); - } - } - - @Ignore // TODO: SPR-6310 - @Test - public void testImportXmlWithRelativePath() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithRelativePathConfig.class); - assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean")); - assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); + + public @Bean + TestBean javaDeclaredBean() { + return new TestBean(this.name); + } + } + + @Ignore + // TODO: SPR-6310 + @Test + public void testImportXmlWithRelativePath() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + ImportXmlWithRelativePathConfig.class); + assertTrue("did not contain java-declared bean", + ctx.containsBean("javaDeclaredBean")); + assertTrue("did not contain xml-declared bean", + ctx.containsBean("xmlDeclaredBean")); TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class); assertEquals("myName", tb.getName()); - } - - @Configuration - @ImportResource("ImportXmlConfig-context.xml") - static class ImportXmlWithRelativePathConfig { - public @Bean TestBean javaDeclaredBean() { - return new TestBean("java.declared"); - } - } - - @Ignore // TODO: SPR-6310 - @Test - public void testImportXmlByConvention() { - ApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlByConventionConfig.class); - assertTrue("context does not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); - } - - @Configuration - //@ImportXml - static class ImportXmlByConventionConfig { - } - - @Test - public void testImportXmlIsInheritedFromSuperclassDeclarations() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class); - assertTrue(ctx.containsBean("xmlDeclaredBean")); - } - - @Test - public void testImportXmlIsMergedFromSuperclassDeclarations() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SecondLevelSubConfig.class); - assertTrue("failed to pick up second-level-declared XML bean", ctx.containsBean("secondLevelXmlDeclaredBean")); - assertTrue("failed to pick up parent-declared XML bean", ctx.containsBean("xmlDeclaredBean")); - } - - @Configuration - @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") - static class BaseConfig { - } - - @Configuration - static class FirstLevelSubConfig extends BaseConfig { - } - - @Configuration - @ImportResource("classpath:org/springframework/context/annotation/configuration/SecondLevelSubConfig-context.xml") - static class SecondLevelSubConfig extends BaseConfig { - } - - @Test - public void testImportXmlWithNamespaceConfig() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithAopNamespaceConfig.class); - Object bean = ctx.getBean("proxiedXmlBean"); - assertTrue(AopUtils.isAopProxy(bean)); - } - - @Configuration - @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml") - static class ImportXmlWithAopNamespaceConfig { - } - - @Aspect - static class AnAspect { - @Before("execution(* test.beans.TestBean.*(..))") - public void advice() { } - } - - @Test - public void testImportXmlWithAutowiredConfig() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlAutowiredConfig.class); - String name = ctx.getBean("xmlBeanName", String.class); - assertThat(name, equalTo("xml.declared")); - } - - @Configuration - @ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") - static class ImportXmlAutowiredConfig { - @Autowired TestBean xmlDeclaredBean; - - public @Bean String xmlBeanName() { - return xmlDeclaredBean.getName(); - } - } - - @Test - public void testImportNonXmlResource() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportNonXmlResourceConfig.class); - assertTrue(ctx.containsBean("propertiesDeclaredBean")); - } - - @Configuration - @ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties", - reader=PropertiesBeanDefinitionReader.class) - static class ImportNonXmlResourceConfig { - } - - @Ignore // TODO: SPR-6327 - @Test - public void testImportDifferentResourceTypes() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubResourceConfig.class); - assertTrue(ctx.containsBean("propertiesDeclaredBean")); - assertTrue(ctx.containsBean("xmlDeclaredBean")); - } - - @Configuration - @ImportResource(value="classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml", - reader=XmlBeanDefinitionReader.class) - static class SubResourceConfig extends ImportNonXmlResourceConfig { - } -} \ No newline at end of file + } + + @Configuration + @ImportResource("ImportXmlConfig-context.xml") + static class ImportXmlWithRelativePathConfig { + + public @Bean + TestBean javaDeclaredBean() { + return new TestBean("java.declared"); + } + } + + @Ignore + // TODO: SPR-6310 + @Test + public void testImportXmlByConvention() { + ApplicationContext ctx = new AnnotationConfigApplicationContext( + ImportXmlByConventionConfig.class); + assertTrue("context does not contain xml-declared bean", + ctx.containsBean("xmlDeclaredBean")); + } + + @Configuration + // @ImportXml + static class ImportXmlByConventionConfig { + } + + @Test + public void testImportXmlIsInheritedFromSuperclassDeclarations() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + FirstLevelSubConfig.class); + assertTrue(ctx.containsBean("xmlDeclaredBean")); + } + + @Test + public void testImportXmlIsMergedFromSuperclassDeclarations() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + SecondLevelSubConfig.class); + assertTrue("failed to pick up second-level-declared XML bean", + ctx.containsBean("secondLevelXmlDeclaredBean")); + assertTrue("failed to pick up parent-declared XML bean", + ctx.containsBean("xmlDeclaredBean")); + } + + @Configuration + @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") + static class BaseConfig { + } + + @Configuration + static class FirstLevelSubConfig extends BaseConfig { + } + + @Configuration + @ImportResource("classpath:org/springframework/context/annotation/configuration/SecondLevelSubConfig-context.xml") + static class SecondLevelSubConfig extends BaseConfig { + } + + @Test + public void testImportXmlWithNamespaceConfig() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + ImportXmlWithAopNamespaceConfig.class); + Object bean = ctx.getBean("proxiedXmlBean"); + assertTrue(AopUtils.isAopProxy(bean)); + } + + @Configuration + @ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlWithAopNamespace-context.xml") + static class ImportXmlWithAopNamespaceConfig { + } + + @Aspect + static class AnAspect { + + @Before("execution(* test.beans.TestBean.*(..))") + public void advice() { + } + } + + @Test + public void testImportXmlWithAutowiredConfig() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + ImportXmlAutowiredConfig.class); + String name = ctx.getBean("xmlBeanName", String.class); + assertThat(name, equalTo("xml.declared")); + } + + @Configuration + @ImportResource(value = "classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") + static class ImportXmlAutowiredConfig { + + @Autowired + TestBean xmlDeclaredBean; + + public @Bean + String xmlBeanName() { + return xmlDeclaredBean.getName(); + } + } + + @Test + public void testImportNonXmlResource() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + ImportNonXmlResourceConfig.class); + assertTrue(ctx.containsBean("propertiesDeclaredBean")); + } + + @Configuration + @ImportResource(value = "classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties", reader = PropertiesBeanDefinitionReader.class) + static class ImportNonXmlResourceConfig { + } + + @Ignore + // TODO: SPR-6327 + @Test + public void testImportDifferentResourceTypes() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( + SubResourceConfig.class); + assertTrue(ctx.containsBean("propertiesDeclaredBean")); + assertTrue(ctx.containsBean("xmlDeclaredBean")); + } + + @Configuration + @ImportResource(value = "classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml", reader = XmlBeanDefinitionReader.class) + static class SubResourceConfig extends ImportNonXmlResourceConfig { + } +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportTests.java index 1866ea80405d..78314569d207 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ /** * System tests for {@link Import} annotation support. - * + * * @author Chris Beams */ public class ImportTests { @@ -125,7 +125,7 @@ public void testImportAnnotationWithTwoLevelRecursion() { @Configuration @Import(DataSourceConfig.class) static class AppConfig { - + @Bean public ITestBean transferService() { return new TestBean(accountRepository()); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java index 208516f99bb5..e1495b75d55d 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ImportedConfigurationClassEnhancementTests.java @@ -39,7 +39,7 @@ */ public class ImportedConfigurationClassEnhancementTests { - + @Test public void autowiredConfigClassIsEnhancedWhenImported() { autowiredConfigClassIsEnhanced(ConfigThatDoesImport.class); @@ -49,25 +49,25 @@ public void autowiredConfigClassIsEnhancedWhenImported() { public void autowiredConfigClassIsEnhancedWhenRegisteredViaConstructor() { autowiredConfigClassIsEnhanced(ConfigThatDoesNotImport.class, ConfigToBeAutowired.class); } - + private void autowiredConfigClassIsEnhanced(Class... configClasses) { ApplicationContext ctx = new AnnotationConfigApplicationContext(configClasses); Config config = ctx.getBean(Config.class); assertTrue("autowired config class has not been enhanced", ClassUtils.isCglibProxy(config.autowiredConfig)); } - - + + @Test public void autowiredConfigClassBeanMethodsRespectScopingWhenImported() { autowiredConfigClassBeanMethodsRespectScoping(ConfigThatDoesImport.class); } - + @Test public void autowiredConfigClassBeanMethodsRespectScopingWhenRegisteredViaConstructor() { autowiredConfigClassBeanMethodsRespectScoping(ConfigThatDoesNotImport.class, ConfigToBeAutowired.class); } - + private void autowiredConfigClassBeanMethodsRespectScoping(Class... configClasses) { ApplicationContext ctx = new AnnotationConfigApplicationContext(configClasses); Config config = ctx.getBean(Config.class); @@ -104,4 +104,4 @@ class ConfigThatDoesNotImport extends Config { } @Configuration @Import(Void.class) -class ConfigThatImportsNonConfigClass { } \ No newline at end of file +class ConfigThatImportsNonConfigClass { } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java index c0d141563662..0ddd02a851b9 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ScopingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -196,7 +196,7 @@ public void testScopedConfigurationBeanDefinitionCount() throws Exception { // 6 @Beans + 1 Configuration + 2 scoped proxy + 1 importRegistry assertEquals(10, ctx.getBeanDefinitionCount()); } - + // /** // * SJC-254 caught a regression in handling scoped proxies starting in 1.0 m4. // * The ScopedProxyFactoryBean object was having its scope set to that of its delegate @@ -207,10 +207,10 @@ public void testScopedConfigurationBeanDefinitionCount() throws Exception { // JavaConfigWebApplicationContext ctx = new JavaConfigWebApplicationContext(); // ctx.setConfigLocations(new String[] { ScopeTestConfiguration.class.getName() }); // ctx.refresh(); -// +// // // should be fine // ctx.getBean(Bar.class); -// +// // boolean threw = false; // try { // ctx.getBean(Foo.class); @@ -221,7 +221,7 @@ public void testScopedConfigurationBeanDefinitionCount() throws Exception { // } // assertTrue(threw); // } - + @Configuration static class ScopeTestConfiguration { @@ -236,30 +236,30 @@ public Bar bar() { return new Bar(foo()); } } - + static class Foo { public Foo() { //System.out.println("created foo: " + this.getClass().getName()); } - + public void doSomething() { //System.out.println("interesting: " + this); } } - + static class Bar { - + private final Foo foo; - + public Bar(Foo foo) { this.foo = foo; //System.out.println("created bar: " + this); } - + public Foo getFoo() { return foo; } - + } private void genericTestScope(String beanName) throws Exception { diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/a/BaseConfig.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/a/BaseConfig.java index e83c165715eb..f28828428fc9 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/a/BaseConfig.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/a/BaseConfig.java @@ -40,4 +40,4 @@ protected Bar protectedBar() { public Bar workaroundBar() { return protectedBar(); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTck.java b/spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTck.java index 80caecf6c562..7e67cee811e6 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTck.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/jsr330/SpringAtInjectTck.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,8 @@ */ public class SpringAtInjectTck { - public static Test suite() { + @SuppressWarnings("unchecked") + public static Test suite() { GenericApplicationContext ac = new GenericApplicationContext(); AnnotatedBeanDefinitionReader bdr = new AnnotatedBeanDefinitionReader(ac); bdr.setScopeMetadataResolver(new Jsr330ScopeMetadataResolver()); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithRole.java b/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithRole.java index 85e8de9f82d8..fff30473b7dd 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithRole.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithRole.java @@ -23,4 +23,4 @@ @Component("componentWithRole") @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public class ComponentWithRole { -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithoutRole.java b/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithoutRole.java index 860a3b35fafb..4dc4396db04a 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithoutRole.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/role/ComponentWithoutRole.java @@ -20,4 +20,4 @@ @Component("componentWithoutRole") public class ComponentWithoutRole { -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/spr8761/Spr8761Tests.java b/spring-context/src/test/java/org/springframework/context/annotation/spr8761/Spr8761Tests.java index c37c22106cda..be87313477b0 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/spr8761/Spr8761Tests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/spr8761/Spr8761Tests.java @@ -53,5 +53,5 @@ class WithNestedAnnotation { @Retention(RetentionPolicy.RUNTIME) @Component public static @interface MyComponent { - } + } } diff --git a/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java b/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java index 125c77c63637..b1d3af982b6f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java +++ b/spring-context/src/test/java/org/springframework/context/annotation4/FactoryMethodComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ public final class FactoryMethodComponent { private int i; - public static TestBean nullInstance() { + public static TestBean nullInstance() { return null; } @@ -59,6 +59,7 @@ protected TestBean protectedInstance(@Qualifier("public") TestBean spouse, @Valu return tb; } + @SuppressWarnings("unused") @Bean @Scope("prototype") private TestBean privateInstance() { return new TestBean("privateInstance", i++); diff --git a/spring-context/src/test/java/org/springframework/context/annotation5/OtherFooDao.java b/spring-context/src/test/java/org/springframework/context/annotation5/OtherFooDao.java index 5434c4f4b5c2..2b2d8e00eab0 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation5/OtherFooDao.java +++ b/spring-context/src/test/java/org/springframework/context/annotation5/OtherFooDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,6 @@ import example.scannable.FooDao; -import org.springframework.context.annotation.Lazy; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - /** * @author Juergen Hoeller */ diff --git a/spring-context/src/test/java/org/springframework/context/conversionservice/Bar.java b/spring-context/src/test/java/org/springframework/context/conversionservice/Bar.java index b89f6274adb5..80949157002e 100644 --- a/spring-context/src/test/java/org/springframework/context/conversionservice/Bar.java +++ b/spring-context/src/test/java/org/springframework/context/conversionservice/Bar.java @@ -20,13 +20,13 @@ * @author Keith Donald */ public class Bar { - + private String value; - + public Bar(String value) { this.value = value; } - + public String getValue() { return value; } diff --git a/spring-context/src/test/java/org/springframework/context/conversionservice/ConversionServiceContextConfigTests.java b/spring-context/src/test/java/org/springframework/context/conversionservice/ConversionServiceContextConfigTests.java index 60dd150dcbd9..1771dd7cf572 100644 --- a/spring-context/src/test/java/org/springframework/context/conversionservice/ConversionServiceContextConfigTests.java +++ b/spring-context/src/test/java/org/springframework/context/conversionservice/ConversionServiceContextConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ * @author Keith Donald */ public class ConversionServiceContextConfigTests { - + @Test public void testConfigOk() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/context/conversionservice/conversionService.xml"); diff --git a/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java b/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java index 9baa31dc2f2a..f0f41bbf3143 100644 --- a/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,8 @@ public class ApplicationContextEventTests { @Test public void simpleApplicationEventMulticaster() { - ApplicationListener listener = EasyMock.createMock(ApplicationListener.class); + @SuppressWarnings("unchecked") + ApplicationListener listener = EasyMock.createMock(ApplicationListener.class); ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext()); listener.onApplicationEvent(evt); @@ -72,12 +73,13 @@ public void orderedListeners() { smc.multicastEvent(new MyOtherEvent(this)); } + @SuppressWarnings("unchecked") @Test public void proxiedListeners() { MyOrderedListener1 listener1 = new MyOrderedListener1(); MyOrderedListener2 listener2 = new MyOrderedListener2(listener1); - ApplicationListener proxy1 = (ApplicationListener) new ProxyFactory(listener1).getProxy(); - ApplicationListener proxy2 = (ApplicationListener) new ProxyFactory(listener2).getProxy(); + ApplicationListener proxy1 = (ApplicationListener) new ProxyFactory(listener1).getProxy(); + ApplicationListener proxy2 = (ApplicationListener) new ProxyFactory(listener2).getProxy(); SimpleApplicationEventMulticaster smc = new SimpleApplicationEventMulticaster(); smc.addApplicationListener(proxy1); @@ -206,7 +208,7 @@ public MyOtherEvent(Object source) { } - public static class MyOrderedListener1 implements ApplicationListener, Ordered { + public static class MyOrderedListener1 implements ApplicationListener, Ordered { public final Set seenEvents = new HashSet(); @@ -246,7 +248,7 @@ public void onApplicationEvent(MyEvent event) { } - public static class MyNonSingletonListener implements ApplicationListener { + public static class MyNonSingletonListener implements ApplicationListener { public static final Set seenEvents = new HashSet(); diff --git a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java index eeeee80b1ee2..d64bf70c5e1d 100644 --- a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ * @author Rick Evans */ public class EventPublicationInterceptorTests { - + private ApplicationEventPublisher publisher; @@ -48,7 +48,7 @@ public void setUp() { publisher = createMock(ApplicationEventPublisher.class); replay(publisher); } - + @After public void tearDown() { verify(publisher); @@ -92,7 +92,7 @@ public void testExpectedBehavior() throws Exception { class TestContext extends StaticApplicationContext { protected void onRefresh() throws BeansException { - addListener(listener); + addApplicationListener(listener); } } @@ -137,13 +137,13 @@ public TestEventWithNoValidOneArgObjectCtor() { } - public static class FactoryBeanTestListener extends TestListener implements FactoryBean { + public static class FactoryBeanTestListener extends TestListener implements FactoryBean { - public Object getObject() throws Exception { + public String getObject() throws Exception { return "test"; } - public Class getObjectType() { + public Class getObjectType() { return String.class; } diff --git a/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java b/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java index 5fa2f37ccf53..721b4b5ceaba 100644 --- a/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java +++ b/spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ public void testContextStoppedEvent() { assertFalse(lifecycleBean.isRunning()); context.start(); assertTrue(lifecycleBean.isRunning()); - assertEquals(0, listener.getStoppedCount()); + assertEquals(0, listener.getStoppedCount()); context.stop(); assertFalse(lifecycleBean.isRunning()); assertEquals(1, listener.getStoppedCount()); @@ -63,7 +63,7 @@ public void testContextStoppedEvent() { } - private static class LifecycleListener implements ApplicationListener { + private static class LifecycleListener implements ApplicationListener { private ApplicationContext context; diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index 5eac00f54e68..d60318407db9 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public void genericApplicationContext() throws Exception { AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); ac.getBeanFactory().registerScope("myScope", new Scope() { - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { return objectFactory.getObject(); } public Object remove(String name) { diff --git a/spring-context/src/test/java/org/springframework/context/support/ApplicationContextLifecycleTests.java b/spring-context/src/test/java/org/springframework/context/support/ApplicationContextLifecycleTests.java index 1f0df6abdae2..3620374124bd 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ApplicationContextLifecycleTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ApplicationContextLifecycleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/support/Assembler.java b/spring-context/src/test/java/org/springframework/context/support/Assembler.java index f31719121929..e62856b5c165 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Assembler.java +++ b/spring-context/src/test/java/org/springframework/context/support/Assembler.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,25 +21,26 @@ */ public class Assembler implements TestIF { + @SuppressWarnings("unused") private Service service; - private Logic l; + private Logic l; private String name; public void setService(Service service) { this.service = service; } - + public void setLogic(Logic l) { this.l = l; } - + public void setBeanName(String name) { this.name = name; } public void test() { } - + public void output() { System.out.println("Bean " + name); l.output(); diff --git a/spring-context/src/test/java/org/springframework/context/support/AutowiredService.java b/spring-context/src/test/java/org/springframework/context/support/AutowiredService.java index 285e8348bdee..3ab4a12d9597 100644 --- a/spring-context/src/test/java/org/springframework/context/support/AutowiredService.java +++ b/spring-context/src/test/java/org/springframework/context/support/AutowiredService.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java index c50e7941dd5b..e0b0361a76da 100644 --- a/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,10 +32,10 @@ /** * Tests the interaction between {@link ApplicationContext} implementations and - * any registered {@link BeanFactoryPostProcessor} implementations. Specifically + * any registered {@link BeanFactoryPostProcessor} implementations. Specifically * {@link StaticApplicationContext} is used for the tests, but what's represented * here is any {@link AbstractApplicationContext} implementation. - * + * * @author Colin Sampaleanu * @author Juergen Hoeller * @author Chris Beams @@ -54,7 +54,7 @@ public void testRegisteredBeanFactoryPostProcessor() { ac.refresh(); assertTrue(bfpp.wasCalled); } - + @Test public void testDefinedBeanFactoryPostProcessor() { StaticApplicationContext ac = new StaticApplicationContext(); @@ -93,7 +93,7 @@ public void testBeanFactoryPostProcessorNotExecutedByBeanFactory() { assertFalse(bfpp.wasCalled); } - + public static class TestBeanFactoryPostProcessor implements BeanFactoryPostProcessor { public String initValue; @@ -103,10 +103,10 @@ public void setInitValue(String initValue) { } public boolean wasCalled = false; - + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { wasCalled = true; } } - + } diff --git a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java index 1fdec145cc6c..8dab6c455fae 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ClassPathXmlApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,9 +69,8 @@ public final class ClassPathXmlApplicationContextTests { private static final String ALIAS_THAT_OVERRIDES_PARENT_CONTEXT = PATH + "aliasThatOverridesParent.xml"; private static final String ALIAS_FOR_PARENT_CONTEXT = PATH + "aliasForParent.xml"; private static final String TEST_PROPERTIES = "test.properties"; - private static final String FQ_TEST_PROPERTIES = "classpath:org/springframework/beans/factory/xml/" + TEST_PROPERTIES; - + @Test public void testSingleConfigLocation() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(FQ_SIMPLE_CONTEXT); @@ -320,7 +319,7 @@ private void assertOneMessageSourceOnly(ClassPathXmlApplicationContext ctx, Obje @Test public void testResourceAndInputStream() throws IOException { ClassPathXmlApplicationContext ctx = - new ClassPathXmlApplicationContext(RESOURCE_CONTEXT) { + new ClassPathXmlApplicationContext(RESOURCE_CONTEXT) { public Resource getResource(String location) { if (TEST_PROPERTIES.equals(location)) { return new ClassPathResource(TEST_PROPERTIES, ClassPathXmlApplicationContextTests.class); diff --git a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java index 7f88ebfd5787..1c8d811ca067 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public void createDefaultConversionService() { ConversionService service = factory.getObject(); assertTrue(service.canConvert(String.class, Integer.class)); } - + @Test public void createDefaultConversionServiceWithSupplements() { ConversionServiceFactoryBean factory = new ConversionServiceFactoryBean(); @@ -61,6 +61,7 @@ public Foo convert(String source) { converters.add(new ConverterFactory() { public Converter getConverter(Class targetType) { return new Converter () { + @SuppressWarnings("unchecked") public T convert(String source) { return (T) new Bar(); } @@ -81,7 +82,7 @@ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor t assertTrue(service.canConvert(String.class, Integer.class)); assertTrue(service.canConvert(String.class, Foo.class)); assertTrue(service.canConvert(String.class, Bar.class)); - assertTrue(service.canConvert(String.class, Baz.class)); + assertTrue(service.canConvert(String.class, Baz.class)); } @Test(expected=IllegalArgumentException.class) @@ -103,7 +104,7 @@ public void conversionServiceInApplicationContextWithResourceOverriding() { doTestConversionServiceInApplicationContext("conversionServiceWithResourceOverriding.xml", FileSystemResource.class); } - private void doTestConversionServiceInApplicationContext(String fileName, Class resourceClass) { + private void doTestConversionServiceInApplicationContext(String fileName, Class resourceClass) { ApplicationContext ctx = new ClassPathXmlApplicationContext(fileName, getClass()); ResourceTestBean tb = ctx.getBean("resourceTestBean", ResourceTestBean.class); assertTrue(resourceClass.isInstance(tb.getResource())); @@ -119,16 +120,17 @@ private void doTestConversionServiceInApplicationContext(String fileName, Class public static class Foo { } - + public static class Bar { } - + public static class Baz { } public static class ComplexConstructorArgument { - public ComplexConstructorArgument(Map map) { + @SuppressWarnings("cast") + public ComplexConstructorArgument(Map> map) { assertTrue(!map.isEmpty()); assertTrue(map.keySet().iterator().next() instanceof String); assertTrue(map.values().iterator().next() instanceof Class); diff --git a/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java b/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java index 18bd081d2dfa..36fd9f68cb9a 100644 --- a/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -295,7 +295,7 @@ public void singleSmartLifecycleShutdown() throws Exception { @Test public void singleLifecycleShutdown() throws Exception { CopyOnWriteArrayList stoppedBeans = new CopyOnWriteArrayList(); - Lifecycle bean = new TestLifecycleBean(null, stoppedBeans); + Lifecycle bean = new TestLifecycleBean(null, stoppedBeans); StaticApplicationContext context = new StaticApplicationContext(); context.getBeanFactory().registerSingleton("bean", bean); context.refresh(); @@ -636,7 +636,7 @@ public boolean isAutoStartup() { } public void setAutoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; + this.autoStartup = autoStartup; } public void stop(final Runnable callback) { @@ -692,17 +692,17 @@ public int getPhase() { } - public static class DummySmartLifecycleFactoryBean implements FactoryBean, SmartLifecycle { + public static class DummySmartLifecycleFactoryBean implements FactoryBean, SmartLifecycle { public boolean running = false; DummySmartLifecycleBean bean = new DummySmartLifecycleBean(); - public Object getObject() throws Exception { + public DummySmartLifecycleBean getObject() throws Exception { return this.bean; } - public Class getObjectType() { + public Class getObjectType() { return DummySmartLifecycleBean.class; } diff --git a/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java b/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java index b0a90824d447..3ba4294768e4 100644 --- a/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java +++ b/spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java @@ -8,13 +8,13 @@ * @author Juergen Hoeller * @since 06.10.2004 */ -public class FactoryBeanAndApplicationListener implements FactoryBean, ApplicationListener { +public class FactoryBeanAndApplicationListener implements FactoryBean, ApplicationListener { - public Object getObject() throws Exception { + public String getObject() throws Exception { return ""; } - public Class getObjectType() { + public Class getObjectType() { return String.class; } diff --git a/spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java index 8587ff38ced1..072485d71aa4 100644 --- a/spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/support/LifecycleTestBean.java b/spring-context/src/test/java/org/springframework/context/support/LifecycleTestBean.java index 8c2208883784..44dcf38bd685 100644 --- a/spring-context/src/test/java/org/springframework/context/support/LifecycleTestBean.java +++ b/spring-context/src/test/java/org/springframework/context/support/LifecycleTestBean.java @@ -54,7 +54,7 @@ public void start() { public void stop() { this.stopOrder = ++stopCounter; - this.running = false; + this.running = false; } } diff --git a/spring-context/src/test/java/org/springframework/context/support/Logic.java b/spring-context/src/test/java/org/springframework/context/support/Logic.java index ee1974670ce0..9269f59d27bd 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Logic.java +++ b/spring-context/src/test/java/org/springframework/context/support/Logic.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,24 +22,28 @@ public class Logic implements BeanNameAware { - + + @SuppressWarnings("unused") private Log log = LogFactory.getLog(Logic.class); + private String name; + + @SuppressWarnings("unused") private Assembler a; - + public void setAssembler(Assembler a) { this.a = a; } - + /* (non-Javadoc) * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) */ public void setBeanName(String name) { this.name = name; } - + public void output() { - System.out.println("Bean " + name); + System.out.println("Bean " + name); } } diff --git a/spring-context/src/test/java/org/springframework/context/support/NoOpAdvice.java b/spring-context/src/test/java/org/springframework/context/support/NoOpAdvice.java index 87d195dc1c4d..9b4c7ec10792 100644 --- a/spring-context/src/test/java/org/springframework/context/support/NoOpAdvice.java +++ b/spring-context/src/test/java/org/springframework/context/support/NoOpAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public class NoOpAdvice implements ThrowsAdvice { public void afterThrowing(Exception ex) throws Throwable { - // no-op + // no-op } } diff --git a/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java index 0884859f23ac..fb0e570283b0 100644 --- a/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/PropertyResourceConfigurerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,15 +35,15 @@ /** * Integration tests for {@link PropertyResourceConfigurer} implementations requiring - * interaction with an {@link ApplicationContext}. For example, a {@link PropertyPlaceholderConfigurer} + * interaction with an {@link ApplicationContext}. For example, a {@link PropertyPlaceholderConfigurer} * that contains ${..} tokens in its 'location' property requires being tested through an ApplicationContext * as opposed to using only a BeanFactory during testing. - * + * * @author Chris Beams * @see org.springframework.beans.factory.config.PropertyResourceConfigurerTests */ public class PropertyResourceConfigurerIntegrationTests { - + @Test public void testPropertyPlaceholderConfigurerWithSystemPropertyInLocation() { StaticApplicationContext ac = new StaticApplicationContext(); @@ -85,14 +85,14 @@ public void testPropertyPlaceholderConfigurerWithSystemPropertiesInLocation() { catch (BeanInitializationException ex) { // expected assertTrue(ex.getCause() instanceof FileNotFoundException); - // slight hack for Linux/Unix systems + // slight hack for Linux/Unix systems String userDir = StringUtils.cleanPath(System.getProperty("user.dir")); if (userDir.startsWith("/")) { userDir = userDir.substring(1); } /* the above hack doesn't work since the exception message is created without the leading / stripped so the test fails. Changed 17/11/04. DD */ - //assertTrue(ex.getMessage().indexOf(userDir + "/test/" + userDir) != -1); + //assertTrue(ex.getMessage().indexOf(userDir + "/test/" + userDir) != -1); assertTrue(ex.getMessage().contains(userDir + "/test/" + userDir) || ex.getMessage().contains(userDir + "/test//" + userDir)); } diff --git a/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java b/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java index 8226dae18649..3e640d914572 100644 --- a/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ /** * Unit tests for {@link PropertySourcesPlaceholderConfigurer}. - * + * * @author Chris Beams * @since 3.1 */ diff --git a/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java b/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java index 8a462c0425bf..d0b1d74b04d2 100644 --- a/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java @@ -115,8 +115,7 @@ protected void doTestMessageAccess( if (alwaysUseMessageFormat) { pvs.add("alwaysUseMessageFormat", Boolean.TRUE); } - Class clazz = reloadable ? - (Class) ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class; + Class clazz = reloadable ? ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class; ac.registerSingleton("messageSource", clazz, pvs); ac.refresh(); diff --git a/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java b/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java index 01d95795fa58..601fd09012cb 100644 --- a/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java +++ b/spring-context/src/test/java/org/springframework/context/support/SimpleThreadScopeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java b/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java index 40255c0e684a..996034a1df71 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java +++ b/spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,22 +27,24 @@ */ public class Spr7283Tests { - @Test - public void testListWithInconsistentElementType() { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass()); - List list = ctx.getBean("list", List.class); + @Test + public void testListWithInconsistentElementType() { + ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( + "spr7283.xml", getClass()); + List list = ctx.getBean("list", List.class); assertEquals(2, list.size()); assertTrue(list.get(0) instanceof A); assertTrue(list.get(1) instanceof B); - } + } + public static class A { + public A() { + } + } - public static class A { - public A() {} - } + public static class B { + public B() { + } + } - public static class B { - public B() {} - } - } diff --git a/spring-context/src/test/java/org/springframework/context/support/Spr7816Tests.java b/spring-context/src/test/java/org/springframework/context/support/Spr7816Tests.java index 998049819c75..9c7e9a2319b1 100644 --- a/spring-context/src/test/java/org/springframework/context/support/Spr7816Tests.java +++ b/spring-context/src/test/java/org/springframework/context/support/Spr7816Tests.java @@ -37,13 +37,13 @@ public void spr7816() { assertEquals(Entrance.class, adapter.getSupportedTypes().get("Entrance")); assertEquals(Dwelling.class, adapter.getSupportedTypes().get("Dwelling")); } - + public static class FilterAdapter { - + private String extensionPrefix; - + private Map> supportedTypes; - + public FilterAdapter(final String extensionPrefix, final Map> supportedTypes) { this.extensionPrefix = extensionPrefix; this.supportedTypes = supportedTypes; @@ -58,17 +58,17 @@ public Map> getSupportedTypes() { } } - + public static class Building extends DomainEntity { } - + public static class Entrance extends DomainEntity { } - + public static class Dwelling extends DomainEntity { } - + public abstract static class DomainEntity { - + } } diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java index 9bfe88b2cc29..032d15bd58b3 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,7 +45,7 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio /** Run for each test */ protected ConfigurableApplicationContext createContext() throws Exception { StaticApplicationContext parent = new StaticApplicationContext(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Roderick"); parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); @@ -53,7 +53,7 @@ protected ConfigurableApplicationContext createContext() throws Exception { parent.registerSingleton(StaticApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME, TestApplicationEventMulticaster.class, null); parent.refresh(); - parent.addListener(parentListener) ; + parent.addApplicationListener(parentListener) ; parent.getStaticMessageSource().addMessage("code1", Locale.getDefault(), "message1"); @@ -65,7 +65,7 @@ protected ConfigurableApplicationContext createContext() throws Exception { Resource resource = new ClassPathResource("testBeans.properties", getClass()); reader.loadBeanDefinitions(new EncodedResource(resource, "ISO-8859-1")); sac.refresh(); - sac.addListener(listener); + sac.addApplicationListener(listener); sac.getStaticMessageSource().addMessage("code2", Locale.getDefault(), "message2"); diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java index d98528b23066..177e0d490fad 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,13 +41,13 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes /** Run for each test */ protected ConfigurableApplicationContext createContext() throws Exception { StaticApplicationContext parent = new StaticApplicationContext(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Roderick"); parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); parent.registerPrototype("father", TestBean.class, new MutablePropertyValues(m)); parent.refresh(); - parent.addListener(parentListener) ; + parent.addApplicationListener(parentListener) ; parent.getStaticMessageSource().addMessage("code1", Locale.getDefault(), "message1"); @@ -58,7 +58,7 @@ protected ConfigurableApplicationContext createContext() throws Exception { PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory()); reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass())); sac.refresh(); - sac.addListener(listener); + sac.addApplicationListener(listener); sac.getStaticMessageSource().addMessage("code2", Locale.getDefault(), "message2"); diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java index 47e72fb91169..e2b5f9ccc619 100644 --- a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public void testGetMessageWithDefaultPassedInAndNotFoundInMsgCatalog() { /** * We really are testing the AbstractMessageSource class here. * The underlying implementation uses a hashMap to cache messageFormats - * once a message has been asked for. This test is an attempt to + * once a message has been asked for. This test is an attempt to * make sure the cache is being used properly. * @see org.springframework.context.support.AbstractMessageSource for more details. */ @@ -118,7 +118,7 @@ public void testGetMessageWithNoDefaultPassedInAndFoundInMsgCatalog() { /* Try with Locale.US Since the msg has a time value in it, we will use String.indexOf(...) - to just look for a substring without the time. This is because it is + to just look for a substring without the time. This is because it is possible that by the time we store a time variable in this method and the time the ResourceBundleMessageSource resolves the msg the minutes of the time might not be the same. @@ -198,14 +198,14 @@ public void testMessageSourceResolvable() { protected ConfigurableApplicationContext createContext() throws Exception { StaticApplicationContext parent = new StaticApplicationContext(); - Map m = new HashMap(); + Map m = new HashMap(); m.put("name", "Roderick"); parent.registerPrototype("rod", org.springframework.beans.TestBean.class, new MutablePropertyValues(m)); m.put("name", "Albert"); parent.registerPrototype("father", org.springframework.beans.TestBean.class, new MutablePropertyValues(m)); parent.refresh(); - parent.addListener(parentListener); + parent.addApplicationListener(parentListener); this.sac = new StaticApplicationContext(parent); @@ -218,10 +218,10 @@ protected ConfigurableApplicationContext createContext() throws Exception { PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory()); reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass())); sac.refresh(); - sac.addListener(listener); + sac.addApplicationListener(listener); StaticMessageSource messageSource = sac.getStaticMessageSource(); - Map usMessages = new HashMap(3); + Map usMessages = new HashMap(3); usMessages.put("message.format.example1", MSG_TXT1_US); usMessages.put("message.format.example2", MSG_TXT2_US); usMessages.put("message.format.example3", MSG_TXT3_US); diff --git a/spring-context/src/test/java/org/springframework/context/support/TestIF.java b/spring-context/src/test/java/org/springframework/context/support/TestIF.java index d458965dc3d1..7ee7a9c00694 100644 --- a/spring-context/src/test/java/org/springframework/context/support/TestIF.java +++ b/spring-context/src/test/java/org/springframework/context/support/TestIF.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java b/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java index 3743579d0029..488f640edea3 100644 --- a/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -186,7 +186,7 @@ protected Context createInitialContext() throws NamingException { } - /** + /** * Needed so that we can mock the create() method. */ private interface SlsbHome extends EJBLocalHome { diff --git a/spring-context/src/test/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBeanTests.java index 0b8d488a52ee..a359dce664da 100644 --- a/spring-context/src/test/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/access/LocalStatelessSessionProxyFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,16 +41,16 @@ public class LocalStatelessSessionProxyFactoryBeanTests { public void testInvokesMethod() throws Exception { final int value = 11; final String jndiName = "foo"; - + MyEjb myEjb = createMock(MyEjb.class); expect(myEjb.getValue()).andReturn(value); myEjb.remove(); replay(myEjb); - + final MyHome home = createMock(MyHome.class); expect(home.create()).andReturn(myEjb); replay(home); - + JndiTemplate jt = new JndiTemplate() { public Object lookup(String name) throws NamingException { // parameterize @@ -58,13 +58,13 @@ public Object lookup(String name) throws NamingException { return home; } }; - + LocalStatelessSessionProxyFactoryBean fb = new LocalStatelessSessionProxyFactoryBean(); fb.setJndiName(jndiName); fb.setResourceRef(true); fb.setBusinessInterface(MyBusinessMethods.class); fb.setJndiTemplate(jt); - + // Need lifecycle methods fb.afterPropertiesSet(); @@ -72,9 +72,9 @@ public Object lookup(String name) throws NamingException { assertTrue(Proxy.isProxyClass(mbm.getClass())); assertTrue(mbm.getValue() == value); verify(myEjb); - verify(home); + verify(home); } - + @Test public void testInvokesMethodOnEjb3StyleBean() throws Exception { final int value = 11; @@ -110,12 +110,12 @@ public Object lookup(String name) throws NamingException { @Test public void testCreateException() throws Exception { final String jndiName = "foo"; - + final CreateException cex = new CreateException(); final MyHome home = createMock(MyHome.class); expect(home.create()).andThrow(cex); replay(home); - + JndiTemplate jt = new JndiTemplate() { public Object lookup(String name) throws NamingException { // parameterize @@ -123,20 +123,20 @@ public Object lookup(String name) throws NamingException { return home; } }; - + LocalStatelessSessionProxyFactoryBean fb = new LocalStatelessSessionProxyFactoryBean(); fb.setJndiName(jndiName); fb.setResourceRef(false); // no java:comp/env prefix fb.setBusinessInterface(MyBusinessMethods.class); assertEquals(fb.getBusinessInterface(), MyBusinessMethods.class); fb.setJndiTemplate(jt); - + // Need lifecycle methods fb.afterPropertiesSet(); MyBusinessMethods mbm = (MyBusinessMethods) fb.getObject(); assertTrue(Proxy.isProxyClass(mbm.getClass())); - + try { mbm.getValue(); fail("Should have failed to create EJB"); @@ -144,10 +144,10 @@ public Object lookup(String name) throws NamingException { catch (EjbAccessException ex) { assertSame(cex, ex.getCause()); } - - verify(home); + + verify(home); } - + @Test public void testNoBusinessInterfaceSpecified() throws Exception { // Will do JNDI lookup to get home but won't call create @@ -162,7 +162,7 @@ public Object lookup(String name) throws NamingException { // parameterize assertTrue(name.equals("java:comp/env/" + jndiName)); return home; - } + } }; LocalStatelessSessionProxyFactoryBean fb = new LocalStatelessSessionProxyFactoryBean(); @@ -184,10 +184,10 @@ public Object lookup(String name) throws NamingException { } // Expect no methods on home - verify(home); + verify(home); } - - + + public static interface MyHome extends EJBLocalHome { MyBusinessMethods create() throws CreateException; diff --git a/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java b/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java index 4d921eafcba5..7f074b2b68f5 100644 --- a/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBeanTests.java index a3d570c3f186..6dd88251bb6f 100644 --- a/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteStatelessSessionProxyFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,16 +53,16 @@ protected Object configuredProxy(SimpleRemoteSlsbInvokerInterceptor si, Class public void testInvokesMethod() throws Exception { final int value = 11; final String jndiName = "foo"; - + MyEjb myEjb = createMock(MyEjb.class); expect(myEjb.getValue()).andReturn(value); myEjb.remove(); replay(myEjb); - + final MyHome home = createMock(MyHome.class); expect(home.create()).andReturn(myEjb); replay(home); - + JndiTemplate jt = new JndiTemplate() { public Object lookup(String name) { // parameterize @@ -70,7 +70,7 @@ public Object lookup(String name) { return home; } }; - + SimpleRemoteStatelessSessionProxyFactoryBean fb = new SimpleRemoteStatelessSessionProxyFactoryBean(); fb.setJndiName(jndiName); fb.setResourceRef(true); @@ -83,10 +83,10 @@ public Object lookup(String name) { MyBusinessMethods mbm = (MyBusinessMethods) fb.getObject(); assertTrue(Proxy.isProxyClass(mbm.getClass())); assertEquals("Returns expected value", value, mbm.getValue()); - verify(myEjb); - verify(home); + verify(myEjb); + verify(home); } - + @Test public void testInvokesMethodOnEjb3StyleBean() throws Exception { final int value = 11; @@ -123,18 +123,18 @@ public Object lookup(String name) { public void testRemoteException() throws Exception { final RemoteException rex = new RemoteException(); final String jndiName = "foo"; - + MyEjb myEjb = createMock(MyEjb.class); expect(myEjb.getValue()).andThrow(rex); // TODO might want to control this behaviour... // Do we really want to call remove after a remote exception? myEjb.remove(); replay(myEjb); - + final MyHome home = createMock(MyHome.class); expect(home.create()).andReturn(myEjb); replay(home); - + JndiTemplate jt = new JndiTemplate() { public Object lookup(String name) { // parameterize @@ -142,13 +142,13 @@ public Object lookup(String name) { return home; } }; - + SimpleRemoteStatelessSessionProxyFactoryBean fb = new SimpleRemoteStatelessSessionProxyFactoryBean(); fb.setJndiName(jndiName); fb.setResourceRef(true); fb.setBusinessInterface(MyBusinessMethods.class); fb.setJndiTemplate(jt); - + // Need lifecycle methods fb.afterPropertiesSet(); @@ -161,19 +161,19 @@ public Object lookup(String name) { catch (RemoteException ex) { assertSame("Threw expected RemoteException", rex, ex); } - verify(myEjb); - verify(home); + verify(myEjb); + verify(home); } - + @Test public void testCreateException() throws Exception { final String jndiName = "foo"; - + final CreateException cex = new CreateException(); final MyHome home = createMock(MyHome.class); expect(home.create()).andThrow(cex); replay(home); - + JndiTemplate jt = new JndiTemplate() { public Object lookup(String name) { // parameterize @@ -181,20 +181,20 @@ public Object lookup(String name) { return home; } }; - + SimpleRemoteStatelessSessionProxyFactoryBean fb = new SimpleRemoteStatelessSessionProxyFactoryBean(); fb.setJndiName(jndiName); // rely on default setting of resourceRef=false, no auto addition of java:/comp/env prefix fb.setBusinessInterface(MyBusinessMethods.class); assertEquals(fb.getBusinessInterface(), MyBusinessMethods.class); fb.setJndiTemplate(jt); - + // Need lifecycle methods fb.afterPropertiesSet(); MyBusinessMethods mbm = (MyBusinessMethods) fb.getObject(); assertTrue(Proxy.isProxyClass(mbm.getClass())); - + try { mbm.getValue(); fail("Should have failed to create EJB"); @@ -202,10 +202,10 @@ public Object lookup(String name) { catch (RemoteException ex) { // expected } - - verify(home); + + verify(home); } - + @Test public void testCreateExceptionWithLocalBusinessInterface() throws Exception { final String jndiName = "foo"; @@ -269,7 +269,7 @@ public Object lookup(String name) throws NamingException { // rely on default setting of resourceRef=false, no auto addition of java:/comp/env prefix // Don't set business interface fb.setJndiTemplate(jt); - + // Check it's a singleton assertTrue(fb.isSingleton()); @@ -281,32 +281,32 @@ public Object lookup(String name) throws NamingException { // TODO more appropriate exception? assertTrue(ex.getMessage().indexOf("businessInterface") != 1); } - + // Expect no methods on home - verify(home); + verify(home); } - - + + protected static interface MyHome extends EJBHome { MyBusinessMethods create() throws CreateException, RemoteException; } - protected static interface MyBusinessMethods { + protected static interface MyBusinessMethods { int getValue() throws RemoteException; } - protected static interface MyLocalBusinessMethods { + protected static interface MyLocalBusinessMethods { int getValue(); } protected static interface MyEjb extends EJBObject, MyBusinessMethods { - + } } diff --git a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java index 1afb7000f3c7..ce47dd818918 100644 --- a/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/ejb/config/JeeNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/format/datetime/DateFormatterTests.java b/spring-context/src/test/java/org/springframework/format/datetime/DateFormatterTests.java index 3df68cdd88d6..50a16f7c04c5 100644 --- a/spring-context/src/test/java/org/springframework/format/datetime/DateFormatterTests.java +++ b/spring-context/src/test/java/org/springframework/format/datetime/DateFormatterTests.java @@ -43,10 +43,7 @@ */ public class DateFormatterTests { - @Rule - public ExpectedException thown = ExpectedException.none(); - - private static final TimeZone UTC = TimeZone.getTimeZone("UTC"); + private DateFormatter formatter = new DateFormatter("yyyy-MM-dd"); @Test public void shouldPrintAndParseDefault() throws Exception { diff --git a/spring-context/src/test/java/org/springframework/format/number/CurrencyFormatterTests.java b/spring-context/src/test/java/org/springframework/format/number/CurrencyFormatterTests.java index d10259b11b0d..68c5b598f98c 100644 --- a/spring-context/src/test/java/org/springframework/format/number/CurrencyFormatterTests.java +++ b/spring-context/src/test/java/org/springframework/format/number/CurrencyFormatterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class CurrencyFormatterTests { private CurrencyFormatter formatter = new CurrencyFormatter(); - + @Test public void formatValue() { assertEquals("$23.00", formatter.print(new BigDecimal("23"), Locale.US)); diff --git a/spring-context/src/test/java/org/springframework/format/number/NumberFormatterTests.java b/spring-context/src/test/java/org/springframework/format/number/NumberFormatterTests.java index bcc529544ec2..3054a00406e0 100644 --- a/spring-context/src/test/java/org/springframework/format/number/NumberFormatterTests.java +++ b/spring-context/src/test/java/org/springframework/format/number/NumberFormatterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/format/number/PercentFormatterTests.java b/spring-context/src/test/java/org/springframework/format/number/PercentFormatterTests.java index a69da954c8ba..9909376b89ff 100644 --- a/spring-context/src/test/java/org/springframework/format/number/PercentFormatterTests.java +++ b/spring-context/src/test/java/org/springframework/format/number/PercentFormatterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java index abd5e87e3ce2..77988a38364b 100644 --- a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -195,7 +195,7 @@ private static class TestFormatterRegistrar implements FormatterRegistrar { public void registerFormatters(FormatterRegistry registry) { registry.addFormatter(new TestBeanFormatter()); } - + } - + } diff --git a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java index e6e0d82a5e1d..a31bec83d54e 100644 --- a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java +++ b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java @@ -219,7 +219,7 @@ public Date convert(DateTime source) { assertEquals(new LocalDate(2009, 10, 2), new LocalDate(dates.get(2))); } } - + @Test public void testPrintNull() throws ParseException { formattingService.addFormatterForFieldType(Number.class, new NumberFormatter()); @@ -324,7 +324,7 @@ public static class Model { @org.springframework.format.annotation.DateTimeFormat(style="S-") public Date date; - + @org.springframework.format.annotation.DateTimeFormat(pattern="M-d-yy") public List dates; @@ -355,13 +355,6 @@ public void setDates(List dates) { } } - - @org.springframework.format.annotation.DateTimeFormat(pattern="${datePattern}") - @Retention(RetentionPolicy.RUNTIME) - public static @interface MyDatePattern { - } - - public static class NullReturningFormatter implements Formatter { public String print(Integer object, Locale locale) { @@ -371,7 +364,7 @@ public String print(Integer object, Locale locale) { public Integer parse(String text, Locale locale) throws ParseException { return null; } - + } diff --git a/spring-context/src/test/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaverTests.java b/spring-context/src/test/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaverTests.java index 09644b02c0e2..a0897eda5150 100644 --- a/spring-context/src/test/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaverTests.java +++ b/spring-context/src/test/java/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoaderTests.java b/spring-context/src/test/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoaderTests.java index a5a7fc2d41a4..3cafa8950e02 100644 --- a/spring-context/src/test/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoaderTests.java +++ b/spring-context/src/test/java/org/springframework/instrument/classloading/ResourceOverridingShadowingClassLoaderTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2006 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,47 +29,47 @@ * @since 2.0 */ public class ResourceOverridingShadowingClassLoaderTests { - + private static final String EXISTING_RESOURCE = "org/springframework/instrument/classloading/testResource.xml"; - + private ClassLoader thisClassLoader = getClass().getClassLoader(); - + private ResourceOverridingShadowingClassLoader overridingLoader = new ResourceOverridingShadowingClassLoader(thisClassLoader); - - + + @Test public void testFindsExistingResourceWithGetResourceAndNoOverrides() { assertNotNull(thisClassLoader.getResource(EXISTING_RESOURCE)); assertNotNull(overridingLoader.getResource(EXISTING_RESOURCE)); } - + @Test public void testDoesNotFindExistingResourceWithGetResourceAndNullOverride() { assertNotNull(thisClassLoader.getResource(EXISTING_RESOURCE)); overridingLoader.override(EXISTING_RESOURCE, null); assertNull(overridingLoader.getResource(EXISTING_RESOURCE)); } - + @Test public void testFindsExistingResourceWithGetResourceAsStreamAndNoOverrides() { assertNotNull(thisClassLoader.getResourceAsStream(EXISTING_RESOURCE)); assertNotNull(overridingLoader.getResourceAsStream(EXISTING_RESOURCE)); } - + @Test public void testDoesNotFindExistingResourceWithGetResourceAsStreamAndNullOverride() { assertNotNull(thisClassLoader.getResourceAsStream(EXISTING_RESOURCE)); overridingLoader.override(EXISTING_RESOURCE, null); assertNull(overridingLoader.getResourceAsStream(EXISTING_RESOURCE)); } - + @Test public void testFindsExistingResourceWithGetResourcesAndNoOverrides() throws IOException { assertNotNull(thisClassLoader.getResources(EXISTING_RESOURCE)); assertNotNull(overridingLoader.getResources(EXISTING_RESOURCE)); assertEquals(1, countElements(overridingLoader.getResources(EXISTING_RESOURCE))); } - + @Test public void testDoesNotFindExistingResourceWithGetResourcesAndNullOverride() throws IOException { assertNotNull(thisClassLoader.getResources(EXISTING_RESOURCE)); diff --git a/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java b/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java index db49e67a1be5..e0948790d687 100644 --- a/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java +++ b/spring-context/src/test/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class GlassFishLoadTimeWeaverTests { private GlassFishClassLoaderAdapter loader; private LoadTimeWeaver ltw; - private class DummyInstrumentableClassLoader extends SecureClassLoader { + public class DummyInstrumentableClassLoader extends SecureClassLoader { String INSTR_CL_NAME = GlassFishClassLoaderAdapter.INSTRUMENTABLE_CLASSLOADER_GLASSFISH_V2; @@ -166,4 +166,4 @@ public void testGetThrowawayClassLoader() { assertSame(ltw.getThrowawayClassLoader(), cl); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/jmx/IJmxTestBean.java b/spring-context/src/test/java/org/springframework/jmx/IJmxTestBean.java index 74d579fb8a74..0a6ba490356d 100644 --- a/spring-context/src/test/java/org/springframework/jmx/IJmxTestBean.java +++ b/spring-context/src/test/java/org/springframework/jmx/IJmxTestBean.java @@ -36,5 +36,5 @@ public interface IJmxTestBean { // used to test invalid methods that exist in the proxy interface public void dontExposeMe(); - + } diff --git a/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java b/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java index e73f6106c76b..78b3d7daeb29 100644 --- a/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java +++ b/spring-context/src/test/java/org/springframework/jmx/JmxTestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -131,13 +131,15 @@ public void dontExposeMe() { protected void someProtectedMethod() { } - private void somePrivateMethod() { + @SuppressWarnings("unused") + private void somePrivateMethod() { } protected void getSomething() { } - private void getSomethingElse() { + @SuppressWarnings("unused") + private void getSomethingElse() { } } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/DateRange.java b/spring-context/src/test/java/org/springframework/jmx/export/DateRange.java index a9e7f84df6b8..5603c43abd1d 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/DateRange.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/DateRange.java @@ -24,7 +24,7 @@ public class DateRange { private Date startDate; - + private Date endDate; public Date getStartDate() { diff --git a/spring-context/src/test/java/org/springframework/jmx/export/ExceptionOnInitBean.java b/spring-context/src/test/java/org/springframework/jmx/export/ExceptionOnInitBean.java index d11bee12ace6..c61cd388aa2e 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/ExceptionOnInitBean.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/ExceptionOnInitBean.java @@ -22,7 +22,7 @@ public class ExceptionOnInitBean { private boolean exceptOnInit = false; - + private String name; public String getName() { diff --git a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterOperationsTests.java b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterOperationsTests.java index d95c6b4f28b3..e6d8e2bf70df 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterOperationsTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterOperationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/jmx/export/NotificationListenerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/NotificationListenerTests.java index 3ab938d95d99..93192c980c31 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/NotificationListenerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/NotificationListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationMetadataAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationMetadataAssemblerTests.java index 5f65e056f614..d53726a7fb81 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationMetadataAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationMetadataAssemblerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationTestBean.java b/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationTestBean.java index 1971dddc57d5..97a3581954e6 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationTestBean.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/annotation/AnnotationTestBean.java @@ -66,7 +66,7 @@ public void setName(String name) { public String getName() { return name; } - + @ManagedAttribute(description = "The Nick Name Attribute") public void setNickName(String nickName) { this.nickName = nickName; @@ -98,18 +98,18 @@ public int add(int x, int y) { public void dontExposeMe() { throw new RuntimeException(); } - - @ManagedMetric(description="The QueueSize metric", currencyTimeLimit = 20, persistPolicy="OnUpdate", persistPeriod=300, + + @ManagedMetric(description="The QueueSize metric", currencyTimeLimit = 20, persistPolicy="OnUpdate", persistPeriod=300, category="utilization", metricType = MetricType.COUNTER, displayName="Queue Size", unit="messages") public long getQueueSize() { return 100l; } - + @ManagedMetric public int getCacheEntries() { return 3; } - + } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java index e104e7b4663f..666fd9a67946 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -50,14 +50,14 @@ public void testMBeanRegistration() throws Exception { } public void testRegisterOperations() throws Exception { - IJmxTestBean bean = getBean(); + getBean(); MBeanInfo inf = getMBeanInfo(); assertEquals("Incorrect number of operations registered", getExpectedOperationCount(), inf.getOperations().length); } public void testRegisterAttributes() throws Exception { - IJmxTestBean bean = getBean(); + getBean(); MBeanInfo inf = getMBeanInfo(); assertEquals("Incorrect number of attributes registered", getExpectedAttributeCount(), inf.getAttributes().length); @@ -90,9 +90,8 @@ public void testGetMBeanOperationInfo() throws Exception { for (int x = 0; x < inf.length; x++) { assertNotNull("MBeanOperationInfo should not be null", inf[x]); - assertNotNull( - "Description for MBeanOperationInfo should not be null", - inf[x].getDescription()); + assertNotNull("Description for MBeanOperationInfo should not be null", + inf[x].getDescription()); } } @@ -130,13 +129,13 @@ public void testAttributeInfoHasDescriptors() throws Exception { ModelMBeanAttributeInfo attr = info.getAttribute(NAME_ATTRIBUTE); Descriptor desc = attr.getDescriptor(); assertNotNull("getMethod field should not be null", - desc.getFieldValue("getMethod")); + desc.getFieldValue("getMethod")); assertNotNull("setMethod field should not be null", - desc.getFieldValue("setMethod")); + desc.getFieldValue("setMethod")); assertEquals("getMethod field has incorrect value", "getName", - desc.getFieldValue("getMethod")); + desc.getFieldValue("getMethod")); assertEquals("setMethod field has incorrect value", "setName", - desc.getFieldValue("setMethod")); + desc.getFieldValue("setMethod")); } public void testAttributeHasCorrespondingOperations() throws Exception { @@ -145,16 +144,16 @@ public void testAttributeHasCorrespondingOperations() throws Exception { ModelMBeanOperationInfo get = info.getOperation("getName"); assertNotNull("get operation should not be null", get); assertEquals("get operation should have visibility of four", - (Integer) get.getDescriptor().getFieldValue("visibility"), - new Integer(4)); - assertEquals("get operation should have role \"getter\"", "getter", get.getDescriptor().getFieldValue("role")); + get.getDescriptor().getFieldValue("visibility"), new Integer(4)); + assertEquals("get operation should have role \"getter\"", "getter", + get.getDescriptor().getFieldValue("role")); ModelMBeanOperationInfo set = info.getOperation("setName"); assertNotNull("set operation should not be null", set); assertEquals("set operation should have visibility of four", - (Integer) set.getDescriptor().getFieldValue("visibility"), - new Integer(4)); - assertEquals("set operation should have role \"setter\"", "setter", set.getDescriptor().getFieldValue("role")); + set.getDescriptor().getFieldValue("visibility"), new Integer(4)); + assertEquals("set operation should have role \"setter\"", "setter", + set.getDescriptor().getFieldValue("role")); } public void testNotificationMetadata() throws Exception { diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java index 3c15e835ee06..3bcdb10c67d3 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -18,8 +18,6 @@ import java.util.HashMap; import java.util.Map; -import java.util.Arrays; - import javax.management.Descriptor; import javax.management.MBeanInfo; import javax.management.MBeanParameterInfo; @@ -41,9 +39,9 @@ * @author Chris Beams */ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemblerTests { - + protected static final String QUEUE_SIZE_METRIC = "QueueSize"; - + protected static final String CACHE_ENTRIES_METRIC = "CacheEntries"; public void testDescription() throws Exception { @@ -159,7 +157,7 @@ public void testWithCglibProxy() throws Exception { String objectName = "spring:bean=test,proxy=true"; - Map beans = new HashMap(); + Map beans = new HashMap(); beans.put(objectName, proxy); exporter.setBeans(beans); exporter.afterPropertiesSet(); @@ -170,7 +168,7 @@ public void testWithCglibProxy() throws Exception { assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); } - + public void testMetricDescription() throws Exception { ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanAttributeInfo metric = inf.getAttribute(QUEUE_SIZE_METRIC); @@ -180,7 +178,7 @@ public void testMetricDescription() throws Exception { assertEquals("The description for the getter operation of the queue size metric is incorrect", "The QueueSize metric", operation.getDescription()); } - + public void testMetricDescriptor() throws Exception { ModelMBeanInfo info = getMBeanInfoFromAssembler(); Descriptor desc = info.getAttribute(QUEUE_SIZE_METRIC).getDescriptor(); @@ -192,7 +190,7 @@ public void testMetricDescriptor() throws Exception { assertEquals("Metric Type should be COUNTER", "COUNTER",desc.getFieldValue("metricType")); assertEquals("Metric Category should be utilization", "utilization",desc.getFieldValue("metricCategory")); } - + public void testMetricDescriptorDefaults() throws Exception { ModelMBeanInfo info = getMBeanInfoFromAssembler(); Descriptor desc = info.getAttribute(CACHE_ENTRIES_METRIC).getDescriptor(); diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/IAdditionalTestMethods.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/IAdditionalTestMethods.java index 4c7e41c7472d..d6b59fc5ffa6 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/IAdditionalTestMethods.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/IAdditionalTestMethods.java @@ -9,5 +9,5 @@ public interface IAdditionalTestMethods { String getNickName(); void setNickName(String nickName); - + } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/ICustomJmxBean.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/ICustomJmxBean.java index f3676ba5b8ed..1d74177d3b4a 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/ICustomJmxBean.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/ICustomJmxBean.java @@ -20,7 +20,7 @@ * @author Rob Harrop */ public interface ICustomJmxBean extends ICustomBase { - + String getName(); void setName(String name); diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java index 713263171bec..de0c14bc4269 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -19,8 +19,6 @@ import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanInfo; -import org.junit.Ignore; - /** * @author Rob Harrop */ @@ -57,5 +55,5 @@ public void testGetAgeIsReadOnly() throws Exception { protected String getApplicationContextPath() { return "org/springframework/jmx/export/assembler/interfaceAssemblerCustom.xml"; } - + } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java index d7db96a96181..9c687c73f1bd 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,6 @@ import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanInfo; -import org.junit.Ignore; - /** * @author Rob Harrop */ @@ -41,7 +39,7 @@ public void testGetAgeIsReadOnly() throws Exception { public void testWithUnknownClass() throws Exception { try { - InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("com.foo.bar.Unknown"); + getWithMapping("com.foo.bar.Unknown"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { @@ -51,7 +49,7 @@ public void testWithUnknownClass() throws Exception { public void testWithNonInterface() throws Exception { try { - InterfaceBasedMBeanInfoAssembler assembler = getWithMapping("JmxTestBean"); + getWithMapping("JmxTestBean"); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssemblerTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssemblerTests.java index 64c6bb7f395b..81b5111973f6 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssemblerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssemblerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,12 +67,12 @@ public void testSupermanIsReadOnly() throws Exception { * http://opensource.atlassian.com/projects/spring/browse/SPR-2754 */ public void testIsNotIgnoredDoesntIgnoreUnspecifiedBeanMethods() throws Exception { - final String beanKey = "myTestBean"; + final String beanKey = "myTestBean"; MethodExclusionMBeanInfoAssembler assembler = new MethodExclusionMBeanInfoAssembler(); Properties ignored = new Properties(); ignored.setProperty(beanKey, "dontExposeMe,setSuperman"); assembler.setIgnoredMethodMappings(ignored); - Method method = JmxTestBean.class.getMethod("dontExposeMe", null); + Method method = JmxTestBean.class.getMethod("dontExposeMe"); assertFalse(assembler.isNotIgnored(method, beanKey)); // this bean does not have any ignored methods on it, so must obviously not be ignored... assertTrue(assembler.isNotIgnored(method, "someOtherBeanKey")); diff --git a/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssemblerMappedTests.java b/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssemblerMappedTests.java index 496c3d7c9fcd..6c2dde10b733 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssemblerMappedTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssemblerMappedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/spring-context/src/test/java/org/springframework/jmx/export/naming/KeyNamingStrategyTests.java b/spring-context/src/test/java/org/springframework/jmx/export/naming/KeyNamingStrategyTests.java index 0342d3b2cb75..c98f88489f81 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/naming/KeyNamingStrategyTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/naming/KeyNamingStrategyTests.java @@ -38,5 +38,5 @@ protected String getKey() { protected String getCorrectObjectName() { return OBJECT_NAME; } - + } diff --git a/spring-context/src/test/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisherTests.java b/spring-context/src/test/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisherTests.java index 6f9ab8e724af..3af64885e3d1 100644 --- a/spring-context/src/test/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisherTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/export/notification/ModelMBeanNotificationPublisherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java index 56244c74a4f1..598bc73e8c9b 100644 --- a/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public void ignoreTestValidConnection() throws Exception { bean.afterPropertiesSet(); try { - MBeanServerConnection connection = (MBeanServerConnection) bean.getObject(); + MBeanServerConnection connection = bean.getObject(); assertNotNull("Connection should not be null", connection); // perform simple MBean count test @@ -100,7 +100,7 @@ public void ignoreTestWithLazyConnection() throws Exception { bean.setConnectOnStartup(false); bean.afterPropertiesSet(); - MBeanServerConnection connection = (MBeanServerConnection) bean.getObject(); + MBeanServerConnection connection = bean.getObject(); assertTrue(AopUtils.isAopProxy(connection)); JMXConnectorServer connector = null; @@ -122,7 +122,7 @@ public void testWithLazyConnectionAndNoAccess() throws Exception { bean.setConnectOnStartup(false); bean.afterPropertiesSet(); - MBeanServerConnection connection = (MBeanServerConnection) bean.getObject(); + MBeanServerConnection connection = bean.getObject(); assertTrue(AopUtils.isAopProxy(connection)); bean.destroy(); } diff --git a/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerFactoryBeanTests.java index f2217bfd6add..99ba1564819d 100644 --- a/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java index 5acfff76088f..13897fa7f67a 100644 --- a/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/JndiObjectFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/jndi/JndiTemplateEditorTests.java b/spring-context/src/test/java/org/springframework/jndi/JndiTemplateEditorTests.java index 9a9a6dfb3850..b191a7ada5b2 100644 --- a/spring-context/src/test/java/org/springframework/jndi/JndiTemplateEditorTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/JndiTemplateEditorTests.java @@ -1,13 +1,13 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/test/java/org/springframework/jndi/JndiTemplateTests.java b/spring-context/src/test/java/org/springframework/jndi/JndiTemplateTests.java index 4d658bc2cf7a..b654c575ae97 100644 --- a/spring-context/src/test/java/org/springframework/jndi/JndiTemplateTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/JndiTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java b/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java index bc635f183dac..23b6a7000953 100644 --- a/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java +++ b/spring-context/src/test/java/org/springframework/jndi/SimpleNamingContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java b/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java index 9759c99c5511..a53fd65f89f3 100644 --- a/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java +++ b/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java @@ -23,7 +23,7 @@ * Simple {@link ConfigurableEnvironment} implementation exposing * {@link #setProperty(String, String)} and {@link #withProperty(String, String)} * methods for testing purposes. - * + * * @author Chris Beams * @author Sam Brannen * @since 3.2 diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java index 28670fd43837..3dd9166cb526 100644 --- a/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java +++ b/spring-context/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import javax.naming.NamingException; -import org.springframework.core.CollectionFactory; import org.springframework.jndi.JndiTemplate; /** diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java index b6489e42029f..fd67ca3d5d0d 100644 --- a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ b/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java index 8b816b45d0d6..e3084b889585 100644 --- a/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ b/spring-context/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ * DataSource ds = new DriverManagerDataSource(...); * builder.bind("java:comp/env/jdbc/myds", ds); * builder.activate(); - * + * * Note that it's impossible to activate multiple builders within the same JVM, * due to JNDI restrictions. Thus to configure a fresh builder repeatedly, use * the following code to get a reference to either an already activated builder diff --git a/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java b/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java index 2f2b1e81559e..50be9bb89610 100644 --- a/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java +++ b/spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ public void testRmiProxyFactoryBeanWithUnmarshalException() throws Exception { doTestRmiProxyFactoryBeanWithException(UnmarshalException.class); } - private void doTestRmiProxyFactoryBeanWithException(Class exceptionClass) throws Exception { + private void doTestRmiProxyFactoryBeanWithException(Class exceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IRemoteBean.class); factory.setServiceUrl("rmi://localhost:1090/test"); @@ -130,7 +130,7 @@ public void testRmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); } - private void doTestRmiProxyFactoryBeanWithExceptionAndRefresh(Class exceptionClass) throws Exception { + private void doTestRmiProxyFactoryBeanWithExceptionAndRefresh(Class exceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IRemoteBean.class); factory.setServiceUrl("rmi://localhost:1090/test"); @@ -217,7 +217,7 @@ public void testRmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException } private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( - Class rmiExceptionClass, Class springExceptionClass) throws Exception { + Class rmiExceptionClass, Class springExceptionClass) throws Exception { CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IBusinessBean.class); @@ -272,8 +272,8 @@ public void testRmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException } private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( - Class rmiExceptionClass, Class springExceptionClass) throws Exception { - + Class rmiExceptionClass, Class springExceptionClass) throws Exception { + CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); factory.setServiceInterface(IBusinessBean.class); factory.setServiceUrl("rmi://localhost:1090/test"); @@ -309,7 +309,7 @@ public void testRmiClientInterceptorRequiresUrl() throws Exception{ try { client.afterPropertiesSet(); fail("url isn't set, expected IllegalArgumentException"); - } + } catch(IllegalArgumentException e){ // expected } @@ -436,8 +436,8 @@ public void setName(String nam) throws RemoteException { if (nam != null && nam.endsWith("Exception")) { RemoteException rex = null; try { - Class exClass = Class.forName(nam); - Constructor ctor = exClass.getConstructor(new Class[] {String.class}); + Class exClass = Class.forName(nam); + Constructor ctor = exClass.getConstructor(new Class[] {String.class}); rex = (RemoteException) ctor.newInstance(new Object[] {"myMessage"}); } catch (Exception ex) { diff --git a/spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java b/spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java index a95a2408b546..364610db9e84 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java +++ b/spring-context/src/test/java/org/springframework/scheduling/TestMethodInvokingTask.java @@ -49,4 +49,4 @@ public void stop() { } } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java index be6ef187d25d..5f3231f6c0b1 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java index 4bde32611905..202569059249 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java @@ -60,9 +60,7 @@ public void fixedDelayTask() { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List fixedDelayTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("fixedDelayTasks"); + Map fixedDelayTasks = getPropertyValue(registrar, "fixedDelayTasks"); assertEquals(1, fixedDelayTasks.size()); IntervalTask task = fixedDelayTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -87,9 +85,7 @@ public void fixedRateTask() { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List fixedRateTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("fixedRateTasks"); + Map fixedRateTasks = getPropertyValue(registrar, "fixedRateTasks"); assertEquals(1, fixedRateTasks.size()); IntervalTask task = fixedRateTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -141,9 +137,7 @@ public void cronTask() throws InterruptedException { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List cronTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("cronTasks"); + Map cronTasks = getPropertyValue(registrar, "cronTasks"); assertEquals(1, cronTasks.size()); CronTask task = cronTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -168,9 +162,7 @@ public void metaAnnotationWithFixedRate() { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List fixedRateTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("fixedRateTasks"); + Map fixedRateTasks = getPropertyValue(registrar, "fixedRateTasks"); assertEquals(1, fixedRateTasks.size()); IntervalTask task = fixedRateTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -194,9 +186,7 @@ public void metaAnnotationWithCronExpression() { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List cronTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("cronTasks"); + Map cronTasks = getPropertyValue(registrar, "cronTasks"); assertEquals(1, cronTasks.size()); CronTask task = cronTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -226,9 +216,7 @@ public void propertyPlaceholderWithCronExpression() { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List cronTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("cronTasks"); + Map cronTasks = getPropertyValue(registrar, "cronTasks"); assertEquals(1, cronTasks.size()); CronTask task = cronTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -258,9 +246,7 @@ public void propertyPlaceholderForMetaAnnotation() { Object target = context.getBean("target"); ScheduledTaskRegistrar registrar = (ScheduledTaskRegistrar) new DirectFieldAccessor(postProcessor).getPropertyValue("registrar"); - @SuppressWarnings("unchecked") - List cronTasks = (List) - new DirectFieldAccessor(registrar).getPropertyValue("cronTasks"); + Map cronTasks = getPropertyValue(registrar, "cronTasks"); assertEquals(1, cronTasks.size()); CronTask task = cronTasks.get(0); ScheduledMethodRunnable runnable = (ScheduledMethodRunnable) task.getRunnable(); @@ -320,6 +306,11 @@ public void nonEmptyParamList() { context.refresh(); } + @SuppressWarnings("unchecked") + private Map getPropertyValue(ScheduledTaskRegistrar registrar, + String propertyName) { + return (Map) new DirectFieldAccessor(registrar).getPropertyValue(propertyName); + } static class FixedDelayTestBean { @@ -355,7 +346,7 @@ public void cron() throws IOException { } - static class EmptyAnnotationTestBean { + public static class EmptyAnnotationTestBean { @Scheduled public void invalid() { @@ -364,7 +355,7 @@ public void invalid() { } - static class InvalidCronTestBean { + public static class InvalidCronTestBean { @Scheduled(cron="abc") public void invalid() { @@ -373,7 +364,7 @@ public void invalid() { } - static class NonVoidReturnTypeTestBean { + public static class NonVoidReturnTypeTestBean { @Scheduled(fixedRate=3000) public String invalid() { @@ -383,7 +374,7 @@ public String invalid() { } - static class NonEmptyParamListTestBean { + public static class NonEmptyParamListTestBean { @Scheduled(fixedRate=3000) public void invalid(String oops) { @@ -404,7 +395,7 @@ public void invalid(String oops) { private static @interface Hourly {} - static class MetaAnnotationFixedRateTestBean { + public static class MetaAnnotationFixedRateTestBean { @EveryFiveSeconds public void checkForUpdates() { @@ -412,7 +403,7 @@ public void checkForUpdates() { } - static class MetaAnnotationCronTestBean { + public static class MetaAnnotationCronTestBean { @Hourly public void generateReport() { @@ -420,7 +411,7 @@ public void generateReport() { } - static class PropertyPlaceholderTestBean { + public static class PropertyPlaceholderTestBean { @Scheduled(cron = "${schedules.businessHours}") public void x() { @@ -434,7 +425,7 @@ public void x() { private static @interface BusinessHours {} - static class PropertyPlaceholderMetaAnnotationTestBean { + public static class PropertyPlaceholderMetaAnnotationTestBean { @BusinessHours public void y() { diff --git a/spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java b/spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java index dbf22d24a9cd..5abf33b8ab30 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -229,7 +229,7 @@ private static class TestTask implements Runnable { private final int expectedRunCount; private final AtomicInteger actualRunCount = new AtomicInteger(); - + private final CountDownLatch latch; private Thread lastThread; @@ -254,7 +254,7 @@ private static class TestCallable implements Callable { private final int expectedRunCount; private final AtomicInteger actualRunCount = new AtomicInteger(); - + TestCallable(int expectedRunCount) { this.expectedRunCount = expectedRunCount; } diff --git a/spring-context/src/test/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParserTests.java b/spring-context/src/test/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParserTests.java index fa5e55f9c04a..71af3291fc25 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParserTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/config/AnnotationDrivenBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParserTests.java b/spring-context/src/test/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParserTests.java index 3425f60db591..9f06ac9fcf71 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParserTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/config/ExecutorBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParserTests.java b/spring-context/src/test/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParserTests.java index 5e8f75a35875..f1701207ef29 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParserTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/config/ScheduledTasksBeanDefinitionParserTests.java @@ -50,10 +50,9 @@ public class ScheduledTasksBeanDefinitionParserTests { @Before public void setup() { - this.context = new ClassPathXmlApplicationContext( - "scheduledTasksContext.xml", ScheduledTasksBeanDefinitionParserTests.class); - this.registrar = (ScheduledTaskRegistrar) this.context.getBeansOfType( - ScheduledTaskRegistrar.class).values().iterator().next(); + this.context = new ClassPathXmlApplicationContext("scheduledTasksContext.xml", + ScheduledTasksBeanDefinitionParserTests.class); + this.registrar = this.context.getBeansOfType(ScheduledTaskRegistrar.class).values().iterator().next(); this.testBean = this.context.getBean("testBean"); } @@ -102,7 +101,8 @@ public void cronTasks() { List tasks = (List) new DirectFieldAccessor( this.registrar).getPropertyValue("cronTasks"); assertEquals(1, tasks.size()); - assertEquals("*/4 * 9-17 * * MON-FRI", tasks.get(0).getExpression()); + String expression = tasks.values().iterator().next(); + assertEquals("*/4 * 9-17 * * MON-FRI", expression); } @Test @@ -110,7 +110,8 @@ public void triggerTasks() { List tasks = (List) new DirectFieldAccessor( this.registrar).getPropertyValue("triggerTasks"); assertEquals(1, tasks.size()); - assertThat(tasks.get(0).getTrigger(), instanceOf(TestTrigger.class)); + Trigger trigger = tasks.values().iterator().next(); + assertEquals(TestTrigger.class, trigger.getClass()); } diff --git a/spring-context/src/test/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParserTests.java b/spring-context/src/test/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParserTests.java index cf274050bce0..e8168c02bcda 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParserTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/config/SchedulerBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scheduling/support/CronTriggerTests.java b/spring-context/src/test/java/org/springframework/scheduling/support/CronTriggerTests.java index 49574ae29d5f..248a3889f8a0 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/support/CronTriggerTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/support/CronTriggerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scheduling/support/PeriodicTriggerTests.java b/spring-context/src/test/java/org/springframework/scheduling/support/PeriodicTriggerTests.java index c0faca5e685a..4ea7ecb2e040 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/support/PeriodicTriggerTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/support/PeriodicTriggerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java index 620c737c8608..159ce358a1a5 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,8 +29,10 @@ * @author Juergen Hoeller * @since 20.02.2004 */ +@SuppressWarnings("deprecation") public class TimerSupportTests extends TestCase { + @SuppressWarnings("cast") public void testTimerFactoryBean() throws Exception { final TestTimerTask timerTask0 = new TestTimerTask(); @@ -39,7 +41,7 @@ public void testTimerFactoryBean() throws Exception { mittfb.setTargetObject(task1); mittfb.setTargetMethod("doSomething"); mittfb.afterPropertiesSet(); - final TimerTask timerTask1 = (TimerTask) mittfb.getObject(); + final TimerTask timerTask1 = mittfb.getObject(); final TestRunnable timerTask2 = new TestRunnable(); @@ -48,7 +50,7 @@ public void testTimerFactoryBean() throws Exception { tasks[1] = new ScheduledTimerTask(timerTask1, 10, 20, true); tasks[2] = new ScheduledTimerTask(timerTask2, 20); - final List success = new ArrayList(3); + final List success = new ArrayList(3); final Timer timer = new Timer(true) { public void schedule(TimerTask task, long delay, long period) { if (task == timerTask0 && delay == 0 && period == 10) { diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java index 0655210a429c..828b4ff9cfba 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ * @author Rick Evans * @author Chris Beams */ +@SuppressWarnings("deprecation") public final class TimerTaskExecutorTests { @Test(expected=IllegalArgumentException.class) diff --git a/spring-context/src/test/java/org/springframework/scripting/ScriptBean.java b/spring-context/src/test/java/org/springframework/scripting/ScriptBean.java index ca2f6e476cef..95e40c10980c 100644 --- a/spring-context/src/test/java/org/springframework/scripting/ScriptBean.java +++ b/spring-context/src/test/java/org/springframework/scripting/ScriptBean.java @@ -18,7 +18,7 @@ /** * Simple interface used in testing the scripted beans support. - * + * * @author Rick Evans */ public interface ScriptBean { diff --git a/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java index d3ecec1760ec..455838ce0a8d 100644 --- a/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -241,7 +241,7 @@ public void testResourceScriptFromTag() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("bsh-with-xsd.xml", getClass()); TestBean testBean = (TestBean) ctx.getBean("testBean"); - Collection beanNames = Arrays.asList(ctx.getBeanNamesForType(Messenger.class)); + Collection beanNames = Arrays.asList(ctx.getBeanNamesForType(Messenger.class)); assertTrue(beanNames.contains("messenger")); assertTrue(beanNames.contains("messengerImpl")); assertTrue(beanNames.contains("messengerInstance")); @@ -262,7 +262,7 @@ public void testResourceScriptFromTag() throws Exception { TestBeanAwareMessenger messengerByName = (TestBeanAwareMessenger) ctx.getBean("messengerByName"); assertEquals(testBean, messengerByName.getTestBean()); - Collection beans = ctx.getBeansOfType(Messenger.class).values(); + Collection beans = ctx.getBeansOfType(Messenger.class).values(); assertTrue(beans.contains(messenger)); assertTrue(beans.contains(messengerImpl)); assertTrue(beans.contains(messengerInstance)); diff --git a/spring-context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java b/spring-context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java index 2aa12752903e..fc19107ced6d 100644 --- a/spring-context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java @@ -42,7 +42,7 @@ public class ScriptingDefaultsTests extends TestCase { public void testDefaultRefreshCheckDelay() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG); Advised advised = (Advised) context.getBean("testBean"); - AbstractRefreshableTargetSource targetSource = + AbstractRefreshableTargetSource targetSource = ((AbstractRefreshableTargetSource) advised.getTargetSource()); Field field = AbstractRefreshableTargetSource.class.getDeclaredField("refreshCheckDelay"); field.setAccessible(true); diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyAspectIntegrationTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyAspectIntegrationTests.java index 62f2d3223cce..b0373d46a44e 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyAspectIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyAspectIntegrationTests.java @@ -23,7 +23,7 @@ public void close() { @Test public void testJavaBean() { - + context = new GenericXmlApplicationContext(getClass(), getClass().getSimpleName()+"-java-context.xml"); TestService bean = context.getBean("javaBean", TestService.class); diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java index 530559a6b47c..c43e349880bb 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,8 @@ public void testClassLoading() throws Exception { StaticApplicationContext context = new StaticApplicationContext(); GroovyClassLoader gcl = new GroovyClassLoader(); - Class class1 = gcl.parseClass("class TestBean { def myMethod() { \"foo\" } }"); - Class class2 = gcl.parseClass("class TestBean { def myMethod() { \"bar\" } }"); + Class class1 = gcl.parseClass("class TestBean { def myMethod() { \"foo\" } }"); + Class class2 = gcl.parseClass("class TestBean { def myMethod() { \"bar\" } }"); context.registerBeanDefinition("testBean", new RootBeanDefinition(class1)); Object testBean1 = context.getBean("testBean"); diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java index 0450ac801234..52e78db95616 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -384,7 +384,7 @@ public void testRefreshableFromTagProxyTargetClass() throws Exception { assertEquals("Hello World!", messenger.getMessage()); assertTrue(ctx.getBeansOfType(ConcreteMessenger.class).values().contains(messenger)); - + // Check that AnnotationUtils works with concrete proxied script classes assertNotNull(AnnotationUtils.findAnnotation(messenger.getClass(), Component.class)); } @@ -402,7 +402,7 @@ public void testProxyTargetClassNotAllowedIfNotGroovy() throws Exception { @Test public void testAnonymousScriptDetected() throws Exception { ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass()); - Map beans = ctx.getBeansOfType(Messenger.class); + Map beans = ctx.getBeansOfType(Messenger.class); assertEquals(4, beans.size()); } diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/LogUserAdvice.java b/spring-context/src/test/java/org/springframework/scripting/groovy/LogUserAdvice.java index 53ade2277523..4abb9dd5dc4d 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/LogUserAdvice.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/LogUserAdvice.java @@ -6,24 +6,24 @@ import org.springframework.aop.ThrowsAdvice; public class LogUserAdvice implements MethodBeforeAdvice, ThrowsAdvice { - + private int countBefore = 0; - + private int countThrows = 0; - + public void before(Method method, Object[] objects, Object o) throws Throwable { countBefore++; - System.out.println("Method:"+method.getName()); - } + System.out.println("Method:" + method.getName()); + } public void afterThrowing(Exception e) throws Throwable { countThrows++; - System.out.println("***********************************************************************************"); - System.out.println("Exception caught:"); - System.out.println("***********************************************************************************"); - e.printStackTrace(); - throw e; - } + System.out.println("***********************************************************************************"); + System.out.println("Exception caught:"); + System.out.println("***********************************************************************************"); + e.printStackTrace(); + throw e; + } public int getCountBefore() { return countBefore; @@ -32,7 +32,7 @@ public int getCountBefore() { public int getCountThrows() { return countThrows; } - + public void reset() { countThrows = 0; countBefore = 0; diff --git a/spring-context/src/test/java/org/springframework/scripting/groovy/TestServiceImpl.java b/spring-context/src/test/java/org/springframework/scripting/groovy/TestServiceImpl.java index 749fc42fdef1..f26174faad2b 100644 --- a/spring-context/src/test/java/org/springframework/scripting/groovy/TestServiceImpl.java +++ b/spring-context/src/test/java/org/springframework/scripting/groovy/TestServiceImpl.java @@ -1,8 +1,10 @@ + package org.springframework.scripting.groovy; @Log -public class TestServiceImpl implements TestService{ - public String sayHello() { - throw new TestException("TestServiceImpl"); - } +public class TestServiceImpl implements TestService { + + public String sayHello() { + throw new TestException("TestServiceImpl"); + } } diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java index a3791761801b..446cb54b492a 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/AdvisedJRubyScriptFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java index 63de6c420747..fa6f8237261c 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -250,14 +250,14 @@ public void testWithWrapperArgsInReturnTypeAndParameters() throws Exception { assertEquals("2", lol[1][0]); assertEquals("3", lol[2][0]); - Map singleValueMap = adder.toMap("key", "value"); + Map singleValueMap = adder.toMap("key", "value"); assertNotNull(singleValueMap); assertEquals(1, singleValueMap.size()); assertEquals("key", singleValueMap.keySet().iterator().next()); assertEquals("value", singleValueMap.values().iterator().next()); String[] expectedStrings = new String[]{"1", "2", "3"}; - Map map = adder.toMap("key", expectedStrings); + Map map = adder.toMap("key", expectedStrings); assertNotNull(map); assertEquals(1, map.size()); assertEquals("key", map.keySet().iterator().next()); diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java b/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java index 2656c8a60e2c..1e86c35a7b2d 100644 --- a/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java +++ b/spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,6 @@ public interface WrapperAdder { String[][] createListOfLists(String one, String second, String third); - Map toMap(String key, Object value); + Map toMap(String key, Object value); } diff --git a/spring-context/src/test/java/org/springframework/scripting/support/RefreshableScriptTargetSourceTests.java b/spring-context/src/test/java/org/springframework/scripting/support/RefreshableScriptTargetSourceTests.java index dd39e6557653..e80c523b7dce 100644 --- a/spring-context/src/test/java/org/springframework/scripting/support/RefreshableScriptTargetSourceTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/support/RefreshableScriptTargetSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/scripting/support/ResourceScriptSourceTests.java b/spring-context/src/test/java/org/springframework/scripting/support/ResourceScriptSourceTests.java index 1bcb119b0964..0651ce649c43 100644 --- a/spring-context/src/test/java/org/springframework/scripting/support/ResourceScriptSourceTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/support/ResourceScriptSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.scripting.support; import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import junit.framework.TestCase; diff --git a/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java index 8aebff6f7b75..5c82fe2726da 100644 --- a/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,7 +216,7 @@ public void testPrototypeScriptedBean() throws Exception { ctx.registerBeanDefinition(BEAN_WITH_DEPENDENCY_NAME, scriptedBeanBuilder.getBeanDefinition()); ctx.registerBeanDefinition("scriptProcessor", createScriptFactoryPostProcessor(true)); ctx.refresh(); - + Messenger messenger1 = (Messenger) ctx.getBean(BEAN_WITH_DEPENDENCY_NAME); Messenger messenger2 = (Messenger) ctx.getBean(BEAN_WITH_DEPENDENCY_NAME); assertNotSame(messenger1, messenger2); diff --git a/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java b/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java index 0478ed290960..e23290a85e38 100644 --- a/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java +++ b/spring-context/src/test/java/org/springframework/ui/ModelMapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java index f42512ccb006..9ae4f54ec245 100644 --- a/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java +++ b/spring-context/src/test/java/org/springframework/util/SerializationTestUtils.java @@ -31,13 +31,13 @@ * @author Rod Johnson */ public class SerializationTestUtils { - + public static void testSerialization(Object o) throws IOException { OutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); } - + public static boolean isSerializable(Object o) throws IOException { try { testSerialization(o); @@ -47,7 +47,7 @@ public static boolean isSerializable(Object o) throws IOException { return false; } } - + public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); @@ -55,7 +55,7 @@ public static Object serializeAndDeserialize(Object o) throws IOException, Class oos.flush(); baos.flush(); byte[] bytes = baos.toByteArray(); - + ByteArrayInputStream is = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(is); Object o2 = ois.readObject(); diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java index 96d4b6fb0cb3..181ff12f832a 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ public void testBindingNoErrors() throws Exception { assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed age correctly", rod.getAge() == 32); - Map m = binder.getBindingResult().getModel(); + Map m = binder.getBindingResult().getModel(); assertTrue("There is one element in map", m.size() == 2); FieldAccessBean tb = (FieldAccessBean) m.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -92,7 +92,7 @@ public void testBindingWithErrors() throws Exception { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map map = binder.getBindingResult().getModel(); + Map map = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); FieldAccessBean tb = (FieldAccessBean) map.get("person"); assertTrue("Same object", tb.equals(rod)); diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java index ea9fd94b115d..7a208564cff5 100644 --- a/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java +++ b/spring-context/src/test/java/org/springframework/validation/DataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ public void testBindingNoErrors() throws Exception { assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed age correctly", rod.getAge() == 32); - Map map = binder.getBindingResult().getModel(); + Map map = binder.getBindingResult().getModel(); assertTrue("There is one element in map", map.size() == 2); TestBean tb = (TestBean) map.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -190,7 +190,7 @@ public void testBindingWithErrors() throws Exception { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map map = binder.getBindingResult().getModel(); + Map map = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); TestBean tb = (TestBean) map.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -284,7 +284,7 @@ public String getAsText() { assertTrue("changed name correctly", rod.getName().equals("Rod")); //assertTrue("changed age correctly", rod.getAge() == 32); - Map model = binder.getBindingResult().getModel(); + Map model = binder.getBindingResult().getModel(); //assertTrue("There are 3 element in map", m.size() == 1); TestBean tb = (TestBean) model.get("person"); assertTrue("Same object", tb.equals(rod)); @@ -1444,7 +1444,6 @@ public void testAddAllErrors() { assertEquals("badName", nameError.getCode()); } - @SuppressWarnings("unchecked") public void testBindingWithResortedList() { IndexedTestBean tb = new IndexedTestBean(); DataBinder binder = new DataBinder(tb, "tb"); @@ -1590,14 +1589,14 @@ public void testNestedGrowingList() { mpv.add("f[list][1]", "secondValue"); binder.bind(mpv); assertFalse(binder.getBindingResult().hasErrors()); + @SuppressWarnings("unchecked") List list = (List) form.getF().get("list"); assertEquals("firstValue", list.get(0)); assertEquals("secondValue", list.get(1)); assertEquals(2, list.size()); - } - + } - private static class BeanWithIntegerList { + public static class BeanWithIntegerList { private List integerList; @@ -1611,7 +1610,7 @@ public void setIntegerList(List integerList) { } - private static class Book { + public static class Book { private String Title; @@ -1645,9 +1644,9 @@ public void setNInStock(int nInStock) { } - private static class TestBeanValidator implements Validator { + public static class TestBeanValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } @@ -1672,9 +1671,9 @@ public void validate(Object obj, Errors errors) { } - private static class SpouseValidator implements Validator { + public static class SpouseValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } @@ -1691,7 +1690,7 @@ public void validate(Object obj, Errors errors) { } - private static class GrowingList extends AbstractList { + public static class GrowingList extends AbstractList { private List list; @@ -1766,7 +1765,7 @@ public E set(int index, E element) { } - private static class Form { + public static class Form { private final Map f; diff --git a/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java b/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java index 329e886577aa..373421a3e3ae 100644 --- a/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java +++ b/spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ /** * Unit tests for {@link ValidationUtils}. - * + * * @author Juergen Hoeller * @author Rick Evans * @author Chris Beams @@ -161,7 +161,7 @@ public void testValidationUtilsEmptyOrWhitespaceVariants() { private static class EmptyValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } @@ -173,7 +173,7 @@ public void validate(Object obj, Errors errors) { private static class EmptyOrWhitespaceValidator implements Validator { - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { return TestBean.class.isAssignableFrom(clazz); } diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java index b98fb4200720..d9e5f085dd6a 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/MethodValidationTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/MethodValidationTests.java index ce29597e0c70..f0db21475f5d 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/MethodValidationTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/MethodValidationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java index dbfe0b7d1a8a..7d793caf017f 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java @@ -95,7 +95,7 @@ public void testSimpleValidationWithClassLevel() throws Exception { Set> result = validator.validate(person); assertEquals(1, result.size()); Iterator> iterator = result.iterator(); - ConstraintViolation cv = iterator.next(); + ConstraintViolation cv = iterator.next(); assertEquals("", cv.getPropertyPath().toString()); assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NameAddressValid); } diff --git a/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java b/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java index 12010bee5caa..7ce17926ebbe 100644 --- a/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java +++ b/spring-context/src/test/java/test/advice/CountingAfterReturningAdvice.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,4 +32,4 @@ public void afterReturning(Object o, Method m, Object[] args, Object target) thr count(m); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java b/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java index cade9a183213..3dc49faf24f9 100644 --- a/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java +++ b/spring-context/src/test/java/test/advice/CountingBeforeAdvice.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-context/src/test/java/test/advice/MethodCounter.java b/spring-context/src/test/java/test/advice/MethodCounter.java index c7f660a511a2..8c29886a3dff 100644 --- a/spring-context/src/test/java/test/advice/MethodCounter.java +++ b/spring-context/src/test/java/test/advice/MethodCounter.java @@ -22,7 +22,7 @@ /** * Abstract superclass for counting advices etc. - * + * * @author Rod Johnson * @author Chris Beams */ diff --git a/spring-context/src/test/java/test/advice/MyThrowsHandler.java b/spring-context/src/test/java/test/advice/MyThrowsHandler.java index 1856821a5807..4089101b7980 100644 --- a/spring-context/src/test/java/test/advice/MyThrowsHandler.java +++ b/spring-context/src/test/java/test/advice/MyThrowsHandler.java @@ -1,5 +1,5 @@ /** - * + * */ package test.advice; @@ -19,9 +19,9 @@ public void afterThrowing(Method m, Object[] args, Object target, IOException ex public void afterThrowing(RemoteException ex) throws Throwable { count("remoteException"); } - + /** Not valid, wrong number of arguments */ public void afterThrowing(Method m, Exception ex) throws Throwable { throw new UnsupportedOperationException("Shouldn't be called"); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java b/spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java index c0e70dd28e9b..24b148eda0b6 100644 --- a/spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java +++ b/spring-context/src/test/java/test/advice/TimestampIntroductionAdvisor.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ import test.interceptor.TimestampIntroductionInterceptor; /** - * + * * @author Rod Johnson */ public class TimestampIntroductionAdvisor extends DefaultIntroductionAdvisor { diff --git a/spring-context/src/test/java/test/aspect/PerTargetAspect.java b/spring-context/src/test/java/test/aspect/PerTargetAspect.java index 79977f0cb1dd..49109cfe200f 100644 --- a/spring-context/src/test/java/test/aspect/PerTargetAspect.java +++ b/spring-context/src/test/java/test/aspect/PerTargetAspect.java @@ -1,5 +1,5 @@ /** - * + * */ package test.aspect; @@ -32,4 +32,4 @@ public int getOrder() { public void setOrder(int order) { this.order = order; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/aspect/TwoAdviceAspect.java b/spring-context/src/test/java/test/aspect/TwoAdviceAspect.java index 85eb6b7557d7..647ef9397528 100644 --- a/spring-context/src/test/java/test/aspect/TwoAdviceAspect.java +++ b/spring-context/src/test/java/test/aspect/TwoAdviceAspect.java @@ -34,4 +34,4 @@ public int returnCallCount(ProceedingJoinPoint pjp) throws Exception { public void countSet(int newAge) throws Exception { ++totalCalls; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/beans/CustomScope.java b/spring-context/src/test/java/test/beans/CustomScope.java index b047ae29c0ce..f35cc2aa194e 100644 --- a/spring-context/src/test/java/test/beans/CustomScope.java +++ b/spring-context/src/test/java/test/beans/CustomScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ /** * Simple scope implementation which creates object based on a flag. * - * @author Costin Leau - * @author Chris Beams + * @author Costin Leau + * @author Chris Beams */ public class CustomScope implements Scope { diff --git a/spring-context/src/test/java/test/beans/Employee.java b/spring-context/src/test/java/test/beans/Employee.java index db4d5fb59508..d93ca6ed60a0 100644 --- a/spring-context/src/test/java/test/beans/Employee.java +++ b/spring-context/src/test/java/test/beans/Employee.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ import org.springframework.beans.TestBean; public class Employee extends TestBean { - + private String co; /** @@ -29,11 +29,11 @@ public class Employee extends TestBean { public Employee() { super(); } - + public String getCompany() { return co; } - + public void setCompany(String co) { this.co = co; } diff --git a/spring-context/src/test/java/test/beans/FactoryMethods.java b/spring-context/src/test/java/test/beans/FactoryMethods.java index d3040c39b6a1..ee25e7042b1f 100644 --- a/spring-context/src/test/java/test/beans/FactoryMethods.java +++ b/spring-context/src/test/java/test/beans/FactoryMethods.java @@ -25,7 +25,7 @@ * @author Chris Beams */ public final class FactoryMethods { - + public static FactoryMethods nullInstance() { return null; } diff --git a/spring-context/src/test/java/test/beans/ITestBean.java b/spring-context/src/test/java/test/beans/ITestBean.java index 76b0ce68f83f..81c0e45e3b5a 100644 --- a/spring-context/src/test/java/test/beans/ITestBean.java +++ b/spring-context/src/test/java/test/beans/ITestBean.java @@ -21,7 +21,7 @@ /** * Interface used for test beans. Two methods are the same as on Person, but if this extends * person it breaks quite a few tests - * + * * @author Rod Johnson */ public interface ITestBean { @@ -53,7 +53,7 @@ public interface ITestBean { /** * Increment the age by one. - * + * * @return the previous age */ int haveBirthday(); diff --git a/spring-context/src/test/java/test/beans/NestedTestBean.java b/spring-context/src/test/java/test/beans/NestedTestBean.java index e87c2c46cccf..2a37c6b8c1c9 100644 --- a/spring-context/src/test/java/test/beans/NestedTestBean.java +++ b/spring-context/src/test/java/test/beans/NestedTestBean.java @@ -17,7 +17,7 @@ /** * Simple nested test bean used for testing bean factories, AOP framework etc. - * + * * @author Trevor D. Cook * @since 30.09.2003 */ diff --git a/spring-context/src/test/java/test/beans/SideEffectBean.java b/spring-context/src/test/java/test/beans/SideEffectBean.java index 33619a48b1c0..7e0f53fe11a4 100644 --- a/spring-context/src/test/java/test/beans/SideEffectBean.java +++ b/spring-context/src/test/java/test/beans/SideEffectBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,23 +19,23 @@ /** * Bean that changes state on a business invocation, so that * we can check whether it's been invoked - * + * * @author Rod Johnson */ public class SideEffectBean { - + private int count; - + public void setCount(int count) { this.count = count; } - + public int getCount() { return this.count; } - + public void doWork() { ++count; } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/beans/TestBean.java b/spring-context/src/test/java/test/beans/TestBean.java index 0911566a3f8d..2b51937b1584 100644 --- a/spring-context/src/test/java/test/beans/TestBean.java +++ b/spring-context/src/test/java/test/beans/TestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ /** * Simple test bean used for testing bean factories, AOP framework etc. - * + * * @author Rod Johnson * @since 15 April 2001 */ diff --git a/spring-context/src/test/java/test/interceptor/NopInterceptor.java b/spring-context/src/test/java/test/interceptor/NopInterceptor.java index 223a5f1a75c9..79158e74ea4d 100644 --- a/spring-context/src/test/java/test/interceptor/NopInterceptor.java +++ b/spring-context/src/test/java/test/interceptor/NopInterceptor.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ * @author Rod Johnson */ public class NopInterceptor implements MethodInterceptor { - + private int count; /** @@ -36,11 +36,11 @@ public Object invoke(MethodInvocation invocation) throws Throwable { increment(); return invocation.proceed(); } - + public int getCount() { return this.count; } - + protected void increment() { ++count; } diff --git a/spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java b/spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java index 3af0cbc2962e..71eb963ac028 100644 --- a/spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java +++ b/spring-context/src/test/java/test/interceptor/SerializableNopInterceptor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,24 +22,24 @@ /** * Subclass of NopInterceptor that is serializable and * can be used to test proxy serialization. - * + * * @author Rod Johnson */ public class SerializableNopInterceptor extends NopInterceptor implements Serializable { - + /** * We must override this field and the related methods as * otherwise count won't be serialized from the non-serializable * NopInterceptor superclass. */ private int count; - + public int getCount() { return this.count; } - + protected void increment() { ++count; } - -} \ No newline at end of file + +} diff --git a/spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java b/spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java index 960be703f666..4039d2283912 100644 --- a/spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java +++ b/spring-context/src/test/java/test/interceptor/TimestampIntroductionInterceptor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ public TimestampIntroductionInterceptor() { public TimestampIntroductionInterceptor(long ts) { this.ts = ts; } - + public void setTime(long ts) { this.ts = ts; } diff --git a/spring-context/src/test/java/test/mixin/DefaultLockable.java b/spring-context/src/test/java/test/mixin/DefaultLockable.java index a85fb94678b3..2510395bf6c6 100644 --- a/spring-context/src/test/java/test/mixin/DefaultLockable.java +++ b/spring-context/src/test/java/test/mixin/DefaultLockable.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ /** * Simple implementation of Lockable interface for use in mixins. - * + * * @author Rod Johnson */ public class DefaultLockable implements Lockable { diff --git a/spring-context/src/test/java/test/mixin/LockMixin.java b/spring-context/src/test/java/test/mixin/LockMixin.java index d4d9292ee4aa..02536385a166 100644 --- a/spring-context/src/test/java/test/mixin/LockMixin.java +++ b/spring-context/src/test/java/test/mixin/LockMixin.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,19 +24,19 @@ * Mixin to provide stateful locking functionality. * Test/demonstration of AOP mixin support rather than a * useful interceptor in its own right. - * + * * @author Rod Johnson * @since 10.07.2003 */ public class LockMixin extends DelegatingIntroductionInterceptor implements Lockable { - + /** This field demonstrates additional state in the mixin */ private boolean locked; - + public void lock() { this.locked = true; } - + public void unlock() { this.locked = false; } @@ -61,4 +61,4 @@ public Object invoke(MethodInvocation invocation) throws Throwable { return super.invoke(invocation); } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/mixin/LockMixinAdvisor.java b/spring-context/src/test/java/test/mixin/LockMixinAdvisor.java index ba28e9dd4de0..f82eef32947d 100644 --- a/spring-context/src/test/java/test/mixin/LockMixinAdvisor.java +++ b/spring-context/src/test/java/test/mixin/LockMixinAdvisor.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ * @author Rod Johnson */ public class LockMixinAdvisor extends DefaultIntroductionAdvisor { - + public LockMixinAdvisor() { super(new LockMixin(), Lockable.class); } diff --git a/spring-context/src/test/java/test/mixin/Lockable.java b/spring-context/src/test/java/test/mixin/Lockable.java index 6db63281d7c5..8032345f7d66 100644 --- a/spring-context/src/test/java/test/mixin/Lockable.java +++ b/spring-context/src/test/java/test/mixin/Lockable.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,15 +19,15 @@ /** * Simple interface to use for mixins - * + * * @author Rod Johnson * */ public interface Lockable { - + void lock(); - + void unlock(); - + boolean locked(); -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/mixin/LockedException.java b/spring-context/src/test/java/test/mixin/LockedException.java index f00ac9507b97..0571afb7640c 100644 --- a/spring-context/src/test/java/test/mixin/LockedException.java +++ b/spring-context/src/test/java/test/mixin/LockedException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public class LockedException extends RuntimeException { public LockedException() { } -} \ No newline at end of file +} diff --git a/spring-context/src/test/java/test/util/TimeStamped.java b/spring-context/src/test/java/test/util/TimeStamped.java index 958d8b21f9aa..2de8e381e2a4 100644 --- a/spring-context/src/test/java/test/util/TimeStamped.java +++ b/spring-context/src/test/java/test/util/TimeStamped.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ * @author Rod Johnson */ public interface TimeStamped { - + /** * Return the timestamp for this object. * @return long the timestamp for this object, diff --git a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java index 1a67089bf714..fb595e42e5f8 100644 --- a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java +++ b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,7 +97,7 @@ private static Method searchCandidates(List candidateMethods, Method bri if (candidateMethods.isEmpty()) { return null; } - Map typeParameterMap = GenericTypeResolver.getTypeVariableMap(bridgeMethod.getDeclaringClass()); + Map, Type> typeParameterMap = GenericTypeResolver.getTypeVariableMap(bridgeMethod.getDeclaringClass()); Method previousMethod = null; boolean sameSig = true; for (Method candidateMethod : candidateMethods) { @@ -129,7 +129,7 @@ private static boolean isBridgedCandidateFor(Method candidateMethod, Method brid * Determines whether or not the bridge {@link Method} is the bridge for the * supplied candidate {@link Method}. */ - static boolean isBridgeMethodFor(Method bridgeMethod, Method candidateMethod, Map typeVariableMap) { + static boolean isBridgeMethodFor(Method bridgeMethod, Method candidateMethod, Map, Type> typeVariableMap) { if (isResolvedTypeMatch(candidateMethod, bridgeMethod, typeVariableMap)) { return true; } @@ -144,7 +144,7 @@ static boolean isBridgeMethodFor(Method bridgeMethod, Method candidateMethod, Ma */ private static Method findGenericDeclaration(Method bridgeMethod) { // Search parent types for method that has same signature as bridge. - Class superclass = bridgeMethod.getDeclaringClass().getSuperclass(); + Class superclass = bridgeMethod.getDeclaringClass().getSuperclass(); while (!Object.class.equals(superclass)) { Method method = searchForMatch(superclass, bridgeMethod); if (method != null && !method.isBridge()) { @@ -154,8 +154,8 @@ private static Method findGenericDeclaration(Method bridgeMethod) { } // Search interfaces. - Class[] interfaces = ClassUtils.getAllInterfacesForClass(bridgeMethod.getDeclaringClass()); - for (Class ifc : interfaces) { + Class[] interfaces = ClassUtils.getAllInterfacesForClass(bridgeMethod.getDeclaringClass()); + for (Class ifc : interfaces) { Method method = searchForMatch(ifc, bridgeMethod); if (method != null && !method.isBridge()) { return method; @@ -172,16 +172,16 @@ private static Method findGenericDeclaration(Method bridgeMethod) { * TypeVariable Map, otherwise returns false. */ private static boolean isResolvedTypeMatch( - Method genericMethod, Method candidateMethod, Map typeVariableMap) { + Method genericMethod, Method candidateMethod, Map, Type> typeVariableMap) { Type[] genericParameters = genericMethod.getGenericParameterTypes(); - Class[] candidateParameters = candidateMethod.getParameterTypes(); + Class[] candidateParameters = candidateMethod.getParameterTypes(); if (genericParameters.length != candidateParameters.length) { return false; } for (int i = 0; i < genericParameters.length; i++) { Type genericParameter = genericParameters[i]; - Class candidateParameter = candidateParameters[i]; + Class candidateParameter = candidateParameters[i]; if (candidateParameter.isArray()) { // An array type: compare the component type. Type rawType = GenericTypeResolver.getRawType(genericParameter, typeVariableMap); @@ -194,7 +194,7 @@ private static boolean isResolvedTypeMatch( } } // A non-array type: compare the type itself. - Class resolvedParameter = GenericTypeResolver.resolveType(genericParameter, typeVariableMap); + Class resolvedParameter = GenericTypeResolver.resolveType(genericParameter, typeVariableMap); if (!candidateParameter.equals(resolvedParameter)) { return false; } @@ -207,7 +207,7 @@ private static boolean isResolvedTypeMatch( * that of the supplied {@link Method}, then this matching {@link Method} is returned, * otherwise null is returned. */ - private static Method searchForMatch(Class type, Method bridgeMethod) { + private static Method searchForMatch(Class type, Method bridgeMethod) { return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes()); } diff --git a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java index 9f428dc21693..b4b155b536b4 100644 --- a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java @@ -52,13 +52,13 @@ */ public abstract class CollectionFactory { - private static Class navigableSetClass = null; + private static Class navigableSetClass = null; - private static Class navigableMapClass = null; + private static Class navigableMapClass = null; - private static final Set approximableCollectionTypes = new HashSet(10); + private static final Set> approximableCollectionTypes = new HashSet>(10); - private static final Set approximableMapTypes = new HashSet(6); + private static final Set> approximableMapTypes = new HashSet>(6); static { @@ -139,6 +139,7 @@ public static Map createLinkedMapIfPossible(int initialCapacity) { * @return the new Map instance * @deprecated as of Spring 3.0, for usage on JDK 1.5 or higher */ + @SuppressWarnings("rawtypes") @Deprecated public static Map createLinkedCaseInsensitiveMapIfPossible(int initialCapacity) { return new LinkedCaseInsensitiveMap(initialCapacity); @@ -152,6 +153,7 @@ public static Map createLinkedCaseInsensitiveMapIfPossible(int initialCapacity) * @return the new Map instance * @deprecated as of Spring 2.5, for usage on JDK 1.4 or higher */ + @SuppressWarnings("rawtypes") @Deprecated public static Map createIdentityMapIfPossible(int initialCapacity) { return new IdentityHashMap(initialCapacity); @@ -165,6 +167,7 @@ public static Map createIdentityMapIfPossible(int initialCapacity) { * @return the new Map instance * @deprecated as of Spring 3.0, for usage on JDK 1.5 or higher */ + @SuppressWarnings("rawtypes") @Deprecated public static Map createConcurrentMapIfPossible(int initialCapacity) { return new ConcurrentHashMap(initialCapacity); @@ -206,18 +209,18 @@ public static boolean isApproximableCollectionType(Class collectionType) { * @see java.util.LinkedHashSet */ @SuppressWarnings("unchecked") - public static Collection createApproximateCollection(Object collection, int initialCapacity) { + public static Collection createApproximateCollection(Object collection, int initialCapacity) { if (collection instanceof LinkedList) { - return new LinkedList(); + return new LinkedList(); } else if (collection instanceof List) { - return new ArrayList(initialCapacity); + return new ArrayList(initialCapacity); } else if (collection instanceof SortedSet) { - return new TreeSet(((SortedSet) collection).comparator()); + return new TreeSet(((SortedSet) collection).comparator()); } else { - return new LinkedHashSet(initialCapacity); + return new LinkedHashSet(initialCapacity); } } @@ -232,16 +235,17 @@ else if (collection instanceof SortedSet) { * @see java.util.TreeSet * @see java.util.LinkedHashSet */ - public static Collection createCollection(Class collectionType, int initialCapacity) { + @SuppressWarnings("unchecked") + public static Collection createCollection(Class collectionType, int initialCapacity) { if (collectionType.isInterface()) { if (List.class.equals(collectionType)) { - return new ArrayList(initialCapacity); + return new ArrayList(initialCapacity); } else if (SortedSet.class.equals(collectionType) || collectionType.equals(navigableSetClass)) { - return new TreeSet(); + return new TreeSet(); } else if (Set.class.equals(collectionType) || Collection.class.equals(collectionType)) { - return new LinkedHashSet(initialCapacity); + return new LinkedHashSet(initialCapacity); } else { throw new IllegalArgumentException("Unsupported Collection interface: " + collectionType.getName()); @@ -252,7 +256,7 @@ else if (Set.class.equals(collectionType) || Collection.class.equals(collectionT throw new IllegalArgumentException("Unsupported Collection type: " + collectionType.getName()); } try { - return (Collection) collectionType.newInstance(); + return (Collection) collectionType.newInstance(); } catch (Exception ex) { throw new IllegalArgumentException("Could not instantiate Collection type: " + @@ -282,12 +286,12 @@ public static boolean isApproximableMapType(Class mapType) { * @see java.util.LinkedHashMap */ @SuppressWarnings("unchecked") - public static Map createApproximateMap(Object map, int initialCapacity) { + public static Map createApproximateMap(Object map, int initialCapacity) { if (map instanceof SortedMap) { - return new TreeMap(((SortedMap) map).comparator()); + return new TreeMap(((SortedMap) map).comparator()); } else { - return new LinkedHashMap(initialCapacity); + return new LinkedHashMap(initialCapacity); } } @@ -300,13 +304,14 @@ public static Map createApproximateMap(Object map, int initialCapacity) { * @see java.util.TreeMap * @see java.util.LinkedHashMap */ - public static Map createMap(Class mapType, int initialCapacity) { + @SuppressWarnings("unchecked") + public static Map createMap(Class mapType, int initialCapacity) { if (mapType.isInterface()) { if (Map.class.equals(mapType)) { - return new LinkedHashMap(initialCapacity); + return new LinkedHashMap(initialCapacity); } else if (SortedMap.class.equals(mapType) || mapType.equals(navigableMapClass)) { - return new TreeMap(); + return new TreeMap(); } else if (MultiValueMap.class.equals(mapType)) { return new LinkedMultiValueMap(); @@ -320,7 +325,7 @@ else if (MultiValueMap.class.equals(mapType)) { throw new IllegalArgumentException("Unsupported Map type: " + mapType.getName()); } try { - return (Map) mapType.newInstance(); + return (Map) mapType.newInstance(); } catch (Exception ex) { throw new IllegalArgumentException("Could not instantiate Map type: " + @@ -333,6 +338,7 @@ else if (MultiValueMap.class.equals(mapType)) { /** * ConcurrentMap adapter for the JDK ConcurrentHashMap class. */ + @SuppressWarnings({ "rawtypes", "deprecation" }) @Deprecated private static class JdkConcurrentHashMap extends ConcurrentHashMap implements ConcurrentMap { diff --git a/spring-core/src/main/java/org/springframework/core/ConcurrentMap.java b/spring-core/src/main/java/org/springframework/core/ConcurrentMap.java index 64597193c97e..1328f49dc4aa 100644 --- a/spring-core/src/main/java/org/springframework/core/ConcurrentMap.java +++ b/spring-core/src/main/java/org/springframework/core/ConcurrentMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ * @deprecated as of Spring 3.0, since standard {@link java.util.concurrent.ConcurrentMap} * is available on Java 5+ anyway */ +@SuppressWarnings("rawtypes") @Deprecated public interface ConcurrentMap extends Map { diff --git a/spring-core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java b/spring-core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java index 20c729955b6a..30e2a5f65a26 100644 --- a/spring-core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java +++ b/spring-core/src/main/java/org/springframework/core/ConfigurableObjectInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ public ConfigurableObjectInputStream( @Override - protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { + protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { try { if (this.classLoader != null) { // Use the specified ClassLoader to resolve local classes. @@ -85,13 +85,13 @@ protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, Cl } @Override - protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { + protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { if (!this.acceptProxyClasses) { throw new NotSerializableException("Not allowed to accept serialized proxy classes"); } if (this.classLoader != null) { // Use the specified ClassLoader to resolve local proxy classes. - Class[] resolvedInterfaces = new Class[interfaces.length]; + Class[] resolvedInterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { try { resolvedInterfaces[i] = ClassUtils.forName(interfaces[i], this.classLoader); @@ -113,7 +113,7 @@ protected Class resolveProxyClass(String[] interfaces) throws IOException, Class return super.resolveProxyClass(interfaces); } catch (ClassNotFoundException ex) { - Class[] resolvedInterfaces = new Class[interfaces.length]; + Class[] resolvedInterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { resolvedInterfaces[i] = resolveFallbackIfPossible(interfaces[i], ex); } @@ -131,7 +131,7 @@ protected Class resolveProxyClass(String[] interfaces) throws IOException, Class * @param ex the original exception thrown when attempting to load the class * @return the newly resolved class (never null) */ - protected Class resolveFallbackIfPossible(String className, ClassNotFoundException ex) + protected Class resolveFallbackIfPossible(String className, ClassNotFoundException ex) throws IOException, ClassNotFoundException{ throw ex; diff --git a/spring-core/src/main/java/org/springframework/core/ConstantException.java b/spring-core/src/main/java/org/springframework/core/ConstantException.java index 938667454bb2..454a8abb5af1 100644 --- a/spring-core/src/main/java/org/springframework/core/ConstantException.java +++ b/spring-core/src/main/java/org/springframework/core/ConstantException.java @@ -25,7 +25,7 @@ * @see org.springframework.core.Constants */ public class ConstantException extends IllegalArgumentException { - + /** * Thrown when an invalid constant name is requested. * @param className name of the class containing the constant definitions diff --git a/spring-core/src/main/java/org/springframework/core/Constants.java b/spring-core/src/main/java/org/springframework/core/Constants.java index 9fb1e2cc5f8c..792c1a205695 100644 --- a/spring-core/src/main/java/org/springframework/core/Constants.java +++ b/spring-core/src/main/java/org/springframework/core/Constants.java @@ -207,7 +207,7 @@ public Set getNamesForSuffix(String nameSuffix) { * in accordance with the standard Java convention for constant * values (i.e. all uppercase). The supplied namePrefix * will be uppercased (in a locale-insensitive fashion) prior to - * the main logic of this method kicking in. + * the main logic of this method kicking in. * @param namePrefix prefix of the constant names to search (may be null) * @return the set of values */ diff --git a/spring-core/src/main/java/org/springframework/core/ControlFlow.java b/spring-core/src/main/java/org/springframework/core/ControlFlow.java index 4875f1c191f9..a650c6cb400a 100644 --- a/spring-core/src/main/java/org/springframework/core/ControlFlow.java +++ b/spring-core/src/main/java/org/springframework/core/ControlFlow.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ public interface ControlFlow { * according to the current stack trace. * @param clazz the clazz to look for */ - boolean under(Class clazz); + boolean under(Class clazz); /** * Detect whether we're under the given class and method, @@ -39,7 +39,7 @@ public interface ControlFlow { * @param clazz the clazz to look for * @param methodName the name of the method to look for */ - boolean under(Class clazz, String methodName); + boolean under(Class clazz, String methodName); /** * Detect whether the current stack trace contains the given token. diff --git a/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java b/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java index 6430ff7fb294..805b025e6342 100644 --- a/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java +++ b/spring-core/src/main/java/org/springframework/core/ControlFlowFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ public Jdk14ControlFlow() { /** * Searches for class name match in a StackTraceElement. */ - public boolean under(Class clazz) { + public boolean under(Class clazz) { Assert.notNull(clazz, "Class must not be null"); String className = clazz.getName(); for (int i = 0; i < stack.length; i++) { @@ -76,7 +76,7 @@ public boolean under(Class clazz) { * Searches for class name match plus method name match * in a StackTraceElement. */ - public boolean under(Class clazz, String methodName) { + public boolean under(Class clazz, String methodName) { Assert.notNull(clazz, "Class must not be null"); Assert.notNull(methodName, "Method name must not be null"); String className = clazz.getName(); diff --git a/spring-core/src/main/java/org/springframework/core/Conventions.java b/spring-core/src/main/java/org/springframework/core/Conventions.java index 8a03d43f240a..7f37da161aa3 100644 --- a/spring-core/src/main/java/org/springframework/core/Conventions.java +++ b/spring-core/src/main/java/org/springframework/core/Conventions.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public abstract class Conventions { * Set of interfaces that are supposed to be ignored * when searching for the 'primary' interface of a proxy. */ - private static final Set ignoredInterfaces = new HashSet(); + private static final Set> ignoredInterfaces = new HashSet>(); static { ignoredInterfaces.add(Serializable.class); @@ -75,7 +75,7 @@ public abstract class Conventions { */ public static String getVariableName(Object value) { Assert.notNull(value, "Value must not be null"); - Class valueClass; + Class valueClass; boolean pluralize = false; if (value.getClass().isArray()) { @@ -83,7 +83,7 @@ public static String getVariableName(Object value) { pluralize = true; } else if (value instanceof Collection) { - Collection collection = (Collection) value; + Collection collection = (Collection) value; if (collection.isEmpty()) { throw new IllegalArgumentException("Cannot generate variable name for an empty Collection"); } @@ -107,7 +107,7 @@ else if (value instanceof Collection) { */ public static String getVariableNameForParameter(MethodParameter parameter) { Assert.notNull(parameter, "MethodParameter must not be null"); - Class valueClass; + Class valueClass; boolean pluralize = false; if (parameter.getParameterType().isArray()) { @@ -163,7 +163,7 @@ public static String getVariableNameForReturnType(Method method, Object value) { * @param value the return value (may be null if not available) * @return the generated variable name */ - public static String getVariableNameForReturnType(Method method, Class resolvedType, Object value) { + public static String getVariableNameForReturnType(Method method, Class resolvedType, Object value) { Assert.notNull(method, "Method must not be null"); if (Object.class.equals(resolvedType)) { @@ -173,7 +173,7 @@ public static String getVariableNameForReturnType(Method method, Class resolvedT return getVariableName(value); } - Class valueClass; + Class valueClass; boolean pluralize = false; if (resolvedType.isArray()) { @@ -187,7 +187,7 @@ else if (Collection.class.isAssignableFrom(resolvedType)) { throw new IllegalArgumentException( "Cannot generate variable name for non-typed Collection return type and a non-Collection value"); } - Collection collection = (Collection) value; + Collection collection = (Collection) value; if (collection.isEmpty()) { throw new IllegalArgumentException( "Cannot generate variable name for non-typed Collection return type and an empty Collection value"); @@ -239,7 +239,7 @@ else if (upperCaseNext) { * the attribute name 'foo' qualified by {@link Class} 'com.myapp.SomeClass' * would be 'com.myapp.SomeClass.foo' */ - public static String getQualifiedAttributeName(Class enclosingClass, String attributeName) { + public static String getQualifiedAttributeName(Class enclosingClass, String attributeName) { Assert.notNull(enclosingClass, "'enclosingClass' must not be null"); Assert.notNull(attributeName, "'attributeName' must not be null"); return enclosingClass.getName() + "." + attributeName; @@ -255,11 +255,11 @@ public static String getQualifiedAttributeName(Class enclosingClass, String attr * @param value the value to check * @return the class to use for naming a variable */ - private static Class getClassForValue(Object value) { - Class valueClass = value.getClass(); + private static Class getClassForValue(Object value) { + Class valueClass = value.getClass(); if (Proxy.isProxyClass(valueClass)) { - Class[] ifcs = valueClass.getInterfaces(); - for (Class ifc : ifcs) { + Class[] ifcs = valueClass.getInterfaces(); + for (Class ifc : ifcs) { if (!ignoredInterfaces.contains(ifc)) { return ifc; } @@ -285,8 +285,8 @@ private static String pluralize(String name) { * The exact element for which the Class is retreived will depend * on the concrete Collection implementation. */ - private static Object peekAhead(Collection collection) { - Iterator it = collection.iterator(); + private static Object peekAhead(Collection collection) { + Iterator it = collection.iterator(); if (!it.hasNext()) { throw new IllegalStateException( "Unable to peek ahead in non-empty collection - no element found"); diff --git a/spring-core/src/main/java/org/springframework/core/ErrorCoded.java b/spring-core/src/main/java/org/springframework/core/ErrorCoded.java index 6b75babe9212..722dcdb98ac6 100644 --- a/spring-core/src/main/java/org/springframework/core/ErrorCoded.java +++ b/spring-core/src/main/java/org/springframework/core/ErrorCoded.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,9 +27,9 @@ * @see org.springframework.context.MessageSource */ public interface ErrorCoded { - + /** - * Return the error code associated with this failure. + * Return the error code associated with this failure. * The GUI can render this any way it pleases, allowing for localization etc. * @return a String error code associated with this failure, * or null if not error-coded diff --git a/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java b/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java index 53e3425f369f..16cd6c055096 100644 --- a/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java +++ b/spring-core/src/main/java/org/springframework/core/ExceptionDepthComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ public int compare(Class o1, Class o2) return (depth1 - depth2); } - private int getDepth(Class declaredException, Class exceptionToMatch, int depth) { + private int getDepth(Class declaredException, Class exceptionToMatch, int depth) { if (declaredException.equals(exceptionToMatch)) { // Found it! return depth; diff --git a/spring-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java b/spring-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java index 2e2c4b1d62de..6f378014fa68 100644 --- a/spring-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java +++ b/spring-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public abstract class GenericCollectionTypeResolver { * @param collectionClass the collection class to introspect * @return the generic type, or null if none */ - public static Class getCollectionType(Class collectionClass) { + public static Class getCollectionType(@SuppressWarnings("rawtypes") Class collectionClass) { return extractTypeFromClass(collectionClass, Collection.class, 0); } @@ -55,7 +55,7 @@ public static Class getCollectionType(Class collectionC * @param mapClass the map class to introspect * @return the generic type, or null if none */ - public static Class getMapKeyType(Class mapClass) { + public static Class getMapKeyType(@SuppressWarnings("rawtypes") Class mapClass) { return extractTypeFromClass(mapClass, Map.class, 0); } @@ -65,7 +65,7 @@ public static Class getMapKeyType(Class mapClass) { * @param mapClass the map class to introspect * @return the generic type, or null if none */ - public static Class getMapValueType(Class mapClass) { + public static Class getMapValueType(@SuppressWarnings("rawtypes") Class mapClass) { return extractTypeFromClass(mapClass, Map.class, 1); } @@ -317,12 +317,12 @@ private static Class getGenericReturnType(Method method, Class source, int * @return the generic type as Class, or null if none */ private static Class extractType(Type type, Class source, int typeIndex, - Map typeVariableMap, Map typeIndexesPerLevel, + Map, Type> typeVariableMap, Map typeIndexesPerLevel, int nestingLevel, int currentLevel) { Type resolvedType = type; if (type instanceof TypeVariable && typeVariableMap != null) { - Type mappedType = typeVariableMap.get((TypeVariable) type); + Type mappedType = typeVariableMap.get(type); if (mappedType != null) { resolvedType = mappedType; } @@ -332,7 +332,7 @@ private static Class extractType(Type type, Class source, int typeIndex, nestingLevel, currentLevel); } else if (resolvedType instanceof Class) { - return extractTypeFromClass((Class) resolvedType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, + return extractTypeFromClass((Class) resolvedType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); } else if (resolvedType instanceof GenericArrayType) { @@ -354,13 +354,13 @@ else if (resolvedType instanceof GenericArrayType) { * @return the generic type as Class, or null if none */ private static Class extractTypeFromParameterizedType(ParameterizedType ptype, Class source, int typeIndex, - Map typeVariableMap, Map typeIndexesPerLevel, + Map, Type> typeVariableMap, Map typeIndexesPerLevel, int nestingLevel, int currentLevel) { if (!(ptype.getRawType() instanceof Class)) { return null; } - Class rawType = (Class) ptype.getRawType(); + Class rawType = (Class) ptype.getRawType(); Type[] paramTypes = ptype.getActualTypeArguments(); if (nestingLevel - currentLevel > 0) { int nextLevel = currentLevel + 1; @@ -373,7 +373,7 @@ private static Class extractTypeFromParameterizedType(ParameterizedType ptype if (source != null && !source.isAssignableFrom(rawType)) { return null; } - Class fromSuperclassOrInterface = extractTypeFromClass(rawType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, + Class fromSuperclassOrInterface = extractTypeFromClass(rawType, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); if (fromSuperclassOrInterface != null) { return fromSuperclassOrInterface; @@ -383,7 +383,7 @@ private static Class extractTypeFromParameterizedType(ParameterizedType ptype } Type paramType = paramTypes[typeIndex]; if (paramType instanceof TypeVariable && typeVariableMap != null) { - Type mappedType = typeVariableMap.get((TypeVariable) paramType); + Type mappedType = typeVariableMap.get(paramType); if (mappedType != null) { paramType = mappedType; } @@ -408,12 +408,12 @@ private static Class extractTypeFromParameterizedType(ParameterizedType ptype // A generic array type... Let's turn it into a straight array type if possible. Type compType = ((GenericArrayType) paramType).getGenericComponentType(); if (compType instanceof Class) { - return Array.newInstance((Class) compType, 0).getClass(); + return Array.newInstance((Class) compType, 0).getClass(); } } else if (paramType instanceof Class) { // We finally got a straight Class... - return (Class) paramType; + return (Class) paramType; } return null; } @@ -439,7 +439,7 @@ private static Class extractTypeFromClass(Class clazz, Class source, in * @return the generic type as Class, or null if none */ private static Class extractTypeFromClass(Class clazz, Class source, int typeIndex, - Map typeVariableMap, Map typeIndexesPerLevel, + Map, Type> typeVariableMap, Map typeIndexesPerLevel, int nestingLevel, int currentLevel) { if (clazz.getName().startsWith("java.util.")) { @@ -456,7 +456,7 @@ private static Class extractTypeFromClass(Class clazz, Class source, in if (ifc instanceof ParameterizedType) { rawType = ((ParameterizedType) ifc).getRawType(); } - if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) { + if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) { return extractType(ifc, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel); } } @@ -470,7 +470,7 @@ private static Class extractTypeFromClass(Class clazz, Class source, in * @param clazz the class to check * @return whether the given class is assignable to Collection or Map */ - private static boolean isIntrospectionCandidate(Class clazz) { + private static boolean isIntrospectionCandidate(Class clazz) { return (Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz)); } diff --git a/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java b/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java index 0320381d0ca1..597c691ffd0c 100644 --- a/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java +++ b/spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java @@ -47,7 +47,9 @@ */ public abstract class GenericTypeResolver { - private static final Log logger = LogFactory.getLog(GenericTypeResolver.class); + /** Cache from Class to TypeVariable Map */ + private static final Map, Reference, Type>>> typeVariableCache = + Collections.synchronizedMap(new WeakHashMap, Reference, Type>>>()); /** Cache from Class to TypeVariable Map */ private static final Map> typeVariableCache = @@ -79,12 +81,12 @@ public static Type getTargetType(MethodParameter methodParam) { * @param clazz the class to resolve type variables against * @return the corresponding generic parameter or return type */ - public static Class resolveParameterType(MethodParameter methodParam, Class clazz) { + public static Class resolveParameterType(MethodParameter methodParam, Class clazz) { Type genericType = getTargetType(methodParam); Assert.notNull(clazz, "Class must not be null"); - Map typeVariableMap = getTypeVariableMap(clazz); + Map, Type> typeVariableMap = getTypeVariableMap(clazz); Type rawType = getRawType(genericType, typeVariableMap); - Class result = (rawType instanceof Class ? (Class) rawType : methodParam.getParameterType()); + Class result = (rawType instanceof Class ? (Class) rawType : methodParam.getParameterType()); methodParam.setParameterType(result); methodParam.typeVariableMap = typeVariableMap; return result; @@ -103,133 +105,11 @@ public static Class resolveReturnType(Method method, Class clazz) { Assert.notNull(method, "Method must not be null"); Type genericType = method.getGenericReturnType(); Assert.notNull(clazz, "Class must not be null"); - Map typeVariableMap = getTypeVariableMap(clazz); + Map, Type> typeVariableMap = getTypeVariableMap(clazz); Type rawType = getRawType(genericType, typeVariableMap); return (rawType instanceof Class ? (Class) rawType : method.getReturnType()); } - /** - * Determine the target type for the generic return type of the given - * generic method, where formal type variables are declared on - * the given method itself. - * - *

    For example, given a factory method with the following signature, - * if {@code resolveReturnTypeForGenericMethod()} is invoked with the reflected - * method for {@code creatProxy()} and an {@code Object[]} array containing - * {@code MyService.class}, {@code resolveReturnTypeForGenericMethod()} will - * infer that the target return type is {@code MyService}. - * - *

    {@code public static  T createProxy(Class clazz)}
    - * - *

    Possible Return Values

    - *
      - *
    • the target return type, if it can be inferred
    • - *
    • the {@linkplain Method#getReturnType() standard return type}, if - * the given {@code method} does not declare any {@linkplain - * Method#getTypeParameters() formal type variables}
    • - *
    • the {@linkplain Method#getReturnType() standard return type}, if the - * target return type cannot be inferred (e.g., due to type erasure)
    • - *
    • {@code null}, if the length of the given arguments array is shorter - * than the length of the {@linkplain - * Method#getGenericParameterTypes() formal argument list} for the given - * method
    • - *
    - * - * @param method the method to introspect, never {@code null} - * @param args the arguments that will be supplied to the method when it is - * invoked, never {@code null} - * @return the resolved target return type, the standard return type, or - * {@code null} - * @since 3.2 - * @see #resolveReturnType - */ - public static Class resolveReturnTypeForGenericMethod(Method method, Object[] args) { - Assert.notNull(method, "method must not be null"); - Assert.notNull(args, "args must not be null"); - - if (logger.isDebugEnabled()) { - logger.debug(String.format("Resolving return type for [%s] with concrete method arguments [%s].", - method.toGenericString(), ObjectUtils.nullSafeToString(args))); - } - - final TypeVariable[] declaredTypeVariables = method.getTypeParameters(); - final Type genericReturnType = method.getGenericReturnType(); - final Type[] methodArgumentTypes = method.getGenericParameterTypes(); - - // No declared type variables to inspect, so just return the standard return type. - if (declaredTypeVariables.length == 0) { - return method.getReturnType(); - } - - // The supplied argument list is too short for the method's signature, so - // return null, since such a method invocation would fail. - if (args.length < methodArgumentTypes.length) { - return null; - } - - // Ensure that the type variable (e.g., T) is declared directly on the method - // itself (e.g., via ), not on the enclosing class or interface. - boolean locallyDeclaredTypeVariableMatchesReturnType = false; - for (TypeVariable currentTypeVariable : declaredTypeVariables) { - if (currentTypeVariable.equals(genericReturnType)) { - if (logger.isDebugEnabled()) { - logger.debug(String.format( - "Found declared type variable [%s] that matches the target return type [%s].", - currentTypeVariable, genericReturnType)); - } - locallyDeclaredTypeVariableMatchesReturnType = true; - break; - } - } - - if (locallyDeclaredTypeVariableMatchesReturnType) { - for (int i = 0; i < methodArgumentTypes.length; i++) { - final Type currentMethodArgumentType = methodArgumentTypes[i]; - - if (currentMethodArgumentType.equals(genericReturnType)) { - if (logger.isDebugEnabled()) { - logger.debug(String.format( - "Found method argument type at index [%s] that matches the target return type.", i)); - } - return args[i].getClass(); - } - - if (currentMethodArgumentType instanceof ParameterizedType) { - ParameterizedType parameterizedType = (ParameterizedType) currentMethodArgumentType; - Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); - - for (int j = 0; j < actualTypeArguments.length; j++) { - final Type typeArg = actualTypeArguments[j]; - - if (typeArg.equals(genericReturnType)) { - if (logger.isDebugEnabled()) { - logger.debug(String.format( - "Found method argument type at index [%s] that is parameterized with a type argument that matches the target return type.", - i)); - } - - if (args[i] instanceof Class) { - return (Class) args[i]; - } else { - // Consider adding logic to determine the class of the - // J'th typeArg, if possible. - logger.info(String.format( - "Could not determine the target type for type argument [%s] for method [%s].", - typeArg, method.toGenericString())); - - // For now, just fall back... - return method.getReturnType(); - } - } - } - } - } - } - - // Fall back... - return method.getReturnType(); - } - /** * Resolve the single type argument of the given generic interface against the given * target method which is assumed to return the given interface or an implementation @@ -267,8 +147,8 @@ public static Class resolveReturnTypeArgument(Method method, Class generic * @param genericIfc the generic interface or superclass to resolve the type argument from * @return the resolved type of the argument, or null if not resolvable */ - public static Class resolveTypeArgument(Class clazz, Class genericIfc) { - Class[] typeArgs = resolveTypeArguments(clazz, genericIfc); + public static Class resolveTypeArgument(Class clazz, Class genericIfc) { + Class[] typeArgs = resolveTypeArguments(clazz, genericIfc); if (typeArgs == null) { return null; } @@ -288,23 +168,23 @@ public static Class resolveTypeArgument(Class clazz, Class genericIfc) { * @return the resolved type of each argument, with the array size matching the * number of actual type arguments, or null if not resolvable */ - public static Class[] resolveTypeArguments(Class clazz, Class genericIfc) { + public static Class[] resolveTypeArguments(Class clazz, Class genericIfc) { return doResolveTypeArguments(clazz, clazz, genericIfc); } - private static Class[] doResolveTypeArguments(Class ownerClass, Class classToIntrospect, Class genericIfc) { + private static Class[] doResolveTypeArguments(Class ownerClass, Class classToIntrospect, Class genericIfc) { while (classToIntrospect != null) { if (genericIfc.isInterface()) { Type[] ifcs = classToIntrospect.getGenericInterfaces(); for (Type ifc : ifcs) { - Class[] result = doResolveTypeArguments(ownerClass, ifc, genericIfc); + Class[] result = doResolveTypeArguments(ownerClass, ifc, genericIfc); if (result != null) { return result; } } } else { - Class[] result = doResolveTypeArguments( + Class[] result = doResolveTypeArguments( ownerClass, classToIntrospect.getGenericSuperclass(), genericIfc); if (result != null) { return result; @@ -315,25 +195,25 @@ private static Class[] doResolveTypeArguments(Class ownerClass, Class classToInt return null; } - private static Class[] doResolveTypeArguments(Class ownerClass, Type ifc, Class genericIfc) { + private static Class[] doResolveTypeArguments(Class ownerClass, Type ifc, Class genericIfc) { if (ifc instanceof ParameterizedType) { ParameterizedType paramIfc = (ParameterizedType) ifc; Type rawType = paramIfc.getRawType(); if (genericIfc.equals(rawType)) { Type[] typeArgs = paramIfc.getActualTypeArguments(); - Class[] result = new Class[typeArgs.length]; + Class[] result = new Class[typeArgs.length]; for (int i = 0; i < typeArgs.length; i++) { Type arg = typeArgs[i]; result[i] = extractClass(ownerClass, arg); } return result; } - else if (genericIfc.isAssignableFrom((Class) rawType)) { - return doResolveTypeArguments(ownerClass, (Class) rawType, genericIfc); + else if (genericIfc.isAssignableFrom((Class) rawType)) { + return doResolveTypeArguments(ownerClass, (Class) rawType, genericIfc); } } - else if (ifc != null && genericIfc.isAssignableFrom((Class) ifc)) { - return doResolveTypeArguments(ownerClass, (Class) ifc, genericIfc); + else if (ifc != null && genericIfc.isAssignableFrom((Class) ifc)) { + return doResolveTypeArguments(ownerClass, (Class) ifc, genericIfc); } return null; } @@ -341,7 +221,7 @@ else if (ifc != null && genericIfc.isAssignableFrom((Class) ifc)) { /** * Extract a class instance from given Type. */ - private static Class extractClass(Class ownerClass, Type arg) { + private static Class extractClass(Class ownerClass, Type arg) { if (arg instanceof ParameterizedType) { return extractClass(ownerClass, ((ParameterizedType) arg).getRawType()); } @@ -352,7 +232,7 @@ else if (arg instanceof GenericArrayType) { return Array.newInstance(componentClass, 0).getClass(); } else if (arg instanceof TypeVariable) { - TypeVariable tv = (TypeVariable) arg; + TypeVariable tv = (TypeVariable) arg; arg = getTypeVariableMap(ownerClass).get(tv); if (arg == null) { arg = extractBoundForTypeVariable(tv); @@ -361,7 +241,7 @@ else if (arg instanceof TypeVariable) { arg = extractClass(ownerClass, arg); } } - return (arg instanceof Class ? (Class) arg : Object.class); + return (arg instanceof Class ? (Class) arg : Object.class); } /** @@ -370,14 +250,9 @@ else if (arg instanceof TypeVariable) { * @param typeVariableMap the TypeVariable Map to resolved against * @return the type if it resolves to a Class, or Object.class otherwise */ - public static Class resolveType(Type genericType, Map typeVariableMap) { - Type resolvedType = getRawType(genericType, typeVariableMap); - if (resolvedType instanceof GenericArrayType) { - Type componentType = ((GenericArrayType) resolvedType).getGenericComponentType(); - Class componentClass = resolveType(componentType, typeVariableMap); - resolvedType = Array.newInstance(componentClass, 0).getClass(); - } - return (resolvedType instanceof Class ? (Class) resolvedType : Object.class); + public static Class resolveType(Type genericType, Map, Type> typeVariableMap) { + Type rawType = getRawType(genericType, typeVariableMap); + return (rawType instanceof Class ? (Class) rawType : Object.class); } /** @@ -386,10 +261,10 @@ public static Class resolveType(Type genericType, Map typ * @param typeVariableMap the TypeVariable Map to resolved against * @return the resolved raw type */ - static Type getRawType(Type genericType, Map typeVariableMap) { + static Type getRawType(Type genericType, Map, Type> typeVariableMap) { Type resolvedType = genericType; if (genericType instanceof TypeVariable) { - TypeVariable tv = (TypeVariable) genericType; + TypeVariable tv = (TypeVariable) genericType; resolvedType = typeVariableMap.get(tv); if (resolvedType == null) { resolvedType = extractBoundForTypeVariable(tv); @@ -408,19 +283,19 @@ static Type getRawType(Type genericType, Map typeVariableMap * {@link Class concrete classes} for the specified {@link Class}. Searches * all super types, enclosing types and interfaces. */ - public static Map getTypeVariableMap(Class clazz) { - Map ref = typeVariableCache.get(clazz); - Map typeVariableMap = (ref != null ? ref : null); + public static Map, Type> getTypeVariableMap(Class clazz) { + Reference, Type>> ref = typeVariableCache.get(clazz); + Map, Type> typeVariableMap = (ref != null ? ref.get() : null); if (typeVariableMap == null) { - typeVariableMap = new HashMap(); + typeVariableMap = new HashMap, Type>(); // interfaces extractTypeVariablesFromGenericInterfaces(clazz.getGenericInterfaces(), typeVariableMap); // super class Type genericType = clazz.getGenericSuperclass(); - Class type = clazz.getSuperclass(); + Class type = clazz.getSuperclass(); while (type != null && !Object.class.equals(type)) { if (genericType instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) genericType; @@ -442,7 +317,7 @@ public static Map getTypeVariableMap(Class clazz) { type = type.getEnclosingClass(); } - typeVariableCache.put(clazz, typeVariableMap); + typeVariableCache.put(clazz, new WeakReference, Type>>(typeVariableMap)); } return typeVariableMap; @@ -451,31 +326,31 @@ public static Map getTypeVariableMap(Class clazz) { /** * Extracts the bound Type for a given {@link TypeVariable}. */ - static Type extractBoundForTypeVariable(TypeVariable typeVariable) { + static Type extractBoundForTypeVariable(TypeVariable typeVariable) { Type[] bounds = typeVariable.getBounds(); if (bounds.length == 0) { return Object.class; } Type bound = bounds[0]; if (bound instanceof TypeVariable) { - bound = extractBoundForTypeVariable((TypeVariable) bound); + bound = extractBoundForTypeVariable((TypeVariable) bound); } return bound; } - private static void extractTypeVariablesFromGenericInterfaces(Type[] genericInterfaces, Map typeVariableMap) { + private static void extractTypeVariablesFromGenericInterfaces(Type[] genericInterfaces, Map, Type> typeVariableMap) { for (Type genericInterface : genericInterfaces) { if (genericInterface instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) genericInterface; populateTypeMapFromParameterizedType(pt, typeVariableMap); if (pt.getRawType() instanceof Class) { extractTypeVariablesFromGenericInterfaces( - ((Class) pt.getRawType()).getGenericInterfaces(), typeVariableMap); + ((Class) pt.getRawType()).getGenericInterfaces(), typeVariableMap); } } else if (genericInterface instanceof Class) { extractTypeVariablesFromGenericInterfaces( - ((Class) genericInterface).getGenericInterfaces(), typeVariableMap); + ((Class) genericInterface).getGenericInterfaces(), typeVariableMap); } } } @@ -496,13 +371,13 @@ else if (genericInterface instanceof Class) { * For 'FooImpl' the following mappings would be added to the {@link Map}: * {S=java.lang.String, T=java.lang.Integer}. */ - private static void populateTypeMapFromParameterizedType(ParameterizedType type, Map typeVariableMap) { + private static void populateTypeMapFromParameterizedType(ParameterizedType type, Map, Type> typeVariableMap) { if (type.getRawType() instanceof Class) { Type[] actualTypeArguments = type.getActualTypeArguments(); - TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters(); + TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters(); for (int i = 0; i < actualTypeArguments.length; i++) { Type actualTypeArgument = actualTypeArguments[i]; - TypeVariable variable = typeVariables[i]; + TypeVariable variable = typeVariables[i]; if (actualTypeArgument instanceof Class) { typeVariableMap.put(variable, actualTypeArgument); } @@ -515,7 +390,7 @@ else if (actualTypeArgument instanceof ParameterizedType) { else if (actualTypeArgument instanceof TypeVariable) { // We have a type that is parameterized at instantiation time // the nearest match on the bridge method will be the bounded type. - TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument; + TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument; Type resolvedType = typeVariableMap.get(typeVariableArgument); if (resolvedType == null) { resolvedType = extractBoundForTypeVariable(typeVariableArgument); diff --git a/spring-core/src/main/java/org/springframework/core/MethodParameter.java b/spring-core/src/main/java/org/springframework/core/MethodParameter.java index a9ace6895614..327e60330f17 100644 --- a/spring-core/src/main/java/org/springframework/core/MethodParameter.java +++ b/spring-core/src/main/java/org/springframework/core/MethodParameter.java @@ -44,7 +44,7 @@ public class MethodParameter { private final Method method; - private final Constructor constructor; + private final Constructor constructor; private final int parameterIndex; @@ -63,7 +63,7 @@ public class MethodParameter { /** Map from Integer level to Integer type index */ Map typeIndexesPerLevel; - Map typeVariableMap; + Map, Type> typeVariableMap; private int hash = 0; @@ -100,7 +100,7 @@ public MethodParameter(Method method, int parameterIndex, int nestingLevel) { * @param constructor the Constructor to specify a parameter for * @param parameterIndex the index of the parameter */ - public MethodParameter(Constructor constructor, int parameterIndex) { + public MethodParameter(Constructor constructor, int parameterIndex) { this(constructor, parameterIndex, 1); } @@ -112,7 +112,7 @@ public MethodParameter(Constructor constructor, int parameterIndex) { * (typically 1; e.g. in case of a List of Lists, 1 would indicate the * nested List, whereas 2 would indicate the element of the nested List) */ - public MethodParameter(Constructor constructor, int parameterIndex, int nestingLevel) { + public MethodParameter(Constructor constructor, int parameterIndex, int nestingLevel) { Assert.notNull(constructor, "Constructor must not be null"); this.constructor = constructor; this.parameterIndex = parameterIndex; @@ -156,7 +156,7 @@ public Method getMethod() { *

    Note: Either Method or Constructor is available. * @return the Constructor, or null if none */ - public Constructor getConstructor() { + public Constructor getConstructor() { return this.constructor; } @@ -179,7 +179,7 @@ private AnnotatedElement getAnnotatedElement() { /** * Return the class that declares the underlying Method or Constructor. */ - public Class getDeclaringClass() { + public Class getDeclaringClass() { return getMember().getDeclaringClass(); } @@ -241,12 +241,12 @@ public Class getNestedParameterType() { Integer index = getTypeIndexForCurrentLevel(); Type arg = ((ParameterizedType) type).getActualTypeArguments()[index != null ? index : 0]; if (arg instanceof Class) { - return (Class) arg; + return (Class) arg; } else if (arg instanceof ParameterizedType) { arg = ((ParameterizedType) arg).getRawType(); if (arg instanceof Class) { - return (Class) arg; + return (Class) arg; } } } @@ -416,6 +416,63 @@ private Map getTypeIndexesPerLevel() { return this.typeIndexesPerLevel; } + + /** + * Create a new MethodParameter for the given method or constructor. + *

    This is a convenience constructor for scenarios where a + * Method or Constructor reference is treated in a generic fashion. + * @param methodOrConstructor the Method or Constructor to specify a parameter for + * @param parameterIndex the index of the parameter + * @return the corresponding MethodParameter instance + */ + public static MethodParameter forMethodOrConstructor(Object methodOrConstructor, int parameterIndex) { + if (methodOrConstructor instanceof Method) { + return new MethodParameter((Method) methodOrConstructor, parameterIndex); + } + else if (methodOrConstructor instanceof Constructor) { + return new MethodParameter((Constructor) methodOrConstructor, parameterIndex); + } + else { + throw new IllegalArgumentException( + "Given object [" + methodOrConstructor + "] is neither a Method nor a Constructor"); + } + } + + /** + * Return the parameter annotations for the given method, retrieving cached values + * if a lookup has already been performed for this method, otherwise perform a fresh + * lookup and populate the cache with the result before returning. For + * internal use only. + * @param method the method to introspect for parameter annotations + */ + static Annotation[][] getMethodParameterAnnotations(Method method) { + Assert.notNull(method); + + Annotation[][] result = methodParamAnnotationsCache.get(method); + if (result == null) { + result = method.getParameterAnnotations(); + + if(result.length == 0) { + result = EMPTY_ANNOTATION_MATRIX; + } + else { + for (int i = 0; i < result.length; i++) { + if (result[i].length == 0) { + result[i] = EMPTY_ANNOTATION_ARRAY; + } + } + } + methodParamAnnotationsCache.put(method, result); + } + + //always return deep copy to prevent caller from modifying cache state + Annotation[][] resultCopy = new Annotation[result.length][0]; + for(int i = 0; i < result.length; i++) { + resultCopy[i] = result[i].clone(); + } + return resultCopy; + } + @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/spring-core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java b/spring-core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java index bb7cfb8937a4..3d30f24615b7 100644 --- a/spring-core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java +++ b/spring-core/src/main/java/org/springframework/core/NamedInheritableThreadLocal.java @@ -45,4 +45,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java b/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java index 781edfc6088a..7466b1d6c231 100644 --- a/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java +++ b/spring-core/src/main/java/org/springframework/core/NestedCheckedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ public Throwable getMostSpecificCause() { * @param exType the exception type to look for * @return whether there is a nested exception of the specified type */ - public boolean contains(Class exType) { + public boolean contains(Class exType) { if (exType == null) { return false; } diff --git a/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java b/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java index 8c8eaeb06712..900ffbbde9ac 100644 --- a/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java +++ b/spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,7 +110,7 @@ public Throwable getMostSpecificCause() { * @param exType the exception type to look for * @return whether there is a nested exception of the specified type */ - public boolean contains(Class exType) { + public boolean contains(Class exType) { if (exType == null) { return false; } diff --git a/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java b/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java index 3d2aaa2538e2..752e1b8eb9d4 100644 --- a/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java +++ b/spring-core/src/main/java/org/springframework/core/OverridingClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,8 +55,8 @@ public OverridingClassLoader(ClassLoader parent) { @Override - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - Class result = null; + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class result = null; if (isEligibleForOverriding(name)) { result = loadClassForOverriding(name); } @@ -90,8 +90,8 @@ protected boolean isEligibleForOverriding(String className) { * @return the Class object, or null if no class defined for that name * @throws ClassNotFoundException if the class for the given name couldn't be loaded */ - protected Class loadClassForOverriding(String name) throws ClassNotFoundException { - Class result = findLoadedClass(name); + protected Class loadClassForOverriding(String name) throws ClassNotFoundException { + Class result = findLoadedClass(name); if (result == null) { byte[] bytes = loadBytesForClass(name); if (bytes != null) { diff --git a/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java index 59f03a593915..67152fc974c4 100644 --- a/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java @@ -32,7 +32,7 @@ * @since 2.0 */ public interface ParameterNameDiscoverer { - + /** * Return parameter names for this method, * or null if they cannot be determined. @@ -41,7 +41,7 @@ public interface ParameterNameDiscoverer { * or null if they cannot */ String[] getParameterNames(Method method); - + /** * Return parameter names for this constructor, * or null if they cannot be determined. diff --git a/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java index e2cb227b83c8..811bb7b2ade0 100644 --- a/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/PrioritizedParameterNameDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -35,7 +34,7 @@ * @since 2.0 */ public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer { - + private final List parameterNameDiscoverers = new LinkedList(); @@ -59,7 +58,7 @@ public String[] getParameterNames(Method method) { return null; } - public String[] getParameterNames(Constructor ctor) { + public String[] getParameterNames(Constructor ctor) { for (ParameterNameDiscoverer pnd : this.parameterNameDiscoverers) { String[] result = pnd.getParameterNames(ctor); if (result != null) { diff --git a/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java b/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java index 16f45d3c6aaa..8bf0d5a2df98 100644 --- a/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java +++ b/spring-core/src/main/java/org/springframework/core/SmartClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,6 @@ public interface SmartClassLoader { * @return whether the class should be expected to appear in a reloaded * version (with a different Class object) later on */ - boolean isClassReloadable(Class clazz); + boolean isClassReloadable(Class clazz); } diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java index 50e13dac06c2..8a715b59dea2 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java @@ -106,7 +106,7 @@ public > E getEnum(String attributeName) { @SuppressWarnings("unchecked") public Class getClass(String attributeName) { - return (Class)doGet(attributeName, Class.class); + return doGet(attributeName, Class.class); } public Class[] getClassArray(String attributeName) { @@ -131,28 +131,4 @@ private T doGet(String attributeName, Class expectedType) { attributeName, value.getClass().getSimpleName(), expectedType.getSimpleName())); return (T) value; } - - public String toString() { - Iterator> entries = entrySet().iterator(); - StringBuilder sb = new StringBuilder("{"); - while (entries.hasNext()) { - Map.Entry entry = entries.next(); - sb.append(entry.getKey()); - sb.append('='); - sb.append(valueToString(entry.getValue())); - sb.append(entries.hasNext() ? ", " : ""); - } - sb.append("}"); - return sb.toString(); - } - - private String valueToString(Object value) { - if (value == this) { - return "(this Map)"; - } - if (value instanceof Object[]) { - return "[" + StringUtils.arrayToCommaDelimitedString((Object[]) value) + "]"; - } - return String.valueOf(value); - } } diff --git a/spring-core/src/main/java/org/springframework/core/convert/Property.java b/spring-core/src/main/java/org/springframework/core/convert/Property.java index 478f175684b3..b164eacc7195 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/Property.java +++ b/spring-core/src/main/java/org/springframework/core/convert/Property.java @@ -60,6 +60,8 @@ public final class Property { private final MethodParameter methodParameter; + private final MethodParameter methodParameter; + private Annotation[] annotations; public Property(Class objectType, Method readMethod, Method writeMethod) { @@ -241,34 +243,4 @@ private Class declaringClass() { } } - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - hashCode = prime * hashCode + ObjectUtils.nullSafeHashCode(objectType); - hashCode = prime * hashCode + ObjectUtils.nullSafeHashCode(readMethod); - hashCode = prime * hashCode + ObjectUtils.nullSafeHashCode(writeMethod); - hashCode = prime * hashCode + ObjectUtils.nullSafeHashCode(name); - return hashCode; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Property other = (Property) obj; - boolean equals = true; - equals &= ObjectUtils.nullSafeEquals(objectType, other.objectType); - equals &= ObjectUtils.nullSafeEquals(readMethod, other.readMethod); - equals &= ObjectUtils.nullSafeEquals(writeMethod, other.writeMethod); - equals &= ObjectUtils.nullSafeEquals(name, other.name); - return equals; - } } diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalGenericConverter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalGenericConverter.java index d65d7bb3e9ac..c663386f09da 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalGenericConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/ConditionalGenericConverter.java @@ -32,4 +32,13 @@ public interface ConditionalGenericConverter extends GenericConverter, ConditionalConverter { + /** + * Should the converter from sourceType to targetType + * currently under consideration be selected? + * @param sourceType the type descriptor of the field we are converting from + * @param targetType the type descriptor of the field we are converting to + * @return true if conversion should be performed, false otherwise + */ + boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType); + } diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterFactory.java b/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterFactory.java index 97ae018d4492..6b7b00275f02 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterFactory.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterFactory.java @@ -23,7 +23,6 @@ * * @author Keith Donald * @since 3.0 - * @see ConditionalConverter * @param The source type converters created by this factory can convert from * @param The target range (or base) type converters created by this factory can convert to; * for example {@link Number} for a set of number subtypes. diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java index 2b52d25b174c..b63a0c7cc861 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java @@ -27,8 +27,8 @@ import org.springframework.util.ObjectUtils; /** - * Converts an Array to another Array. First adapts the source array to a List, then - * delegates to {@link CollectionToArrayConverter} to perform the target array conversion. + * Converts an Array to another Array. + * First adapts the source array to a List, then delegates to {@link CollectionToArrayConverter} to perform the target array conversion. * * @author Keith Donald * @author Phillip Webb @@ -53,16 +53,8 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { return this.helperConverter.matches(sourceType, targetType); } - public Object convert(Object source, TypeDescriptor sourceType, - TypeDescriptor targetType) { - if ((conversionService instanceof GenericConversionService) - && ((GenericConversionService) conversionService).canBypassConvert( - sourceType.getElementTypeDescriptor(), - targetType.getElementTypeDescriptor())) { - return source; - } - List sourceList = Arrays.asList(ObjectUtils.toObjectArray(source)); - return this.helperConverter.convert(sourceList, sourceType, targetType); + public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { + return this.helperConverter.convert(Arrays.asList(ObjectUtils.toObjectArray(source)), sourceType, targetType); } } diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java index 4e028b49a9f4..7e12826f949e 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,6 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor(), this.conversionService); } - @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java index 42ad1e8c3980..9c28472d4f55 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,6 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor(), this.conversionService); } - @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java index 86e580983b33..781a1a341048 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java @@ -75,7 +75,7 @@ private static void addScalarConverters(ConverterRegistry converterRegistry) { converterRegistry.addConverterFactory(new CharacterToNumberFactory()); converterRegistry.addConverterFactory(new StringToEnumConverterFactory()); - converterRegistry.addConverter(Enum.class, String.class, new EnumToStringConverter(conversionService)); + converterRegistry.addConverter(Enum.class, String.class, new EnumToStringConverter()); converterRegistry.addConverter(new StringToLocaleConverter()); converterRegistry.addConverter(Locale.class, String.class, new ObjectToStringConverter()); diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java index 3e69ee4421c8..c1fc38d81219 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java @@ -114,10 +114,10 @@ public void removeConvertible(Class sourceType, Class targetType) { // implementing ConversionService public boolean canConvert(Class sourceType, Class targetType) { - Assert.notNull(targetType, "The targetType to convert to cannot be null"); - return canConvert(sourceType != null ? - TypeDescriptor.valueOf(sourceType) : null, - TypeDescriptor.valueOf(targetType)); + if (targetType == null) { + throw new IllegalArgumentException("The targetType to convert to cannot be null"); + } + return canConvert(sourceType != null ? TypeDescriptor.valueOf(sourceType) : null, TypeDescriptor.valueOf(targetType)); } public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType) { @@ -150,7 +150,9 @@ public boolean canBypassConvert(TypeDescriptor sourceType, TypeDescriptor target @SuppressWarnings("unchecked") public T convert(Object source, Class targetType) { - Assert.notNull(targetType,"The targetType to convert to cannot be null"); + if (targetType == null) { + throw new IllegalArgumentException("The targetType to convert to cannot be null"); + } return (T) convert(source, TypeDescriptor.forObject(source), TypeDescriptor.valueOf(targetType)); } @@ -169,7 +171,9 @@ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor t Object result = ConversionUtils.invokeConverter(converter, source, sourceType, targetType); return handleResult(sourceType, targetType, result); } - return handleConverterNotFound(source, sourceType, targetType); + else { + return handleConverterNotFound(source, sourceType, targetType); + } } /** @@ -190,7 +194,21 @@ public Object convert(Object source, TypeDescriptor targetType) { } public String toString() { - return this.converters.toString(); + List converterStrings = new ArrayList(); + for (Map, MatchableConverters> targetConverters : this.converters.values()) { + for (MatchableConverters matchable : targetConverters.values()) { + converterStrings.add(matchable.toString()); + } + } + Collections.sort(converterStrings); + StringBuilder builder = new StringBuilder(); + builder.append("ConversionService converters = ").append("\n"); + for (String converterString : converterStrings) { + builder.append("\t"); + builder.append(converterString); + builder.append("\n"); + } + return builder.toString(); } @@ -226,15 +244,19 @@ protected GenericConverter getConverter(TypeDescriptor sourceType, TypeDescripto if (converter != null) { return (converter != NO_MATCH ? converter : null); } - - converter = this.converters.find(sourceType, targetType); - if (converter == null) { - converter = getDefaultConverter(sourceType, targetType); - } - - if (converter != null) { - this.converterCache.put(key, converter); - return converter; + else { + converter = findConverterForClassPair(sourceType, targetType); + if (converter == null) { + converter = getDefaultConverter(sourceType, targetType); + } + if (converter != null) { + this.converterCache.put(key, converter); + return converter; + } + else { + this.converterCache.put(key, NO_MATCH); + return null; + } } this.converterCache.put(key, NO_MATCH); @@ -261,10 +283,193 @@ private GenericConverter.ConvertiblePair getRequiredTypeInfo(Object converter, C return (args != null ? new GenericConverter.ConvertiblePair(args[0], args[1]) : null); } + private MatchableConverters getMatchableConverters(Class sourceType, Class targetType) { + Map, MatchableConverters> sourceMap = getSourceConverterMap(sourceType); + MatchableConverters matchable = sourceMap.get(targetType); + if (matchable == null) { + matchable = new MatchableConverters(); + sourceMap.put(targetType, matchable); + } + return matchable; + } + private void invalidateCache() { this.converterCache.clear(); } + private Map, MatchableConverters> getSourceConverterMap(Class sourceType) { + Map, MatchableConverters> sourceMap = converters.get(sourceType); + if (sourceMap == null) { + sourceMap = new HashMap, MatchableConverters>(); + this.converters.put(sourceType, sourceMap); + } + return sourceMap; + } + + private GenericConverter findConverterForClassPair(TypeDescriptor sourceType, TypeDescriptor targetType) { + Class sourceObjectType = sourceType.getObjectType(); + if (sourceObjectType.isInterface()) { + LinkedList> classQueue = new LinkedList>(); + classQueue.addFirst(sourceObjectType); + while (!classQueue.isEmpty()) { + Class currentClass = classQueue.removeLast(); + Map, MatchableConverters> converters = getTargetConvertersForSource(currentClass); + GenericConverter converter = getMatchingConverterForTarget(sourceType, targetType, converters); + if (converter != null) { + return converter; + } + Class[] interfaces = currentClass.getInterfaces(); + for (Class ifc : interfaces) { + classQueue.addFirst(ifc); + } + } + Map, MatchableConverters> objectConverters = getTargetConvertersForSource(Object.class); + return getMatchingConverterForTarget(sourceType, targetType, objectConverters); + } + else if (sourceObjectType.isArray()) { + LinkedList> classQueue = new LinkedList>(); + classQueue.addFirst(sourceObjectType); + while (!classQueue.isEmpty()) { + Class currentClass = classQueue.removeLast(); + Map, MatchableConverters> converters = getTargetConvertersForSource(currentClass); + GenericConverter converter = getMatchingConverterForTarget(sourceType, targetType, converters); + if (converter != null) { + return converter; + } + Class componentType = ClassUtils.resolvePrimitiveIfNecessary(currentClass.getComponentType()); + if (componentType.getSuperclass() != null) { + classQueue.addFirst(Array.newInstance(componentType.getSuperclass(), 0).getClass()); + } + else if (componentType.isInterface()) { + classQueue.addFirst(Object[].class); + } + } + return null; + } + else { + HashSet> interfaces = new LinkedHashSet>(); + LinkedList> classQueue = new LinkedList>(); + classQueue.addFirst(sourceObjectType); + while (!classQueue.isEmpty()) { + Class currentClass = classQueue.removeLast(); + Map, MatchableConverters> converters = getTargetConvertersForSource(currentClass); + GenericConverter converter = getMatchingConverterForTarget(sourceType, targetType, converters); + if (converter != null) { + return converter; + } + Class superClass = currentClass.getSuperclass(); + if (superClass != null && superClass != Object.class) { + classQueue.addFirst(superClass); + } + for (Class interfaceType : currentClass.getInterfaces()) { + addInterfaceHierarchy(interfaceType, interfaces); + } + } + for (Class interfaceType : interfaces) { + Map, MatchableConverters> converters = getTargetConvertersForSource(interfaceType); + GenericConverter converter = getMatchingConverterForTarget(sourceType, targetType, converters); + if (converter != null) { + return converter; + } + } + Map, MatchableConverters> objectConverters = getTargetConvertersForSource(Object.class); + return getMatchingConverterForTarget(sourceType, targetType, objectConverters); + } + } + + private Map, MatchableConverters> getTargetConvertersForSource(Class sourceType) { + Map, MatchableConverters> converters = this.converters.get(sourceType); + if (converters == null) { + converters = Collections.emptyMap(); + } + return converters; + } + + private GenericConverter getMatchingConverterForTarget(TypeDescriptor sourceType, TypeDescriptor targetType, + Map, MatchableConverters> converters) { + Class targetObjectType = targetType.getObjectType(); + if (targetObjectType.isInterface()) { + LinkedList> classQueue = new LinkedList>(); + classQueue.addFirst(targetObjectType); + while (!classQueue.isEmpty()) { + Class currentClass = classQueue.removeLast(); + MatchableConverters matchable = converters.get(currentClass); + GenericConverter converter = matchConverter(matchable, sourceType, targetType); + if (converter != null) { + return converter; + } + Class[] interfaces = currentClass.getInterfaces(); + for (Class ifc : interfaces) { + classQueue.addFirst(ifc); + } + } + return matchConverter(converters.get(Object.class), sourceType, targetType); + } + else if (targetObjectType.isArray()) { + LinkedList> classQueue = new LinkedList>(); + classQueue.addFirst(targetObjectType); + while (!classQueue.isEmpty()) { + Class currentClass = classQueue.removeLast(); + MatchableConverters matchable = converters.get(currentClass); + GenericConverter converter = matchConverter(matchable, sourceType, targetType); + if (converter != null) { + return converter; + } + Class componentType = ClassUtils.resolvePrimitiveIfNecessary(currentClass.getComponentType()); + if (componentType.getSuperclass() != null) { + classQueue.addFirst(Array.newInstance(componentType.getSuperclass(), 0).getClass()); + } + else if (componentType.isInterface()) { + classQueue.addFirst(Object[].class); + } + } + return null; + } + else { + Set> interfaces = new LinkedHashSet>(); + LinkedList> classQueue = new LinkedList>(); + classQueue.addFirst(targetObjectType); + while (!classQueue.isEmpty()) { + Class currentClass = classQueue.removeLast(); + MatchableConverters matchable = converters.get(currentClass); + GenericConverter converter = matchConverter(matchable, sourceType, targetType); + if (converter != null) { + return converter; + } + Class superClass = currentClass.getSuperclass(); + if (superClass != null && superClass != Object.class) { + classQueue.addFirst(superClass); + } + for (Class interfaceType : currentClass.getInterfaces()) { + addInterfaceHierarchy(interfaceType, interfaces); + } + } + for (Class interfaceType : interfaces) { + MatchableConverters matchable = converters.get(interfaceType); + GenericConverter converter = matchConverter(matchable, sourceType, targetType); + if (converter != null) { + return converter; + } + } + return matchConverter(converters.get(Object.class), sourceType, targetType); + } + } + + private void addInterfaceHierarchy(Class interfaceType, Set> interfaces) { + interfaces.add(interfaceType); + for (Class inheritedInterface : interfaceType.getInterfaces()) { + addInterfaceHierarchy(inheritedInterface, interfaces); + } + } + + private GenericConverter matchConverter( + MatchableConverters matchable, TypeDescriptor sourceFieldType, TypeDescriptor targetFieldType) { + if (matchable == null) { + return null; + } + return matchable.matchConverter(sourceFieldType, targetFieldType); + } + private Object handleConverterNotFound(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { assertNotPrimitiveTargetType(sourceType, targetType); @@ -273,7 +478,9 @@ private Object handleConverterNotFound(Object source, TypeDescriptor sourceType, if (sourceType.isAssignableTo(targetType) && targetType.getObjectType().isInstance(source)) { return source; } - throw new ConverterNotFoundException(sourceType, targetType); + else { + throw new ConverterNotFoundException(sourceType, targetType); + } } private Object handleResult(TypeDescriptor sourceType, TypeDescriptor targetType, Object result) { @@ -291,6 +498,7 @@ private void assertNotPrimitiveTargetType(TypeDescriptor sourceType, TypeDescrip } + /** * Adapts a {@link Converter} to a {@link GenericConverter}. */ @@ -594,22 +802,28 @@ private List getConverterStrings() { */ private static class ConvertersForPair { - private final LinkedList converters = new LinkedList(); + private final TypeDescriptor sourceType; - public void add(GenericConverter converter) { - this.converters.addFirst(converter); + private final TypeDescriptor targetType; + + public ConverterCacheKey(TypeDescriptor sourceType, TypeDescriptor targetType) { + this.sourceType = sourceType; + this.targetType = targetType; } - public GenericConverter getConverter(TypeDescriptor sourceType, - TypeDescriptor targetType) { - for (GenericConverter converter : this.converters) { - if (!(converter instanceof ConditionalGenericConverter) - || ((ConditionalGenericConverter) converter).matches(sourceType, - targetType)) { - return converter; - } + public boolean equals(Object other) { + if (this == other) { + return true; } - return null; + if (!(other instanceof ConverterCacheKey)) { + return false; + } + ConverterCacheKey otherKey = (ConverterCacheKey) other; + return this.sourceType.equals(otherKey.sourceType) && this.targetType.equals(otherKey.targetType); + } + + public int hashCode() { + return this.sourceType.hashCode() * 29 + this.targetType.hashCode(); } public String toString() { diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java index 7741128b5310..590d292472b5 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,6 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { return ConversionUtils.canConvertElements(sourceType, targetType.getElementTypeDescriptor(), this.conversionService); } - @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/StringToCollectionConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/StringToCollectionConverter.java index 553425f377a7..20498b3f6407 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/StringToCollectionConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/StringToCollectionConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,6 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { } } - @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; diff --git a/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java b/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java index 72df710897f3..4145928d3e05 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java +++ b/spring-core/src/main/java/org/springframework/core/enums/AbstractCachingLabeledEnumResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings("rawtypes") public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumResolver { protected transient final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-core/src/main/java/org/springframework/core/enums/AbstractGenericLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/AbstractGenericLabeledEnum.java index 41611b285a2d..e73babe3ae4f 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/AbstractGenericLabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/AbstractGenericLabeledEnum.java @@ -48,6 +48,6 @@ public String getLabel() { else { return getCode().toString(); } - } + } } diff --git a/spring-core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java index 8f04acd89fb0..2239f2096375 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/AbstractLabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes","unchecked"}) public abstract class AbstractLabeledEnum implements LabeledEnum { /** diff --git a/spring-core/src/main/java/org/springframework/core/enums/LabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/LabeledEnum.java index d2aa701b91b4..5df3e4e9681c 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/LabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/LabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes","unchecked"}) public interface LabeledEnum extends Comparable, Serializable { /** diff --git a/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java b/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java index 9fb83e5d128f..57b80fba4a94 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java +++ b/spring-core/src/main/java/org/springframework/core/enums/LabeledEnumResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings("rawtypes") public interface LabeledEnumResolver { /** diff --git a/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java index b8bd13a49afe..032ca8263707 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/LetterCodedLabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes"}) public class LetterCodedLabeledEnum extends AbstractGenericLabeledEnum { /** @@ -50,7 +51,7 @@ public LetterCodedLabeledEnum(char code, String label) { this.code = new Character(code); } - + public Comparable getCode() { return code; } diff --git a/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java index b3a129d99f26..7da8dfa29ea8 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/ShortCodedLabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes"}) public class ShortCodedLabeledEnum extends AbstractGenericLabeledEnum { /** @@ -46,7 +47,7 @@ public ShortCodedLabeledEnum(int code, String label) { this.code = new Short((short) code); } - + public Comparable getCode() { return code; } diff --git a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java index 0c167cf49b63..e826b3db9da2 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ /** * Base class for static type-safe labeled enum instances. - * + * * Usage example: - * + * *
      * public class FlowSessionStatus extends StaticLabeledEnum {
      *
    @@ -30,20 +30,21 @@
      *     public static FlowSessionStatus PAUSED = new FlowSessionStatus(2, "Paused");
      *     public static FlowSessionStatus SUSPENDED = new FlowSessionStatus(3, "Suspended");
      *     public static FlowSessionStatus ENDED = new FlowSessionStatus(4, "Ended");
    - *     
    + *
      *     // private constructor!
      *     private FlowSessionStatus(int code, String label) {
      *         super(code, label);
      *     }
    - *     
    + *
      *     // custom behavior
      * }
    - * + * * @author Keith Donald * @since 1.2.6 * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes"}) public abstract class StaticLabeledEnum extends AbstractLabeledEnum { /** diff --git a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java b/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java index c71db32bc37a..ae96a0efec05 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java +++ b/spring-core/src/main/java/org/springframework/core/enums/StaticLabeledEnumResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes","unchecked"}) public class StaticLabeledEnumResolver extends AbstractCachingLabeledEnumResolver { /** diff --git a/spring-core/src/main/java/org/springframework/core/enums/StringCodedLabeledEnum.java b/spring-core/src/main/java/org/springframework/core/enums/StringCodedLabeledEnum.java index 9fa24e0cbd4d..3144681cd788 100644 --- a/spring-core/src/main/java/org/springframework/core/enums/StringCodedLabeledEnum.java +++ b/spring-core/src/main/java/org/springframework/core/enums/StringCodedLabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ * @deprecated as of Spring 3.0, in favor of Java 5 enums. */ @Deprecated +@SuppressWarnings({"rawtypes"}) public class StringCodedLabeledEnum extends AbstractGenericLabeledEnum { /** diff --git a/spring-core/src/main/java/org/springframework/core/env/EnvironmentCapable.java b/spring-core/src/main/java/org/springframework/core/env/EnvironmentCapable.java index 6e96cb26d026..3c53c7127572 100644 --- a/spring-core/src/main/java/org/springframework/core/env/EnvironmentCapable.java +++ b/spring-core/src/main/java/org/springframework/core/env/EnvironmentCapable.java @@ -18,7 +18,7 @@ /** - * Interface indicating a component contains and makes available an {@link Environment} object. + * Interface indicating a component contains and makes available an {@link Environment} object. * *

    All Spring application contexts are EnvironmentCapable, and the interface is used primarily * for performing {@code instanceof} checks in framework methods that accept BeanFactory diff --git a/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java b/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java index 54f5bad4c5f0..b8b62706c1bd 100644 --- a/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java +++ b/spring-core/src/main/java/org/springframework/core/env/MapPropertySource.java @@ -41,4 +41,4 @@ public String[] getPropertyNames() { return this.source.keySet().toArray(EMPTY_NAMES_ARRAY); } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/core/env/SimpleCommandLineArgsParser.java b/spring-core/src/main/java/org/springframework/core/env/SimpleCommandLineArgsParser.java index d0e219799873..b7ad3c42d9a7 100644 --- a/spring-core/src/main/java/org/springframework/core/env/SimpleCommandLineArgsParser.java +++ b/spring-core/src/main/java/org/springframework/core/env/SimpleCommandLineArgsParser.java @@ -83,4 +83,4 @@ public CommandLineArgs parse(String... args) { return commandLineArgs; } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/core/io/ClassRelativeResourceLoader.java b/spring-core/src/main/java/org/springframework/core/io/ClassRelativeResourceLoader.java index d014939b22e5..4a310fbaa249 100644 --- a/spring-core/src/main/java/org/springframework/core/io/ClassRelativeResourceLoader.java +++ b/spring-core/src/main/java/org/springframework/core/io/ClassRelativeResourceLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,14 +30,14 @@ */ public class ClassRelativeResourceLoader extends DefaultResourceLoader { - private final Class clazz; + private final Class clazz; /** * Create a new ClassRelativeResourceLoader for the given class. * @param clazz the class to load resources through */ - public ClassRelativeResourceLoader(Class clazz) { + public ClassRelativeResourceLoader(Class clazz) { Assert.notNull(clazz, "Class must not be null"); this.clazz = clazz; setClassLoader(clazz.getClassLoader()); @@ -54,9 +54,9 @@ protected Resource getResourceByPath(String path) { */ private static class ClassRelativeContextResource extends ClassPathResource implements ContextResource { - private final Class clazz; + private final Class clazz; - public ClassRelativeContextResource(String path, Class clazz) { + public ClassRelativeContextResource(String path, Class clazz) { super(path, clazz); this.clazz = clazz; } diff --git a/spring-core/src/main/java/org/springframework/core/io/InputStreamSource.java b/spring-core/src/main/java/org/springframework/core/io/InputStreamSource.java index 7e1f58a0c71b..e4afaed0152e 100644 --- a/spring-core/src/main/java/org/springframework/core/io/InputStreamSource.java +++ b/spring-core/src/main/java/org/springframework/core/io/InputStreamSource.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2012 the original author or authors. - * + * Copyright 2002-2007 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,7 @@ * file-based Resource implementation can be used as a concrete * instance, allowing one to read the underlying content stream multiple times. * This makes this interface useful as an abstract content source for mail - * attachments, for example. + * attachments, for example. * * @author Juergen Hoeller * @since 20.01.2004 diff --git a/spring-core/src/main/java/org/springframework/core/io/ResourceEditor.java b/spring-core/src/main/java/org/springframework/core/io/ResourceEditor.java index 0b812a42b8ba..4cfb010d64ad 100644 --- a/spring-core/src/main/java/org/springframework/core/io/ResourceEditor.java +++ b/spring-core/src/main/java/org/springframework/core/io/ResourceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java b/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java index 71c2ceb09787..b4c09a71f464 100644 --- a/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/VfsUtils.java @@ -257,4 +257,4 @@ protected static Object doGetVisitorAttribute() { protected static String doGetPath(Object resource) { return (String) ReflectionUtils.invokeMethod(VIRTUAL_FILE_METHOD_GET_PATH_NAME, resource); } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index f9a3645a3e25..61a56cdaff2b 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -66,7 +66,7 @@ * Examples are real URLs such as "file:C:/context.xml", pseudo-URLs * such as "classpath:/context.xml", and simple unprefixed paths * such as "/WEB-INF/context.xml". The latter will resolve in a - * fashion specific to the underlying ResourceLoader (e.g. + * fashion specific to the underlying ResourceLoader (e.g. * ServletContextResource for a WebApplicationContext). * *

    Ant-style Patterns: @@ -147,7 +147,7 @@ * com/mycompany/package1/service-context.xml * may be in only one location, but when a path such as

      *     classpath:com/mycompany/**/service-context.xml
    - * 
    is used to try to resolve it, the resolver will work off the (first) URL + * is used to try to resolve it, the resolver will work off the (first) URL * returned by getResource("com/mycompany");. If this base package * node exists in multiple classloader locations, the actual end resource may * not be underneath. Therefore, preferably, use "classpath*:" with the same @@ -695,7 +695,7 @@ else if ("visit".equals(methodName)) { else if ("toString".equals(methodName)) { return toString(); } - + throw new IllegalStateException("Unexpected method invocation: " + method); } diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java index 20b74d017a74..1546f1719ca4 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java @@ -101,9 +101,9 @@ public static Properties loadAllProperties(String resourceName, ClassLoader clas clToUse = ClassUtils.getDefaultClassLoader(); } Properties properties = new Properties(); - Enumeration urls = clToUse.getResources(resourceName); + Enumeration urls = clToUse.getResources(resourceName); while (urls.hasMoreElements()) { - URL url = (URL) urls.nextElement(); + URL url = urls.nextElement(); InputStream is = null; try { URLConnection con = url.openConnection(); diff --git a/spring-core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java b/spring-core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java index d3925dd5b570..c982417a1a9a 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/ResourceArrayPropertyEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java b/spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java index a50fbea4463d..a247769a7ae0 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java @@ -24,12 +24,12 @@ /** * Deserializer that reads an input stream using Java Serialization. - * + * * @author Gary Russell * @author Mark Fisher * @since 3.0.5 */ -public class DefaultDeserializer implements Deserializer { +public class DefaultDeserializer implements Deserializer { /** * Reads the input stream and deserializes into an object. diff --git a/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java b/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java index 792be40ad308..8e03728e8c28 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java @@ -23,7 +23,7 @@ /** * Serializer that writes an object to an output stream using Java Serialization. - * + * * @author Gary Russell * @author Mark Fisher * @since 3.0.5 diff --git a/spring-core/src/main/java/org/springframework/core/serializer/Deserializer.java b/spring-core/src/main/java/org/springframework/core/serializer/Deserializer.java index 02958ac5b330..0219a70e429d 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/Deserializer.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/Deserializer.java @@ -21,7 +21,7 @@ /** * A strategy interface for converting from data in an InputStream to an Object. - * + * * @author Gary Russell * @author Mark Fisher * @since 3.0.5 diff --git a/spring-core/src/main/java/org/springframework/core/serializer/Serializer.java b/spring-core/src/main/java/org/springframework/core/serializer/Serializer.java index 88ec0d4f40e3..b1e0bb95e07d 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/Serializer.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/Serializer.java @@ -21,7 +21,7 @@ /** * A strategy interface for streaming an object to an OutputStream. - * + * * @author Gary Russell * @author Mark Fisher * @since 3.0.5 diff --git a/spring-core/src/main/java/org/springframework/core/serializer/package-info.java b/spring-core/src/main/java/org/springframework/core/serializer/package-info.java index f94296f9ca64..36a79f4151a0 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/package-info.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/package-info.java @@ -1,7 +1,7 @@ /** * - * Root package for Spring's serializer interfaces and implementations. + * Root package for Spring's serializer interfaces and implementations. * Provides an abstraction over various serialization techniques. * Includes exceptions for serialization and deserialization failures. * diff --git a/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java b/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java index 371b2551679d..6e3670270ffc 100644 --- a/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java +++ b/spring-core/src/main/java/org/springframework/core/style/DefaultValueStyler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,20 +56,20 @@ else if (value instanceof String) { return "\'" + value + "\'"; } else if (value instanceof Class) { - return ClassUtils.getShortName((Class) value); + return ClassUtils.getShortName((Class) value); } else if (value instanceof Method) { Method method = (Method) value; return method.getName() + "@" + ClassUtils.getShortName(method.getDeclaringClass()); } else if (value instanceof Map) { - return style((Map) value); + return style((Map) value); } else if (value instanceof Map.Entry) { - return style((Map.Entry) value); + return style((Map.Entry) value); } else if (value instanceof Collection) { - return style((Collection) value); + return style((Collection) value); } else if (value.getClass().isArray()) { return styleArray(ObjectUtils.toObjectArray(value)); @@ -79,11 +79,11 @@ else if (value.getClass().isArray()) { } } - private String style(Map value) { + private String style(Map value) { StringBuilder result = new StringBuilder(value.size() * 8 + 16); result.append(MAP + "["); - for (Iterator it = value.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); + for (Iterator it = value.entrySet().iterator(); it.hasNext();) { + Map.Entry entry = (Map.Entry) it.next(); result.append(style(entry)); if (it.hasNext()) { result.append(',').append(' '); @@ -96,14 +96,14 @@ private String style(Map value) { return result.toString(); } - private String style(Map.Entry value) { + private String style(Map.Entry value) { return style(value.getKey()) + " -> " + style(value.getValue()); } - private String style(Collection value) { + private String style(Collection value) { StringBuilder result = new StringBuilder(value.size() * 8 + 16); result.append(getCollectionTypeString(value)).append('['); - for (Iterator i = value.iterator(); i.hasNext();) { + for (Iterator i = value.iterator(); i.hasNext();) { result.append(style(i.next())); if (i.hasNext()) { result.append(',').append(' '); @@ -116,7 +116,7 @@ private String style(Collection value) { return result.toString(); } - private String getCollectionTypeString(Collection value) { + private String getCollectionTypeString(Collection value) { if (value instanceof List) { return LIST; } diff --git a/spring-core/src/main/java/org/springframework/core/style/StylerUtils.java b/spring-core/src/main/java/org/springframework/core/style/StylerUtils.java index 1457589bf195..a49fa804611e 100644 --- a/spring-core/src/main/java/org/springframework/core/style/StylerUtils.java +++ b/spring-core/src/main/java/org/springframework/core/style/StylerUtils.java @@ -17,7 +17,7 @@ package org.springframework.core.style; /** - * Simple utility class to allow for convenient access to value + * Simple utility class to allow for convenient access to value * styling logic, mainly to support descriptive logging messages. * *

    For more sophisticated needs, use the {@link ValueStyler} abstraction @@ -30,7 +30,7 @@ * @see DefaultValueStyler */ public abstract class StylerUtils { - + /** * Default ValueStyler instance used by the style method. * Also available for the {@link ToStringCreator} class in this package. diff --git a/spring-core/src/main/java/org/springframework/core/style/ToStringCreator.java b/spring-core/src/main/java/org/springframework/core/style/ToStringCreator.java index fcf1d27584b6..51441951d512 100644 --- a/spring-core/src/main/java/org/springframework/core/style/ToStringCreator.java +++ b/spring-core/src/main/java/org/springframework/core/style/ToStringCreator.java @@ -22,7 +22,7 @@ * Utility class that builds pretty-printing toString() methods * with pluggable styling conventions. By default, ToStringCreator adheres * to Spring's toString() styling conventions. - * + * * @author Keith Donald * @author Juergen Hoeller * @since 1.2.2 diff --git a/spring-core/src/main/java/org/springframework/core/task/SyncTaskExecutor.java b/spring-core/src/main/java/org/springframework/core/task/SyncTaskExecutor.java index 4830730c7544..d79cb3e5335e 100644 --- a/spring-core/src/main/java/org/springframework/core/task/SyncTaskExecutor.java +++ b/spring-core/src/main/java/org/springframework/core/task/SyncTaskExecutor.java @@ -41,7 +41,7 @@ public class SyncTaskExecutor implements TaskExecutor, Serializable { /** * Executes the given task synchronously, through direct * invocation of it's {@link Runnable#run() run()} method. - * @throws IllegalArgumentException if the given task is null + * @throws IllegalArgumentException if the given task is null */ public void execute(Runnable task) { Assert.notNull(task, "Runnable must not be null"); diff --git a/spring-core/src/main/java/org/springframework/core/task/TaskExecutor.java b/spring-core/src/main/java/org/springframework/core/task/TaskExecutor.java index a13738578a22..71956bf22428 100644 --- a/spring-core/src/main/java/org/springframework/core/task/TaskExecutor.java +++ b/spring-core/src/main/java/org/springframework/core/task/TaskExecutor.java @@ -21,7 +21,7 @@ /** * Simple task executor interface that abstracts the execution * of a {@link Runnable}. - * + * *

    Implementations can use all sorts of different execution strategies, * such as: synchronous, asynchronous, using a thread pool, and more. * diff --git a/spring-core/src/main/java/org/springframework/core/type/StandardClassMetadata.java b/spring-core/src/main/java/org/springframework/core/type/StandardClassMetadata.java index d40aea8354a4..de3dab8c0afe 100644 --- a/spring-core/src/main/java/org/springframework/core/type/StandardClassMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/StandardClassMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,14 +30,14 @@ */ public class StandardClassMetadata implements ClassMetadata { - private final Class introspectedClass; + private final Class introspectedClass; /** * Create a new StandardClassMetadata wrapper for the given Class. * @param introspectedClass the Class to introspect */ - public StandardClassMetadata(Class introspectedClass) { + public StandardClassMetadata(Class introspectedClass) { Assert.notNull(introspectedClass, "Class must not be null"); this.introspectedClass = introspectedClass; } @@ -45,7 +45,7 @@ public StandardClassMetadata(Class introspectedClass) { /** * Return the underlying Class. */ - public final Class getIntrospectedClass() { + public final Class getIntrospectedClass() { return this.introspectedClass; } @@ -81,7 +81,7 @@ public boolean hasEnclosingClass() { } public String getEnclosingClassName() { - Class enclosingClass = this.introspectedClass.getEnclosingClass(); + Class enclosingClass = this.introspectedClass.getEnclosingClass(); return (enclosingClass != null ? enclosingClass.getName() : null); } @@ -90,12 +90,12 @@ public boolean hasSuperClass() { } public String getSuperClassName() { - Class superClass = this.introspectedClass.getSuperclass(); + Class superClass = this.introspectedClass.getSuperclass(); return (superClass != null ? superClass.getName() : null); } public String[] getInterfaceNames() { - Class[] ifcs = this.introspectedClass.getInterfaces(); + Class[] ifcs = this.introspectedClass.getInterfaces(); String[] ifcNames = new String[ifcs.length]; for (int i = 0; i < ifcs.length; i++) { ifcNames[i] = ifcs[i].getName(); diff --git a/spring-core/src/main/java/org/springframework/core/type/StandardMethodMetadata.java b/spring-core/src/main/java/org/springframework/core/type/StandardMethodMetadata.java index aca42b9d9462..a9e89dff1495 100644 --- a/spring-core/src/main/java/org/springframework/core/type/StandardMethodMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/StandardMethodMetadata.java @@ -67,11 +67,11 @@ public final Method getIntrospectedMethod() { return this.introspectedMethod; } - + public String getMethodName() { return this.introspectedMethod.getName(); } - + public String getDeclaringClassName() { return this.introspectedMethod.getDeclaringClass().getName(); } diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java index cdf49fd6b609..77a8fef3a0ef 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java @@ -258,4 +258,4 @@ private void registerMetaAnnotations(Class annotationClass) { this.metaAnnotationMap.put(annotationClass.getName(), metaAnnotationTypeNames); } } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java index 4cae5b582935..58256b6049d5 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java @@ -97,4 +97,4 @@ public AnnotationAttributes getAnnotationAttributes(String annotationType) { public String getDeclaringClassName() { return this.declaringClassName; } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java b/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java index 182dac134c1b..b81e315f5566 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java @@ -56,7 +56,7 @@ final class SimpleMetadataReader implements MetadataReader { } AnnotationMetadataReadingVisitor visitor = new AnnotationMetadataReadingVisitor(classLoader); - classReader.accept(visitor, ClassReader.SKIP_DEBUG); + classReader.accept(visitor, true); this.annotationMetadata = visitor; // (since AnnotationMetadataReader extends ClassMetadataReadingVisitor) @@ -75,5 +75,4 @@ public ClassMetadata getClassMetadata() { public AnnotationMetadata getAnnotationMetadata() { return this.annotationMetadata; } - } diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/package-info.java b/spring-core/src/main/java/org/springframework/core/type/classreading/package-info.java index 5a8afa0838d1..62b269f48631 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/package-info.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/package-info.java @@ -1,8 +1,8 @@ /** - * + * * Support classes for reading annotation and class-level metadata. - * + * */ package org.springframework.core.type.classreading; diff --git a/spring-core/src/main/java/org/springframework/core/type/filter/AbstractClassTestingTypeFilter.java b/spring-core/src/main/java/org/springframework/core/type/filter/AbstractClassTestingTypeFilter.java index 3d4bbdd744ee..2b9e8b8c0455 100644 --- a/spring-core/src/main/java/org/springframework/core/type/filter/AbstractClassTestingTypeFilter.java +++ b/spring-core/src/main/java/org/springframework/core/type/filter/AbstractClassTestingTypeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java b/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java index bebdb7dd88dd..82362b56700d 100644 --- a/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java +++ b/spring-core/src/main/java/org/springframework/core/type/filter/AbstractTypeHierarchyTraversingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,12 @@ /** * Type filter that is aware of traversing over hierarchy. - * + * *

    This filter is useful when matching needs to be made based on potentially the * whole class/interface hierarchy. The algorithm employed uses a succeed-fast * strategy: if at any time a match is declared, no further processing is * carried out. - * + * * @author Ramnivas Laddad * @author Mark Fisher * @since 2.5 diff --git a/spring-core/src/main/java/org/springframework/core/type/filter/AnnotationTypeFilter.java b/spring-core/src/main/java/org/springframework/core/type/filter/AnnotationTypeFilter.java index e0a1aba156e8..73c494b458ed 100644 --- a/spring-core/src/main/java/org/springframework/core/type/filter/AnnotationTypeFilter.java +++ b/spring-core/src/main/java/org/springframework/core/type/filter/AnnotationTypeFilter.java @@ -78,7 +78,7 @@ public AnnotationTypeFilter(Class annotationType, boolean @Override protected boolean matchSelf(MetadataReader metadataReader) { AnnotationMetadata metadata = metadataReader.getAnnotationMetadata(); - return metadata.hasAnnotation(this.annotationType.getName()) || + return metadata.hasAnnotation(this.annotationType.getName()) || (this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName())); } diff --git a/spring-core/src/main/java/org/springframework/core/type/filter/AspectJTypeFilter.java b/spring-core/src/main/java/org/springframework/core/type/filter/AspectJTypeFilter.java index 262338d91244..d50215cdc299 100644 --- a/spring-core/src/main/java/org/springframework/core/type/filter/AspectJTypeFilter.java +++ b/spring-core/src/main/java/org/springframework/core/type/filter/AspectJTypeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/core/type/filter/AssignableTypeFilter.java b/spring-core/src/main/java/org/springframework/core/type/filter/AssignableTypeFilter.java index 8fb8ecd3f7d4..e55eca50e993 100644 --- a/spring-core/src/main/java/org/springframework/core/type/filter/AssignableTypeFilter.java +++ b/spring-core/src/main/java/org/springframework/core/type/filter/AssignableTypeFilter.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2007 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,14 +26,14 @@ */ public class AssignableTypeFilter extends AbstractTypeHierarchyTraversingFilter { - private final Class targetType; + private final Class targetType; /** * Create a new AssignableTypeFilter for the given type. * @param targetType the type to match */ - public AssignableTypeFilter(Class targetType) { + public AssignableTypeFilter(Class targetType) { super(true, true); this.targetType = targetType; } @@ -63,7 +63,7 @@ else if (Object.class.getName().equals(typeName)) { } else if (typeName.startsWith("java.")) { try { - Class clazz = getClass().getClassLoader().loadClass(typeName); + Class clazz = getClass().getClassLoader().loadClass(typeName); return Boolean.valueOf(this.targetType.isAssignableFrom(clazz)); } catch (ClassNotFoundException ex) { diff --git a/spring-core/src/main/java/org/springframework/util/Assert.java b/spring-core/src/main/java/org/springframework/util/Assert.java index d1ecbe54c1f3..8bb0a90e7840 100644 --- a/spring-core/src/main/java/org/springframework/util/Assert.java +++ b/spring-core/src/main/java/org/springframework/util/Assert.java @@ -263,7 +263,7 @@ public static void noNullElements(Object[] array) { * @param message the exception message to use if the assertion fails * @throws IllegalArgumentException if the collection is null or has no elements */ - public static void notEmpty(Collection collection, String message) { + public static void notEmpty(Collection collection, String message) { if (CollectionUtils.isEmpty(collection)) { throw new IllegalArgumentException(message); } @@ -276,7 +276,7 @@ public static void notEmpty(Collection collection, String message) { * @param collection the collection to check * @throws IllegalArgumentException if the collection is null or has no elements */ - public static void notEmpty(Collection collection) { + public static void notEmpty(Collection collection) { notEmpty(collection, "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); } @@ -289,7 +289,7 @@ public static void notEmpty(Collection collection) { * @param message the exception message to use if the assertion fails * @throws IllegalArgumentException if the map is null or has no entries */ - public static void notEmpty(Map map, String message) { + public static void notEmpty(Map map, String message) { if (CollectionUtils.isEmpty(map)) { throw new IllegalArgumentException(message); } @@ -302,7 +302,7 @@ public static void notEmpty(Map map, String message) { * @param map the map to check * @throws IllegalArgumentException if the map is null or has no entries */ - public static void notEmpty(Map map) { + public static void notEmpty(Map map) { notEmpty(map, "[Assertion failed] - this map must not be empty; it must contain at least one entry"); } @@ -315,7 +315,7 @@ public static void notEmpty(Map map) { * @throws IllegalArgumentException if the object is not an instance of clazz * @see Class#isInstance */ - public static void isInstanceOf(Class clazz, Object obj) { + public static void isInstanceOf(Class clazz, Object obj) { isInstanceOf(clazz, obj, ""); } @@ -331,7 +331,7 @@ public static void isInstanceOf(Class clazz, Object obj) { * @throws IllegalArgumentException if the object is not an instance of clazz * @see Class#isInstance */ - public static void isInstanceOf(Class type, Object obj, String message) { + public static void isInstanceOf(Class type, Object obj, String message) { notNull(type, "Type to check against must not be null"); if (!type.isInstance(obj)) { throw new IllegalArgumentException(message + @@ -347,7 +347,7 @@ public static void isInstanceOf(Class type, Object obj, String message) { * @param subType the sub type to check * @throws IllegalArgumentException if the classes are not assignable */ - public static void isAssignable(Class superType, Class subType) { + public static void isAssignable(Class superType, Class subType) { isAssignable(superType, subType, ""); } @@ -362,7 +362,7 @@ public static void isAssignable(Class superType, Class subType) { * ok when prepended to it. * @throws IllegalArgumentException if the classes are not assignable */ - public static void isAssignable(Class superType, Class subType, String message) { + public static void isAssignable(Class superType, Class subType, String message) { notNull(superType, "Type to check against must not be null"); if (subType == null || !superType.isAssignableFrom(subType)) { throw new IllegalArgumentException(message + subType + " is not assignable to " + superType); diff --git a/spring-core/src/main/java/org/springframework/util/AutoPopulatingList.java b/spring-core/src/main/java/org/springframework/util/AutoPopulatingList.java index e100e44273fb..32a0d0f528d0 100644 --- a/spring-core/src/main/java/org/springframework/util/AutoPopulatingList.java +++ b/spring-core/src/main/java/org/springframework/util/AutoPopulatingList.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,7 +115,7 @@ public boolean contains(Object o) { return this.backingList.contains(o); } - public boolean containsAll(Collection c) { + public boolean containsAll(Collection c) { return this.backingList.containsAll(c); } diff --git a/spring-core/src/main/java/org/springframework/util/CachingMapDecorator.java b/spring-core/src/main/java/org/springframework/util/CachingMapDecorator.java index 832b4a1f55bb..0126a5a0d3dc 100644 --- a/spring-core/src/main/java/org/springframework/util/CachingMapDecorator.java +++ b/spring-core/src/main/java/org/springframework/util/CachingMapDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ *

    This class is an abstract template. Caching Map implementations * should subclass and override the create(key) method which * encapsulates expensive creation of a new object. - * + * * @author Keith Donald * @author Juergen Hoeller * @since 1.2.2 @@ -145,7 +145,7 @@ private boolean containsValueOrReference(Object value) { return true; } for (Object mapVal : this.targetMap.values()) { - if (mapVal instanceof Reference && value.equals(((Reference) mapVal).get())) { + if (mapVal instanceof Reference && value.equals(((Reference) mapVal).get())) { return true; } } @@ -160,7 +160,7 @@ public V remove(Object key) { private V unwrapReturnValue(Object value) { Object returnValue = value; if (returnValue instanceof Reference) { - returnValue = ((Reference) returnValue).get(); + returnValue = ((Reference) returnValue).get(); } return (returnValue == NULL_VALUE ? null : (V) returnValue); } @@ -201,7 +201,7 @@ private Collection valuesCopy() { for (Iterator it = this.targetMap.values().iterator(); it.hasNext();) { Object value = it.next(); if (value instanceof Reference) { - value = ((Reference) value).get(); + value = ((Reference) value).get(); if (value == null) { it.remove(); continue; @@ -230,7 +230,7 @@ private Set> entryCopy() { Entry entry = it.next(); Object value = entry.getValue(); if (value instanceof Reference) { - value = ((Reference) value).get(); + value = ((Reference) value).get(); if (value == null) { it.remove(); continue; @@ -283,7 +283,7 @@ protected boolean useWeakValue(K key, V value) { public V get(Object key) { Object value = this.targetMap.get(key); if (value instanceof Reference) { - value = ((Reference) value).get(); + value = ((Reference) value).get(); } if (value == null) { V newValue = create((K) key); diff --git a/spring-core/src/main/java/org/springframework/util/ClassUtils.java b/spring-core/src/main/java/org/springframework/util/ClassUtils.java index 6def00623245..8a7331db9016 100644 --- a/spring-core/src/main/java/org/springframework/util/ClassUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ClassUtils.java @@ -763,7 +763,7 @@ public static Method getMostSpecificMethod(Method method, Class targetClass) * @param method the method to check * @param targetClass the target class to check against */ - private static boolean isOverridable(Method method, Class targetClass) { + private static boolean isOverridable(Method method, Class targetClass) { if (Modifier.isPrivate(method.getModifiers())) { return false; } @@ -866,13 +866,13 @@ public static boolean isAssignable(Class lhsType, Class rhsType) { return true; } if (lhsType.isPrimitive()) { - Class resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); + Class resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); if (resolvedPrimitive != null && lhsType.equals(resolvedPrimitive)) { return true; } } else { - Class resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType); + Class resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType); if (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper)) { return true; } @@ -974,7 +974,7 @@ public static String classPackageAsResourcePath(Class clazz) { * @return a String of form "[com.foo.Bar, com.foo.Baz]" * @see java.util.AbstractCollection#toString() */ - public static String classNamesToString(Class... classes) { + public static String classNamesToString(Class... classes) { return classNamesToString(Arrays.asList(classes)); } @@ -987,13 +987,13 @@ public static String classNamesToString(Class... classes) { * @return a String of form "[com.foo.Bar, com.foo.Baz]" * @see java.util.AbstractCollection#toString() */ - public static String classNamesToString(Collection classes) { + public static String classNamesToString(Collection> classes) { if (CollectionUtils.isEmpty(classes)) { return "[]"; } StringBuilder sb = new StringBuilder("["); - for (Iterator it = classes.iterator(); it.hasNext(); ) { - Class clazz = it.next(); + for (Iterator> it = classes.iterator(); it.hasNext(); ) { + Class clazz = it.next(); sb.append(clazz.getName()); if (it.hasNext()) { sb.append(", "); @@ -1023,7 +1023,7 @@ public static Class[] toClassArray(Collection> collection) { * @param instance the instance to analyze for interfaces * @return all interfaces that the given instance implements as array */ - public static Class[] getAllInterfaces(Object instance) { + public static Class[] getAllInterfaces(Object instance) { Assert.notNull(instance, "Instance must not be null"); return getAllInterfacesForClass(instance.getClass()); } @@ -1049,7 +1049,7 @@ public static Class[] getAllInterfacesForClass(Class clazz) { * @return all interfaces that the given object implements as array */ public static Class[] getAllInterfacesForClass(Class clazz, ClassLoader classLoader) { - Set ifcs = getAllInterfacesForClassAsSet(clazz, classLoader); + Set> ifcs = getAllInterfacesForClassAsSet(clazz, classLoader); return ifcs.toArray(new Class[ifcs.size()]); } @@ -1059,7 +1059,7 @@ public static Class[] getAllInterfacesForClass(Class clazz, ClassLoader cl * @param instance the instance to analyze for interfaces * @return all interfaces that the given instance implements as Set */ - public static Set getAllInterfacesAsSet(Object instance) { + public static Set> getAllInterfacesAsSet(Object instance) { Assert.notNull(instance, "Instance must not be null"); return getAllInterfacesForClassAsSet(instance.getClass()); } @@ -1071,7 +1071,7 @@ public static Set getAllInterfacesAsSet(Object instance) { * @param clazz the class to analyze for interfaces * @return all interfaces that the given object implements as Set */ - public static Set getAllInterfacesForClassAsSet(Class clazz) { + public static Set> getAllInterfacesForClassAsSet(Class clazz) { return getAllInterfacesForClassAsSet(clazz, null); } @@ -1084,12 +1084,12 @@ public static Set getAllInterfacesForClassAsSet(Class clazz) { * (may be null when accepting all declared interfaces) * @return all interfaces that the given object implements as Set */ - public static Set getAllInterfacesForClassAsSet(Class clazz, ClassLoader classLoader) { + public static Set> getAllInterfacesForClassAsSet(Class clazz, ClassLoader classLoader) { Assert.notNull(clazz, "Class must not be null"); if (clazz.isInterface() && isVisible(clazz, classLoader)) { - return Collections.singleton(clazz); + return Collections.>singleton(clazz); } - Set interfaces = new LinkedHashSet(); + Set> interfaces = new LinkedHashSet>(); while (clazz != null) { Class[] ifcs = clazz.getInterfaces(); for (Class ifc : ifcs) { diff --git a/spring-core/src/main/java/org/springframework/util/CollectionUtils.java b/spring-core/src/main/java/org/springframework/util/CollectionUtils.java index 5d57fbba6b00..a4f5e713c046 100644 --- a/spring-core/src/main/java/org/springframework/util/CollectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/CollectionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public abstract class CollectionUtils { * @param collection the Collection to check * @return whether the given Collection is empty */ - public static boolean isEmpty(Collection collection) { + public static boolean isEmpty(Collection collection) { return (collection == null || collection.isEmpty()); } @@ -57,7 +57,7 @@ public static boolean isEmpty(Collection collection) { * @param map the Map to check * @return whether the given Map is empty */ - public static boolean isEmpty(Map map) { + public static boolean isEmpty(Map map) { return (map == null || map.isEmpty()); } @@ -70,7 +70,7 @@ public static boolean isEmpty(Map map) { * @return the converted List result * @see ObjectUtils#toObjectArray(Object) */ - public static List arrayToList(Object source) { + public static List arrayToList(Object source) { return Arrays.asList(ObjectUtils.toObjectArray(source)); } @@ -80,13 +80,13 @@ public static List arrayToList(Object source) { * @param collection the target Collection to merge the array into */ @SuppressWarnings("unchecked") - public static void mergeArrayIntoCollection(Object array, Collection collection) { + public static void mergeArrayIntoCollection(Object array, Collection collection) { if (collection == null) { throw new IllegalArgumentException("Collection must not be null"); } Object[] arr = ObjectUtils.toObjectArray(array); for (Object elem : arr) { - collection.add(elem); + collection.add((E) elem); } } @@ -99,19 +99,19 @@ public static void mergeArrayIntoCollection(Object array, Collection collection) * @param map the target Map to merge the properties into */ @SuppressWarnings("unchecked") - public static void mergePropertiesIntoMap(Properties props, Map map) { + public static void mergePropertiesIntoMap(Properties props, Map map) { if (map == null) { throw new IllegalArgumentException("Map must not be null"); } if (props != null) { - for (Enumeration en = props.propertyNames(); en.hasMoreElements();) { + for (Enumeration en = props.propertyNames(); en.hasMoreElements();) { String key = (String) en.nextElement(); Object value = props.getProperty(key); if (value == null) { // Potentially a non-String value... value = props.get(key); } - map.put(key, value); + map.put((K) key, (V) value); } } } @@ -123,7 +123,7 @@ public static void mergePropertiesIntoMap(Properties props, Map map) { * @param element the element to look for * @return true if found, false else */ - public static boolean contains(Iterator iterator, Object element) { + public static boolean contains(Iterator iterator, Object element) { if (iterator != null) { while (iterator.hasNext()) { Object candidate = iterator.next(); @@ -141,7 +141,7 @@ public static boolean contains(Iterator iterator, Object element) { * @param element the element to look for * @return true if found, false else */ - public static boolean contains(Enumeration enumeration, Object element) { + public static boolean contains(Enumeration enumeration, Object element) { if (enumeration != null) { while (enumeration.hasMoreElements()) { Object candidate = enumeration.nextElement(); @@ -161,7 +161,7 @@ public static boolean contains(Enumeration enumeration, Object element) { * @param element the element to look for * @return true if found, false else */ - public static boolean containsInstance(Collection collection, Object element) { + public static boolean containsInstance(Collection collection, Object element) { if (collection != null) { for (Object candidate : collection) { if (candidate == element) { @@ -179,7 +179,7 @@ public static boolean containsInstance(Collection collection, Object element) { * @param candidates the candidates to search for * @return whether any of the candidates has been found */ - public static boolean containsAny(Collection source, Collection candidates) { + public static boolean containsAny(Collection source, Collection candidates) { if (isEmpty(source) || isEmpty(candidates)) { return false; } @@ -200,7 +200,7 @@ public static boolean containsAny(Collection source, Collection candidates) { * @param candidates the candidates to search for * @return the first present object, or null if not found */ - public static Object findFirstMatch(Collection source, Collection candidates) { + public static Object findFirstMatch(Collection source, Collection candidates) { if (isEmpty(source) || isEmpty(candidates)) { return null; } @@ -265,7 +265,7 @@ public static Object findValueOfType(Collection collection, Class[] types) * @return true if the collection contains a single reference or * multiple references to the same instance, false else */ - public static boolean hasUniqueObject(Collection collection) { + public static boolean hasUniqueObject(Collection collection) { if (isEmpty(collection)) { return false; } @@ -289,7 +289,7 @@ else if (candidate != elem) { * @return the common element type, or null if no clear * common type has been found (or the collection was empty) */ - public static Class findCommonElementType(Collection collection) { + public static Class findCommonElementType(Collection collection) { if (isEmpty(collection)) { return null; } diff --git a/spring-core/src/main/java/org/springframework/util/CompositeIterator.java b/spring-core/src/main/java/org/springframework/util/CompositeIterator.java index 1e70018f5c20..97142514c742 100644 --- a/spring-core/src/main/java/org/springframework/util/CompositeIterator.java +++ b/spring-core/src/main/java/org/springframework/util/CompositeIterator.java @@ -72,4 +72,4 @@ public E next() { public void remove() { throw new UnsupportedOperationException("Remove is not supported"); } -} \ No newline at end of file +} diff --git a/spring-core/src/main/java/org/springframework/util/ConcurrencyThrottleSupport.java b/spring-core/src/main/java/org/springframework/util/ConcurrencyThrottleSupport.java index 172359c351e1..a845c061c8de 100644 --- a/spring-core/src/main/java/org/springframework/util/ConcurrencyThrottleSupport.java +++ b/spring-core/src/main/java/org/springframework/util/ConcurrencyThrottleSupport.java @@ -54,7 +54,7 @@ public abstract class ConcurrencyThrottleSupport implements Serializable { * Switch concurrency 'off': that is, don't allow any concurrent invocations. */ public static final int NO_CONCURRENCY = 0; - + /** Transient to optimize serialization */ protected transient Log logger = LogFactory.getLog(getClass()); @@ -99,7 +99,7 @@ public boolean isThrottleActive() { /** * To be invoked before the main execution logic of concrete subclasses. *

    This implementation applies the concurrency throttle. - * @see #afterAccess() + * @see #afterAccess() */ protected void beforeAccess() { if (this.concurrencyLimit == NO_CONCURRENCY) { diff --git a/spring-core/src/main/java/org/springframework/util/DefaultPropertiesPersister.java b/spring-core/src/main/java/org/springframework/util/DefaultPropertiesPersister.java index 5739948d3482..ef74a315973a 100644 --- a/spring-core/src/main/java/org/springframework/util/DefaultPropertiesPersister.java +++ b/spring-core/src/main/java/org/springframework/util/DefaultPropertiesPersister.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -180,7 +180,7 @@ protected void doStore(Properties props, Writer writer, String header) throws IO } out.write("#" + new Date()); out.newLine(); - for (Enumeration keys = props.keys(); keys.hasMoreElements();) { + for (Enumeration keys = props.keys(); keys.hasMoreElements();) { String key = (String) keys.nextElement(); String val = props.getProperty(key); out.write(escape(key, true) + "=" + escape(val, false)); diff --git a/spring-core/src/main/java/org/springframework/util/DigestUtils.java b/spring-core/src/main/java/org/springframework/util/DigestUtils.java index 200c73b7e6d3..0328c0fdd6f5 100644 --- a/spring-core/src/main/java/org/springframework/util/DigestUtils.java +++ b/spring-core/src/main/java/org/springframework/util/DigestUtils.java @@ -67,7 +67,7 @@ public static StringBuilder appendMd5DigestAsHex(byte[] bytes, StringBuilder bui } /** - * Creates a new {@link MessageDigest} with the given algorithm. Necessary + * Creates a new {@link MessageDigest} with the given algorithm. Necessary * because {@code MessageDigest} is not thread-safe. */ private static MessageDigest getDigest(String algorithm) { diff --git a/spring-core/src/main/java/org/springframework/util/MethodInvoker.java b/spring-core/src/main/java/org/springframework/util/MethodInvoker.java index 5d8d3a09a97b..4d0fcf65c0a5 100644 --- a/spring-core/src/main/java/org/springframework/util/MethodInvoker.java +++ b/spring-core/src/main/java/org/springframework/util/MethodInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ */ public class MethodInvoker { - private Class targetClass; + private Class targetClass; private Object targetObject; @@ -61,14 +61,14 @@ public class MethodInvoker { * @see #setTargetObject * @see #setTargetMethod */ - public void setTargetClass(Class targetClass) { + public void setTargetClass(Class targetClass) { this.targetClass = targetClass; } /** * Return the target class on which to call the target method. */ - public Class getTargetClass() { + public Class getTargetClass() { return this.targetClass; } @@ -158,7 +158,7 @@ public void prepare() throws ClassNotFoundException, NoSuchMethodException { this.targetMethod = methodName; } - Class targetClass = getTargetClass(); + Class targetClass = getTargetClass(); String targetMethod = getTargetMethod(); if (targetClass == null) { throw new IllegalArgumentException("Either 'targetClass' or 'targetObject' is required"); @@ -168,7 +168,7 @@ public void prepare() throws ClassNotFoundException, NoSuchMethodException { } Object[] arguments = getArguments(); - Class[] argTypes = new Class[arguments.length]; + Class[] argTypes = new Class[arguments.length]; for (int i = 0; i < arguments.length; ++i) { argTypes[i] = (arguments[i] != null ? arguments[i].getClass() : Object.class); } @@ -194,7 +194,7 @@ public void prepare() throws ClassNotFoundException, NoSuchMethodException { * @return the resolved Class * @throws ClassNotFoundException if the class name was invalid */ - protected Class resolveClassName(String className) throws ClassNotFoundException { + protected Class resolveClassName(String className) throws ClassNotFoundException { return ClassUtils.forName(className, ClassUtils.getDefaultClassLoader()); } @@ -216,7 +216,7 @@ protected Method findMatchingMethod() { for (Method candidate : candidates) { if (candidate.getName().equals(targetMethod)) { - Class[] paramTypes = candidate.getParameterTypes(); + Class[] paramTypes = candidate.getParameterTypes(); if (paramTypes.length == argCount) { int typeDiffWeight = getTypeDifferenceWeight(paramTypes, arguments); if (typeDiffWeight < minTypeDiffWeight) { @@ -291,15 +291,15 @@ public Object invoke() throws InvocationTargetException, IllegalAccessException * @param args the arguments to match * @return the accumulated weight for all arguments */ - public static int getTypeDifferenceWeight(Class[] paramTypes, Object[] args) { + public static int getTypeDifferenceWeight(Class[] paramTypes, Object[] args) { int result = 0; for (int i = 0; i < paramTypes.length; i++) { if (!ClassUtils.isAssignableValue(paramTypes[i], args[i])) { return Integer.MAX_VALUE; } if (args[i] != null) { - Class paramType = paramTypes[i]; - Class superClass = args[i].getClass().getSuperclass(); + Class paramType = paramTypes[i]; + Class superClass = args[i].getClass().getSuperclass(); while (superClass != null) { if (paramType.equals(superClass)) { result = result + 2; diff --git a/spring-core/src/main/java/org/springframework/util/NumberUtils.java b/spring-core/src/main/java/org/springframework/util/NumberUtils.java index 4dc2d3e6ca80..7ad34c360850 100644 --- a/spring-core/src/main/java/org/springframework/util/NumberUtils.java +++ b/spring-core/src/main/java/org/springframework/util/NumberUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,7 +115,7 @@ else if (targetClass.equals(BigDecimal.class)) { * @param number the number we tried to convert * @param targetClass the target class we tried to convert to */ - private static void raiseOverflowException(Number number, Class targetClass) { + private static void raiseOverflowException(Number number, Class targetClass) { throw new IllegalArgumentException("Could not convert number [" + number + "] of type [" + number.getClass().getName() + "] to target class [" + targetClass.getName() + "]: overflow"); } diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index 16a59cbbad75..2fe75c72707d 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ public static boolean isCheckedException(Throwable ex) { * @param declaredExceptions the exceptions declared in the throws clause * @return whether the given exception is compatible */ - public static boolean isCompatibleWithThrowsClause(Throwable ex, Class[] declaredExceptions) { + public static boolean isCompatibleWithThrowsClause(Throwable ex, Class[] declaredExceptions) { if (!isCheckedException(ex)) { return true; } @@ -218,7 +218,7 @@ public static Object[] toObjectArray(Object source) { if (length == 0) { return new Object[0]; } - Class wrapperType = Array.get(source, 0).getClass(); + Class wrapperType = Array.get(source, 0).getClass(); Object[] newArray = (Object[]) Array.newInstance(wrapperType, length); for (int i = 0; i < length; i++) { newArray[i] = Array.get(source, i); diff --git a/spring-core/src/main/java/org/springframework/util/PropertiesPersister.java b/spring-core/src/main/java/org/springframework/util/PropertiesPersister.java index 9fb5c755a403..a8edf9706070 100644 --- a/spring-core/src/main/java/org/springframework/util/PropertiesPersister.java +++ b/spring-core/src/main/java/org/springframework/util/PropertiesPersister.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java b/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java index 6e8eaff2f13d..7506863875b1 100644 --- a/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java +++ b/spring-core/src/main/java/org/springframework/util/SystemPropertyUtils.java @@ -22,7 +22,7 @@ * Helper class for resolving placeholders in texts. Usually applied to file paths. * *

    A text may contain ${...} placeholders, to be resolved as system properties: e.g. - * ${user.dir}. Default values can be supplied using the ":" separator between key + * ${user.dir}. Default values can be supplied using the ":" separator between key * and value. * * @author Juergen Hoeller diff --git a/spring-core/src/main/java/org/springframework/util/TypeUtils.java b/spring-core/src/main/java/org/springframework/util/TypeUtils.java index 6c98fb26f615..3733f7cf2100 100644 --- a/spring-core/src/main/java/org/springframework/util/TypeUtils.java +++ b/spring-core/src/main/java/org/springframework/util/TypeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -212,7 +212,7 @@ private static boolean isAssignable(WildcardType lhsType, Type rhsType) { return true; } - + public static boolean isAssignableBound(Type lhsType, Type rhsType) { if (rhsType == null) { return true; diff --git a/spring-core/src/main/java/org/springframework/util/WeakReferenceMonitor.java b/spring-core/src/main/java/org/springframework/util/WeakReferenceMonitor.java index ad2e01c5efdb..efc9a8fdc15a 100644 --- a/spring-core/src/main/java/org/springframework/util/WeakReferenceMonitor.java +++ b/spring-core/src/main/java/org/springframework/util/WeakReferenceMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ public class WeakReferenceMonitor { private static final ReferenceQueue handleQueue = new ReferenceQueue(); // All tracked entries (WeakReference => ReleaseListener) - private static final Map trackedEntries = new HashMap(); + private static final Map, ReleaseListener> trackedEntries = new HashMap, ReleaseListener>(); // Thread polling handleQueue, lazy initialized private static Thread monitoringThread = null; @@ -84,7 +84,7 @@ public static void monitor(Object handle, ReleaseListener listener) { * @param ref reference to tracked handle * @param entry the associated entry */ - private static void addEntry(Reference ref, ReleaseListener entry) { + private static void addEntry(Reference ref, ReleaseListener entry) { synchronized (WeakReferenceMonitor.class) { // Add entry, the key is given reference. trackedEntries.put(ref, entry); @@ -103,7 +103,7 @@ private static void addEntry(Reference ref, ReleaseListener entry) { * @param reference the reference that should be removed * @return entry object associated with given reference */ - private static ReleaseListener removeEntry(Reference reference) { + private static ReleaseListener removeEntry(Reference reference) { synchronized (WeakReferenceMonitor.class) { return trackedEntries.remove(reference); } @@ -137,7 +137,7 @@ public void run() { // Check if there are any tracked entries left. while (keepMonitoringThreadAlive()) { try { - Reference reference = handleQueue.remove(); + Reference reference = handleQueue.remove(); // Stop tracking this reference. ReleaseListener entry = removeEntry(reference); if (entry != null) { diff --git a/spring-core/src/main/java/org/springframework/util/comparator/ComparableComparator.java b/spring-core/src/main/java/org/springframework/util/comparator/ComparableComparator.java index 269fddb4b9b8..40e4e7af9330 100644 --- a/spring-core/src/main/java/org/springframework/util/comparator/ComparableComparator.java +++ b/spring-core/src/main/java/org/springframework/util/comparator/ComparableComparator.java @@ -22,7 +22,7 @@ * Comparator that adapts Comparables to the Comparator interface. * Mainly for internal use in other Comparators, when supposed * to work on Comparables. - * + * * @author Keith Donald * @since 1.2.2 * @see Comparable diff --git a/spring-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java b/spring-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java index 4e1a6189afd2..1d051495b309 100644 --- a/spring-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java +++ b/spring-core/src/main/java/org/springframework/util/comparator/CompoundComparator.java @@ -32,7 +32,7 @@ * *

    This facilitates in-memory sorting similar to multi-column sorting in SQL. * The order of any single Comparator in the list can also be reversed. - * + * * @author Keith Donald * @author Juergen Hoeller * @since 1.2.2 @@ -59,9 +59,7 @@ public CompoundComparator() { * @param comparators the comparators to build into a compound comparator * @see InvertibleComparator */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public CompoundComparator(Comparator... comparators) { - Assert.notNull(comparators, "Comparators must not be null"); + public CompoundComparator(Comparator[] comparators) { this.comparators = new ArrayList>(comparators.length); for (Comparator comparator : comparators) { this.addComparator(comparator); @@ -183,7 +181,7 @@ public boolean equals(Object obj) { if (!(obj instanceof CompoundComparator)) { return false; } - CompoundComparator other = (CompoundComparator) obj; + CompoundComparator other = (CompoundComparator) obj; return this.comparators.equals(other.comparators); } diff --git a/spring-core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java b/spring-core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java index f78e56ff5dc9..499a1ec82fe9 100644 --- a/spring-core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java +++ b/spring-core/src/main/java/org/springframework/util/comparator/InvertibleComparator.java @@ -110,7 +110,7 @@ public boolean equals(Object obj) { if (!(obj instanceof InvertibleComparator)) { return false; } - InvertibleComparator other = (InvertibleComparator) obj; + InvertibleComparator other = (InvertibleComparator) obj; return (this.comparator.equals(other.comparator) && this.ascending == other.ascending); } diff --git a/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java b/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java index eeb11e1c4129..65105702f73d 100644 --- a/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java +++ b/spring-core/src/main/java/org/springframework/util/comparator/NullSafeComparator.java @@ -34,6 +34,7 @@ public class NullSafeComparator implements Comparator { /** * A shared default instance of this comparator, treating nulls lower * than non-null objects. + * @deprecated in favor of {@link #nullsLow()} */ @SuppressWarnings("rawtypes") public static final NullSafeComparator NULLS_LOW = new NullSafeComparator(true); @@ -41,10 +42,21 @@ public class NullSafeComparator implements Comparator { /** * A shared default instance of this comparator, treating nulls higher * than non-null objects. + * @deprecated in favor of {@link #nullsHigh()} */ @SuppressWarnings("rawtypes") public static final NullSafeComparator NULLS_HIGH = new NullSafeComparator(false); + @SuppressWarnings({ "unchecked", "deprecation" }) + public static NullSafeComparator nullsLow() { + return NULLS_LOW; + } + + @SuppressWarnings({ "unchecked", "deprecation" }) + public static NullSafeComparator nullsHigh() { + return NULLS_HIGH; + } + private final Comparator nonNullComparator; private final boolean nullsLow; @@ -108,7 +120,7 @@ public boolean equals(Object obj) { if (!(obj instanceof NullSafeComparator)) { return false; } - NullSafeComparator other = (NullSafeComparator) obj; + NullSafeComparator other = (NullSafeComparator) obj; return (this.nonNullComparator.equals(other.nonNullComparator) && this.nullsLow == other.nullsLow); } diff --git a/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java b/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java index 46bbe39b1af8..dbbc7b434fc9 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java +++ b/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java b/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java index d0d15cf9bc60..f0b449e48a68 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java +++ b/spring-core/src/main/java/org/springframework/util/xml/DomContentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/util/xml/DomUtils.java b/spring-core/src/main/java/org/springframework/util/xml/DomUtils.java index 62e1328fcfd5..f5a70015be26 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/DomUtils.java +++ b/spring-core/src/main/java/org/springframework/util/xml/DomUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,7 +119,7 @@ public static String getChildElementValueByTagName(Element ele, String childEleN } /** - * Retrieve all child elements of the given DOM element + * Retrieve all child elements of the given DOM element * @param ele the DOM element to analyze * @return a List of child org.w3c.dom.Element instances @@ -184,7 +184,7 @@ private static boolean nodeNameMatch(Node node, String desiredName) { } /** Matches the given node's name and local name against the given desired names. */ - private static boolean nodeNameMatch(Node node, Collection desiredNames) { + private static boolean nodeNameMatch(Node node, Collection desiredNames) { return (desiredNames.contains(node.getNodeName()) || desiredNames.contains(node.getLocalName())); } diff --git a/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java b/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java index 95ddc18b6104..f70c967b7530 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java +++ b/spring-core/src/main/java/org/springframework/util/xml/SimpleNamespaceContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,11 +61,11 @@ else if (prefixToNamespaceUri.containsKey(prefix)) { } public String getPrefix(String namespaceUri) { - List prefixes = getPrefixesInternal(namespaceUri); + List prefixes = getPrefixesInternal(namespaceUri); return prefixes.isEmpty() ? null : (String) prefixes.get(0); } - public Iterator getPrefixes(String namespaceUri) { + public Iterator getPrefixes(String namespaceUri) { return getPrefixesInternal(namespaceUri).iterator(); } @@ -152,7 +152,7 @@ public void removeBinding(String prefix) { } else { String namespaceUri = prefixToNamespaceUri.remove(prefix); - List prefixes = getPrefixesInternal(namespaceUri); + List prefixes = getPrefixesInternal(namespaceUri); prefixes.remove(prefix); } } diff --git a/spring-core/src/main/java/org/springframework/util/xml/StaxEventContentHandler.java b/spring-core/src/main/java/org/springframework/util/xml/StaxEventContentHandler.java index 73769f394d6b..b2cba9e3e6d2 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/StaxEventContentHandler.java +++ b/spring-core/src/main/java/org/springframework/util/xml/StaxEventContentHandler.java @@ -90,17 +90,15 @@ protected void endDocumentInternal() throws XMLStreamException { @Override protected void startElementInternal(QName name, Attributes atts, SimpleNamespaceContext namespaceContext) throws XMLStreamException { - - List attributes = getAttributes(atts); - List namespaces = createNamespaces(namespaceContext); - consumeEvent(this.eventFactory.createStartElement(name, attributes.iterator(), - (namespaces != null ? namespaces.iterator() : null))); + List attributes = getAttributes(atts); + List namespaces = createNamespaces(namespaceContext); + consumeEvent(eventFactory.createStartElement(name, attributes.iterator(), namespaces != null ? namespaces.iterator() : null)); } @Override protected void endElementInternal(QName name, SimpleNamespaceContext namespaceContext) throws XMLStreamException { - List namespaces = createNamespaces(namespaceContext); - consumeEvent(this.eventFactory.createEndElement(name, namespaces != null ? namespaces.iterator() : null)); + List namespaces = createNamespaces(namespaceContext); + consumeEvent(eventFactory.createEndElement(name, namespaces != null ? namespaces.iterator() : null)); } @Override @@ -135,8 +133,8 @@ private List createNamespaces(SimpleNamespaceContext namespaceContext if (StringUtils.hasLength(defaultNamespaceUri)) { namespaces.add(this.eventFactory.createNamespace(defaultNamespaceUri)); } - for (Iterator iterator = namespaceContext.getBoundPrefixes(); iterator.hasNext();) { - String prefix = (String) iterator.next(); + for (Iterator iterator = namespaceContext.getBoundPrefixes(); iterator.hasNext();) { + String prefix = iterator.next(); String namespaceUri = namespaceContext.getNamespaceURI(prefix); namespaces.add(this.eventFactory.createNamespace(prefix, namespaceUri)); } diff --git a/spring-core/src/main/java/org/springframework/util/xml/StaxEventXMLReader.java b/spring-core/src/main/java/org/springframework/util/xml/StaxEventXMLReader.java index 41fe0f116f67..8e2c7fe78ce2 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/StaxEventXMLReader.java +++ b/spring-core/src/main/java/org/springframework/util/xml/StaxEventXMLReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -203,11 +203,11 @@ private void handleStartElement(StartElement startElement) throws SAXException { if (getContentHandler() != null) { QName qName = startElement.getName(); if (hasNamespacesFeature()) { - for (Iterator i = startElement.getNamespaces(); i.hasNext();) { + for (Iterator i = startElement.getNamespaces(); i.hasNext();) { Namespace namespace = (Namespace) i.next(); startPrefixMapping(namespace.getPrefix(), namespace.getNamespaceURI()); } - for (Iterator i = startElement.getAttributes(); i.hasNext();){ + for (Iterator i = startElement.getAttributes(); i.hasNext();){ Attribute attribute = (Attribute) i.next(); QName attributeName = attribute.getName(); startPrefixMapping(attributeName.getPrefix(), attributeName.getNamespaceURI()); @@ -244,7 +244,7 @@ private void handleEndElement(EndElement endElement) throws SAXException { QName qName = endElement.getName(); if (hasNamespacesFeature()) { getContentHandler().endElement(qName.getNamespaceURI(), qName.getLocalPart(), toQualifiedName(qName)); - for (Iterator i = endElement.getNamespaces(); i.hasNext();) { + for (Iterator i = endElement.getNamespaces(); i.hasNext();) { Namespace namespace = (Namespace) i.next(); endPrefixMapping(namespace.getPrefix()); } @@ -312,7 +312,7 @@ private void handleEntityReference(EntityReference reference) throws SAXExceptio private Attributes getAttributes(StartElement event) { AttributesImpl attributes = new AttributesImpl(); - for (Iterator i = event.getAttributes(); i.hasNext();) { + for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute attribute = (Attribute) i.next(); QName qName = attribute.getName(); String namespace = qName.getNamespaceURI(); @@ -327,7 +327,7 @@ private Attributes getAttributes(StartElement event) { .addAttribute(namespace, qName.getLocalPart(), toQualifiedName(qName), type, attribute.getValue()); } if (hasNamespacePrefixesFeature()) { - for (Iterator i = event.getNamespaces(); i.hasNext();) { + for (Iterator i = event.getNamespaces(); i.hasNext();) { Namespace namespace = (Namespace) i.next(); String prefix = namespace.getPrefix(); String namespaceUri = namespace.getNamespaceURI(); diff --git a/spring-core/src/main/java/org/springframework/util/xml/StaxStreamContentHandler.java b/spring-core/src/main/java/org/springframework/util/xml/StaxStreamContentHandler.java index 0e2c7859ecb2..0d5cfc7c2744 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/StaxStreamContentHandler.java +++ b/spring-core/src/main/java/org/springframework/util/xml/StaxStreamContentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/util/xml/StaxStreamXMLReader.java b/spring-core/src/main/java/org/springframework/util/xml/StaxStreamXMLReader.java index 7099d32f2356..4e0cb5f2dba5 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/StaxStreamXMLReader.java +++ b/spring-core/src/main/java/org/springframework/util/xml/StaxStreamXMLReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamReader.java b/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamReader.java index d3a11a736bc6..097a9322931c 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamReader.java +++ b/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,7 +102,7 @@ public String getPIData() { } public int getNamespaceCount() { - Iterator namespaces; + Iterator namespaces; if (event.isStartElement()) { namespaces = event.asStartElement().getNamespaces(); } @@ -156,7 +156,7 @@ public int getAttributeCount() { if (!event.isStartElement()) { throw new IllegalStateException(); } - Iterator attributes = event.asStartElement().getAttributes(); + Iterator attributes = event.asStartElement().getAttributes(); return countIterator(attributes); } @@ -206,7 +206,7 @@ public boolean standaloneSet() { } } - private int countIterator(Iterator iterator) { + private int countIterator(Iterator iterator) { int count = 0; while (iterator.hasNext()) { iterator.next(); @@ -220,7 +220,7 @@ private Attribute getAttribute(int index) { throw new IllegalStateException(); } int count = 0; - Iterator attributes = event.asStartElement().getAttributes(); + Iterator attributes = event.asStartElement().getAttributes(); while (attributes.hasNext()) { Attribute attribute = (Attribute) attributes.next(); if (count == index) { @@ -234,7 +234,7 @@ private Attribute getAttribute(int index) { } private Namespace getNamespace(int index) { - Iterator namespaces; + Iterator namespaces; if (event.isStartElement()) { namespaces = event.asStartElement().getNamespaces(); } diff --git a/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamWriter.java b/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamWriter.java index c2f8b8509d5c..d2d18ce740b8 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamWriter.java +++ b/spring-core/src/main/java/org/springframework/util/xml/XMLEventStreamWriter.java @@ -36,7 +36,7 @@ * * @author Arjen Poutsma * @since 3.0.5 - * @see StaxUtils#createEventStreamWriter(javax.xml.stream.XMLEventWriter, javax.xml.stream.XMLEventFactory) + * @see StaxUtils#createEventStreamWriter(javax.xml.stream.XMLEventWriter, javax.xml.stream.XMLEventFactory) */ class XMLEventStreamWriter implements XMLStreamWriter { @@ -51,7 +51,7 @@ class XMLEventStreamWriter implements XMLStreamWriter { public XMLEventStreamWriter(XMLEventWriter eventWriter, XMLEventFactory eventFactory) { Assert.notNull(eventWriter, "'eventWriter' must not be null"); Assert.notNull(eventFactory, "'eventFactory' must not be null"); - + this.eventWriter = eventWriter; this.eventFactory = eventFactory; } @@ -199,7 +199,7 @@ private void writeStartElement(StartElement startElement) throws XMLStreamExcept private void writeNamespace(Namespace namespace) throws XMLStreamException { int last = endElements.size() - 1; EndElement oldEndElement = endElements.get(last); - Iterator oldNamespaces = oldEndElement.getNamespaces(); + Iterator oldNamespaces = oldEndElement.getNamespaces(); List newNamespaces = new ArrayList(); while (oldNamespaces.hasNext()) { Namespace oldNamespace = (Namespace) oldNamespaces.next(); diff --git a/spring-core/src/test/java/org/springframework/beans/Colour.java b/spring-core/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..8ee70cc536c4 100644 --- a/spring-core/src/test/java/org/springframework/beans/Colour.java +++ b/spring-core/src/test/java/org/springframework/beans/Colour.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ /** * @author Rob Harrop */ +@SuppressWarnings("deprecation") public class Colour extends ShortCodedLabeledEnum { public static final Colour RED = new Colour(0, "RED"); @@ -32,4 +33,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/CustomEnum.java b/spring-core/src/test/java/org/springframework/beans/CustomEnum.java index 1e43492191b0..f1d7879132cc 100644 --- a/spring-core/src/test/java/org/springframework/beans/CustomEnum.java +++ b/spring-core/src/test/java/org/springframework/beans/CustomEnum.java @@ -27,4 +27,4 @@ public String toString() { return "CustomEnum: " + name(); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-core/src/test/java/org/springframework/beans/DerivedTestBean.java index 8e309e0b4186..145b26cb5edf 100644 --- a/spring-core/src/test/java/org/springframework/beans/DerivedTestBean.java +++ b/spring-core/src/test/java/org/springframework/beans/DerivedTestBean.java @@ -79,4 +79,4 @@ public boolean wasDestroyed() { return destroyed; } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/GenericBean.java b/spring-core/src/test/java/org/springframework/beans/GenericBean.java index c4b85fa1f61e..6530dd5ea811 100644 --- a/spring-core/src/test/java/org/springframework/beans/GenericBean.java +++ b/spring-core/src/test/java/org/springframework/beans/GenericBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ public class GenericBean { private List> listOfMaps; + @SuppressWarnings("rawtypes") private Map plainMap; private Map shortMap; @@ -83,6 +84,7 @@ public GenericBean(Map shortMap, Resource resource) { this.resourceList = Collections.singletonList(resource); } + @SuppressWarnings("rawtypes") public GenericBean(Map plainMap, Map shortMap) { this.plainMap = plainMap; this.shortMap = shortMap; @@ -137,6 +139,7 @@ public void setListOfMaps(List> listOfMaps) { this.listOfMaps = listOfMaps; } + @SuppressWarnings("rawtypes") public Map getPlainMap() { return plainMap; } @@ -206,32 +209,33 @@ public void setCustomEnum(CustomEnum customEnum) { } - public static GenericBean createInstance(Set integerSet) { - return new GenericBean(integerSet); + public static GenericBean> createInstance(Set integerSet) { + return new GenericBean>(integerSet); } - public static GenericBean createInstance(Set integerSet, List resourceList) { - return new GenericBean(integerSet, resourceList); + public static GenericBean> createInstance(Set integerSet, List resourceList) { + return new GenericBean>(integerSet, resourceList); } - public static GenericBean createInstance(HashSet integerSet, Map shortMap) { - return new GenericBean(integerSet, shortMap); + public static GenericBean> createInstance(HashSet integerSet, Map shortMap) { + return new GenericBean>(integerSet, shortMap); } - public static GenericBean createInstance(Map shortMap, Resource resource) { - return new GenericBean(shortMap, resource); + public static GenericBean> createInstance(Map shortMap, Resource resource) { + return new GenericBean>(shortMap, resource); } - public static GenericBean createInstance(Map map, Map shortMap) { - return new GenericBean(map, shortMap); + @SuppressWarnings("rawtypes") + public static GenericBean createInstance(Map map, Map shortMap) { + return new GenericBean(map, shortMap); } - public static GenericBean createInstance(HashMap longMap) { - return new GenericBean(longMap); + public static GenericBean> createInstance(HashMap longMap) { + return new GenericBean>(longMap); } - public static GenericBean createInstance(boolean someFlag, Map> collectionMap) { - return new GenericBean(someFlag, collectionMap); + public static GenericBean> createInstance(boolean someFlag, Map> collectionMap) { + return new GenericBean>(someFlag, collectionMap); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-core/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-core/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-core/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/IOther.java b/spring-core/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-core/src/test/java/org/springframework/beans/IOther.java +++ b/spring-core/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/ITestBean.java b/spring-core/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-core/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-core/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-core/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..c1949e7ec2a7 100644 --- a/spring-core/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-core/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,17 +34,17 @@ public class IndexedTestBean { private TestBean[] array; - private Collection collection; + private Collection collection; - private List list; + private List list; - private Set set; + private Set set; - private SortedSet sortedSet; + private SortedSet sortedSet; - private Map map; + private Map map; - private SortedMap sortedMap; + private SortedMap sortedMap; public IndexedTestBean() { @@ -69,17 +69,17 @@ public void populate() { TestBean tbX = new TestBean("nameX", 0); TestBean tbY = new TestBean("nameY", 0); this.array = new TestBean[] {tb0, tb1}; - this.list = new ArrayList(); + this.list = new ArrayList(); this.list.add(tb2); this.list.add(tb3); - this.set = new TreeSet(); + this.set = new TreeSet(); this.set.add(tb6); this.set.add(tb7); - this.map = new HashMap(); + this.map = new HashMap(); this.map.put("key1", tb4); this.map.put("key2", tb5); this.map.put("key.3", tb5); - List list = new ArrayList(); + List list = new ArrayList(); list.add(tbX); list.add(tbY); this.map.put("key4", list); @@ -94,52 +94,52 @@ public void setArray(TestBean[] array) { this.array = array; } - public Collection getCollection() { + public Collection getCollection() { return collection; } - public void setCollection(Collection collection) { + public void setCollection(Collection collection) { this.collection = collection; } - public List getList() { + public List getList() { return list; } - public void setList(List list) { + public void setList(List list) { this.list = list; } - public Set getSet() { + public Set getSet() { return set; } - public void setSet(Set set) { + public void setSet(Set set) { this.set = set; } - public SortedSet getSortedSet() { + public SortedSet getSortedSet() { return sortedSet; } - public void setSortedSet(SortedSet sortedSet) { + public void setSortedSet(SortedSet sortedSet) { this.sortedSet = sortedSet; } - public Map getMap() { + public Map getMap() { return map; } - public void setMap(Map map) { + public void setMap(Map map) { this.map = map; } - public SortedMap getSortedMap() { + public SortedMap getSortedMap() { return sortedMap; } - public void setSortedMap(SortedMap sortedMap) { + public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-core/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-core/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-core/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/beans/TestBean.java b/spring-core/src/test/java/org/springframework/beans/TestBean.java index 2e08e2c034d7..c9c372be2403 100644 --- a/spring-core/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-core/src/test/java/org/springframework/beans/TestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ * @author Juergen Hoeller * @since 15 April 2001 */ -public class TestBean implements ITestBean, IOther, Comparable { +public class TestBean implements ITestBean, IOther, Comparable { private String beanName; @@ -65,13 +65,13 @@ public class TestBean implements ITestBean, IOther, Comparable { private Float myFloat = new Float(0.0); - private Collection friends = new LinkedList(); + private Collection friends = new LinkedList(); - private Set someSet = new HashSet(); + private Set someSet = new HashSet(); - private Map someMap = new HashMap(); + private Map someMap = new HashMap(); - private List someList = new ArrayList(); + private List someList = new ArrayList(); private Properties someProperties = new Properties(); @@ -89,10 +89,9 @@ public class TestBean implements ITestBean, IOther, Comparable { private Boolean someBoolean; - private List otherColours; - - private List pets; + private List otherColours; + private List pets; public TestBean() { } @@ -115,15 +114,15 @@ public TestBean(ITestBean spouse, Properties someProperties) { this.someProperties = someProperties; } - public TestBean(List someList) { + public TestBean(List someList) { this.someList = someList; } - public TestBean(Set someSet) { + public TestBean(Set someSet) { this.someSet = someSet; } - public TestBean(Map someMap) { + public TestBean(Map someMap) { this.someMap = someMap; } @@ -249,35 +248,35 @@ public void setMyFloat(Float myFloat) { this.myFloat = myFloat; } - public Collection getFriends() { + public Collection getFriends() { return friends; } - public void setFriends(Collection friends) { + public void setFriends(Collection friends) { this.friends = friends; } - public Set getSomeSet() { + public Set getSomeSet() { return someSet; } - public void setSomeSet(Set someSet) { + public void setSomeSet(Set someSet) { this.someSet = someSet; } - public Map getSomeMap() { + public Map getSomeMap() { return someMap; } - public void setSomeMap(Map someMap) { + public void setSomeMap(Map someMap) { this.someMap = someMap; } - public List getSomeList() { + public List getSomeList() { return someList; } - public void setSomeList(List someList) { + public void setSomeList(List someList) { this.someList = someList; } @@ -337,19 +336,19 @@ public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { this.nestedIndexedBean = nestedIndexedBean; } - public List getOtherColours() { + public List getOtherColours() { return otherColours; } - public void setOtherColours(List otherColours) { + public void setOtherColours(List otherColours) { this.otherColours = otherColours; } - public List getPets() { + public List getPets() { return pets; } - public void setPets(List pets) { + public void setPets(List pets) { this.pets = pets; } @@ -421,4 +420,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/core/AbstractControlFlowTests.java b/spring-core/src/test/java/org/springframework/core/AbstractControlFlowTests.java index 2136a269d9f3..4df72c309166 100644 --- a/spring-core/src/test/java/org/springframework/core/AbstractControlFlowTests.java +++ b/spring-core/src/test/java/org/springframework/core/AbstractControlFlowTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2006 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public void testUnderClassAndMethod() { new Two().testing(); new Three().test(); } - + /* public void testUnderPackage() { ControlFlow cflow = new ControlFlow(); @@ -43,7 +43,7 @@ public void testUnderPackage() { } */ - + public class One { public void test() { diff --git a/spring-core/src/test/java/org/springframework/core/AbstractGenericsTests.java b/spring-core/src/test/java/org/springframework/core/AbstractGenericsTests.java index 3d85742f028f..bc41c9bb0353 100644 --- a/spring-core/src/test/java/org/springframework/core/AbstractGenericsTests.java +++ b/spring-core/src/test/java/org/springframework/core/AbstractGenericsTests.java @@ -48,4 +48,4 @@ protected void executeTest() throws NoSuchMethodException { protected abstract Type getType(Method method); -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/core/AttributeAccessorSupportTests.java b/spring-core/src/test/java/org/springframework/core/AttributeAccessorSupportTests.java index d35b1b34fd94..ceab577a40d6 100644 --- a/spring-core/src/test/java/org/springframework/core/AttributeAccessorSupportTests.java +++ b/spring-core/src/test/java/org/springframework/core/AttributeAccessorSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java b/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java index 95f93a430d18..f6ae3d5fbe36 100644 --- a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,7 @@ public void testFindBridgedMethodInHierarchy() throws Exception { @Test public void testIsBridgeMethodFor() throws Exception { - Map typeParameterMap = GenericTypeResolver.getTypeVariableMap(MyBar.class); + Map, Type> typeParameterMap = GenericTypeResolver.getTypeVariableMap(MyBar.class); Method bridged = MyBar.class.getDeclaredMethod("someMethod", String.class, Object.class); Method other = MyBar.class.getDeclaredMethod("someMethod", Integer.class, Object.class); Method bridge = MyBar.class.getDeclaredMethod("someMethod", Object.class, Object.class); @@ -110,7 +110,7 @@ public void testIsBridgeMethodFor() throws Exception { @Test public void testCreateTypeVariableMap() throws Exception { - Map typeVariableMap = GenericTypeResolver.getTypeVariableMap(MyBar.class); + Map, Type> typeVariableMap = GenericTypeResolver.getTypeVariableMap(MyBar.class); TypeVariable barT = findTypeVariable(InterBar.class, "T"); assertEquals(String.class, typeVariableMap.get(barT)); @@ -220,7 +220,7 @@ public void testSPR2583() throws Exception { Method otherMethod = MessageBroadcasterImpl.class.getMethod("receive", NewMessageEvent.class); assertFalse(otherMethod.isBridge()); - Map typeVariableMap = GenericTypeResolver.getTypeVariableMap(MessageBroadcasterImpl.class); + Map, Type> typeVariableMap = GenericTypeResolver.getTypeVariableMap(MessageBroadcasterImpl.class); assertFalse("Match identified incorrectly", BridgeMethodResolver.isBridgeMethodFor(bridgeMethod, otherMethod, typeVariableMap)); assertTrue("Match not found correctly", BridgeMethodResolver.isBridgeMethodFor(bridgeMethod, bridgedMethod, typeVariableMap)); @@ -229,7 +229,7 @@ public void testSPR2583() throws Exception { @Test public void testSPR2454() throws Exception { - Map typeVariableMap = GenericTypeResolver.getTypeVariableMap(YourHomer.class); + Map, Type> typeVariableMap = GenericTypeResolver.getTypeVariableMap(YourHomer.class); TypeVariable variable = findTypeVariable(MyHomer.class, "L"); assertEquals(AbstractBounded.class, ((ParameterizedType) typeVariableMap.get(variable)).getRawType()); } @@ -533,7 +533,7 @@ public boolean boundedOperation(E myE) { } - private static class SerializableBounded extends AbstractBounded { + private static class SerializableBounded & Delayed> extends AbstractBounded { public boolean boundedOperation(E myE) { return false; @@ -547,7 +547,7 @@ public static interface GenericParameter { } - private static class StringGenericParameter implements GenericParameter { + public static class StringGenericParameter implements GenericParameter { public String getFor(Class cls) { return "foo"; @@ -559,7 +559,7 @@ public String getFor(Integer integer) { } - private static class StringList implements List { + public static class StringList implements List { public int size() { throw new UnsupportedOperationException(); @@ -729,6 +729,7 @@ public class GenericBroadcasterImpl implements Broadcaster { } + @SuppressWarnings({ "rawtypes", "unused", "unchecked" }) public abstract class GenericEventBroadcasterImpl extends GenericBroadcasterImpl implements EventBroadcaster { @@ -796,6 +797,7 @@ public class ModifiedMessageEvent extends MessageEvent { public class MessageBroadcasterImpl extends GenericEventBroadcasterImpl implements MessageBroadcaster { + @SuppressWarnings("unchecked") public MessageBroadcasterImpl() { super(NewMessageEvent.class); } @@ -882,7 +884,7 @@ public interface ConvenientGenericRepository extends } - public class GenericHibernateRepository + public class GenericHibernateRepository implements ConvenientGenericRepository { /** @@ -1099,7 +1101,7 @@ public static interface MegaMessageProducer extends MegaReceiver { } - + @SuppressWarnings({ "unused" }) private static class MegaMessageProducerImpl extends Other implements MegaMessageProducer { public void receive(NewMegaMessageEvent event) { @@ -1134,7 +1136,7 @@ public interface IGenericInterface { } - private static abstract class AbstractImplementsInterface implements IGenericInterface { + public static abstract class AbstractImplementsInterface implements IGenericInterface { public void doSomething(D domainObject, T value) { } diff --git a/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java b/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java index 3e7d144b5cc4..143f74f93b07 100644 --- a/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java +++ b/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java @@ -31,6 +31,7 @@ * @author Juergen Hoeller * @author Dave Syer */ +@SuppressWarnings({"deprecation", "rawtypes"}) public class CollectionFactoryTests extends TestCase { public void testLinkedSet() { diff --git a/spring-core/src/test/java/org/springframework/core/ConstantsTests.java b/spring-core/src/test/java/org/springframework/core/ConstantsTests.java index 68fe5cd74755..2dc85aae3191 100644 --- a/spring-core/src/test/java/org/springframework/core/ConstantsTests.java +++ b/spring-core/src/test/java/org/springframework/core/ConstantsTests.java @@ -33,7 +33,7 @@ public void testConstants() { Constants c = new Constants(A.class); assertEquals(A.class.getName(), c.getClassName()); assertEquals(9, c.getSize()); - + assertEquals(c.asNumber("DOG").intValue(), A.DOG); assertEquals(c.asNumber("dog").intValue(), A.DOG); assertEquals(c.asNumber("cat").intValue(), A.CAT); diff --git a/spring-core/src/test/java/org/springframework/core/ConventionsTests.java b/spring-core/src/test/java/org/springframework/core/ConventionsTests.java index ce42c75d7c24..04b66032c325 100644 --- a/spring-core/src/test/java/org/springframework/core/ConventionsTests.java +++ b/spring-core/src/test/java/org/springframework/core/ConventionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public void testArray() { } public void testCollections() { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new TestBean()); assertEquals("Incorrect plural List form", "testBeanList", Conventions.getVariableName(list)); - Set set = new HashSet(); + Set set = new HashSet(); set.add(new TestBean()); assertEquals("Incorrect plural Set form", "testBeanList", Conventions.getVariableName(set)); - List emptyList = new ArrayList(); + List emptyList = new ArrayList(); try { Conventions.getVariableName(emptyList); fail("Should not be able to generate name for empty collection"); @@ -67,7 +67,7 @@ public void testAttributeNameToPropertyName() throws Exception { public void testGetQualifiedAttributeName() throws Exception { String baseName = "foo"; - Class cls = String.class; + Class cls = String.class; String desiredResult = "java.lang.String.foo"; assertEquals(desiredResult, Conventions.getQualifiedAttributeName(cls, baseName)); } diff --git a/spring-core/src/test/java/org/springframework/core/DefaultControlFlowTests.java b/spring-core/src/test/java/org/springframework/core/DefaultControlFlowTests.java index d527f769eacb..ea011aa984de 100644 --- a/spring-core/src/test/java/org/springframework/core/DefaultControlFlowTests.java +++ b/spring-core/src/test/java/org/springframework/core/DefaultControlFlowTests.java @@ -22,7 +22,7 @@ * @author Rod Johnson */ public class DefaultControlFlowTests extends AbstractControlFlowTests { - + /** * Necessary only because Eclipse won't run test suite unless * it declares some methods as well as inherited methods. diff --git a/spring-core/src/test/java/org/springframework/core/ExceptionDepthComparatorTests.java b/spring-core/src/test/java/org/springframework/core/ExceptionDepthComparatorTests.java index 0e18a067db0f..4c4312e3103a 100644 --- a/spring-core/src/test/java/org/springframework/core/ExceptionDepthComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/core/ExceptionDepthComparatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,78 +28,89 @@ */ public class ExceptionDepthComparatorTests { - @Test - public void targetBeforeSameDepth() throws Exception { - Class foundClass = findClosestMatch(TargetException.class, SameDepthException.class); - assertEquals(TargetException.class, foundClass); - } - - @Test - public void sameDepthBeforeTarget() throws Exception { - Class foundClass = findClosestMatch(SameDepthException.class, TargetException.class); - assertEquals(TargetException.class, foundClass); - } - - @Test - public void lowestDepthBeforeTarget() throws Exception { - Class foundClass = findClosestMatch(LowestDepthException.class, TargetException.class); - assertEquals(TargetException.class, foundClass); - } - - @Test - public void targetBeforeLowestDepth() throws Exception { - Class foundClass = findClosestMatch(TargetException.class, LowestDepthException.class); - assertEquals(TargetException.class, foundClass); - } - - @Test - public void noDepthBeforeTarget() throws Exception { - Class foundClass = findClosestMatch(NoDepthException.class, TargetException.class); - assertEquals(TargetException.class, foundClass); - } - - @Test - public void noDepthBeforeHighestDepth() throws Exception { - Class foundClass = findClosestMatch(NoDepthException.class, HighestDepthException.class); - assertEquals(HighestDepthException.class, foundClass); - } - - @Test - public void highestDepthBeforeNoDepth() throws Exception { - Class foundClass = findClosestMatch(HighestDepthException.class, NoDepthException.class); - assertEquals(HighestDepthException.class, foundClass); - } - - @Test - public void highestDepthBeforeLowestDepth() throws Exception { - Class foundClass = findClosestMatch(HighestDepthException.class, LowestDepthException.class); - assertEquals(LowestDepthException.class, foundClass); - } - - @Test - public void lowestDepthBeforeHighestDepth() throws Exception { - Class foundClass = findClosestMatch(LowestDepthException.class, HighestDepthException.class); - assertEquals(LowestDepthException.class, foundClass); - } - - private Class findClosestMatch(Class... classes) { - return ExceptionDepthComparator.findClosestMatch(Arrays.asList(classes), new TargetException()); - } - - - public class HighestDepthException extends Throwable { - } - - public class LowestDepthException extends HighestDepthException { - } - - public class TargetException extends LowestDepthException { - } - - public class SameDepthException extends LowestDepthException { - } - - public class NoDepthException extends TargetException { - } + @Test + public void targetBeforeSameDepth() throws Exception { + Class foundClass = findClosestMatch(TargetException.class, + SameDepthException.class); + assertEquals(TargetException.class, foundClass); + } + + @Test + public void sameDepthBeforeTarget() throws Exception { + Class foundClass = findClosestMatch( + SameDepthException.class, TargetException.class); + assertEquals(TargetException.class, foundClass); + } + + @Test + public void lowestDepthBeforeTarget() throws Exception { + Class foundClass = findClosestMatch( + LowestDepthException.class, TargetException.class); + assertEquals(TargetException.class, foundClass); + } + + @Test + public void targetBeforeLowestDepth() throws Exception { + Class foundClass = findClosestMatch(TargetException.class, + LowestDepthException.class); + assertEquals(TargetException.class, foundClass); + } + + @Test + public void noDepthBeforeTarget() throws Exception { + Class foundClass = findClosestMatch(NoDepthException.class, + TargetException.class); + assertEquals(TargetException.class, foundClass); + } + + @Test + public void noDepthBeforeHighestDepth() throws Exception { + Class foundClass = findClosestMatch(NoDepthException.class, + HighestDepthException.class); + assertEquals(HighestDepthException.class, foundClass); + } + + @Test + public void highestDepthBeforeNoDepth() throws Exception { + Class foundClass = findClosestMatch( + HighestDepthException.class, NoDepthException.class); + assertEquals(HighestDepthException.class, foundClass); + } + + @Test + public void highestDepthBeforeLowestDepth() throws Exception { + Class foundClass = findClosestMatch( + HighestDepthException.class, LowestDepthException.class); + assertEquals(LowestDepthException.class, foundClass); + } + + @Test + public void lowestDepthBeforeHighestDepth() throws Exception { + Class foundClass = findClosestMatch( + LowestDepthException.class, HighestDepthException.class); + assertEquals(LowestDepthException.class, foundClass); + } + + @SuppressWarnings("unchecked") + private Class findClosestMatch(Class t1, + Class t2) { + return ExceptionDepthComparator.findClosestMatch(Arrays.asList(t1, t2), + new TargetException()); + } + + public class HighestDepthException extends Throwable { + } + + public class LowestDepthException extends HighestDepthException { + } + + public class TargetException extends LowestDepthException { + } + + public class SameDepthException extends LowestDepthException { + } + + public class NoDepthException extends TargetException { + } } diff --git a/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java b/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java index d86ed5ebb65b..3c7e1cd02f8b 100644 --- a/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,7 +120,7 @@ private abstract class CustomMap extends AbstractMap { private abstract class OtherCustomMap implements Map { } - + @SuppressWarnings("rawtypes") private interface Foo { Map a(); diff --git a/spring-core/src/test/java/org/springframework/core/Jdk14ControlFlowTests.java b/spring-core/src/test/java/org/springframework/core/Jdk14ControlFlowTests.java index 040a6fcf20b2..281141361eab 100644 --- a/spring-core/src/test/java/org/springframework/core/Jdk14ControlFlowTests.java +++ b/spring-core/src/test/java/org/springframework/core/Jdk14ControlFlowTests.java @@ -22,7 +22,7 @@ * @author Rod Johnson */ public class Jdk14ControlFlowTests extends AbstractControlFlowTests { - + /** * Necessary only because Eclipse won't run test suite unless it declares * some methods as well as inherited methods diff --git a/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java b/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java index 5951028343f2..1d610a50fcfd 100644 --- a/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java +++ b/spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import java.io.PrintStream; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.util.Arrays; import java.util.Date; import junit.framework.TestCase; @@ -51,14 +50,14 @@ public void testMethodParameterNameDiscoveryWithArgs() throws NoSuchMethodExcept } public void testConsParameterNameDiscoveryNoArgs() throws NoSuchMethodException { - Constructor noArgsCons = TestBean.class.getConstructor(new Class[0]); + Constructor noArgsCons = TestBean.class.getConstructor(new Class[0]); String[] names = discoverer.getParameterNames(noArgsCons); assertNotNull("should find cons info", names); assertEquals("no argument names", 0, names.length); } public void testConsParameterNameDiscoveryArgs() throws NoSuchMethodException { - Constructor twoArgCons = TestBean.class.getConstructor(new Class[] { String.class, int.class }); + Constructor twoArgCons = TestBean.class.getConstructor(new Class[] { String.class, int.class }); String[] names = discoverer.getParameterNames(twoArgCons); assertNotNull("should find cons info", names); assertEquals("one argument", 2, names.length); @@ -74,7 +73,7 @@ public void testStaticMethodParameterNameDiscoveryNoArgs() throws NoSuchMethodEx } public void testOverloadedStaticMethod() throws Exception { - Class clazz = this.getClass(); + Class clazz = this.getClass(); Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE, Long.TYPE }); String[] names = discoverer.getParameterNames(m1); @@ -93,7 +92,7 @@ public void testOverloadedStaticMethod() throws Exception { } public void testOverloadedStaticMethodInInnerClass() throws Exception { - Class clazz = InnerClass.class; + Class clazz = InnerClass.class; Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE }); String[] names = discoverer.getParameterNames(m1); @@ -110,7 +109,7 @@ public void testOverloadedStaticMethodInInnerClass() throws Exception { } public void testOverloadedMethod() throws Exception { - Class clazz = this.getClass(); + Class clazz = this.getClass(); Method m1 = clazz.getMethod("instanceMethod", new Class[] { Double.TYPE, Double.TYPE }); String[] names = discoverer.getParameterNames(m1); @@ -129,7 +128,7 @@ public void testOverloadedMethod() throws Exception { } public void testOverloadedMethodInInnerClass() throws Exception { - Class clazz = InnerClass.class; + Class clazz = InnerClass.class; Method m1 = clazz.getMethod("instanceMethod", new Class[] { String.class }); String[] names = discoverer.getParameterNames(m1); @@ -146,9 +145,9 @@ public void testOverloadedMethodInInnerClass() throws Exception { } public void testGenerifiedClass() throws Exception { - Class clazz = GenerifiedClass.class; + Class clazz = GenerifiedClass.class; - Constructor ctor = clazz.getDeclaredConstructor(Object.class); + Constructor ctor = clazz.getDeclaredConstructor(Object.class); String[] names = discoverer.getParameterNames(ctor); assertEquals(1, names.length); assertEquals("key", names[0]); @@ -186,10 +185,10 @@ public void testGenerifiedClass() throws Exception { assertEquals("x", names[1]); assertEquals("i", names[2]); - m = clazz.getMethod("getDate", null); + m = clazz.getMethod("getDate"); names = discoverer.getParameterNames(m); assertEquals(0, names.length); - + //System.in.read(); } @@ -200,10 +199,10 @@ public void testGenerifiedClass() throws Exception { @Ignore public void ignore_testClassesWithoutDebugSymbols() throws Exception { // JDK classes don't have debug information (usually) - Class clazz = Component.class; + Class clazz = Component.class; String methodName = "list"; - Method m = clazz.getMethod(methodName, null); + Method m = clazz.getMethod(methodName); String[] names = discoverer.getParameterNames(m); assertNull(names); @@ -276,7 +275,10 @@ public static long staticMethod(long x, long y) { public static class GenerifiedClass { private static long date; + @SuppressWarnings("unused") private K key; + + @SuppressWarnings("unused") private V value; static { @@ -317,4 +319,4 @@ public static long getDate() { return date; } } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java b/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java index 7d86d86071f9..2eaed5ec5bb2 100644 --- a/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java +++ b/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -70,7 +70,7 @@ public void testNestedCheckedExceptionWithNoRootCause() { NestedCheckedException nex = new NestedCheckedException(mesg) {}; assertNull(nex.getCause()); assertEquals(nex.getMessage(), mesg); - + // Check printStackTrace ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); @@ -79,7 +79,7 @@ public void testNestedCheckedExceptionWithNoRootCause() { String stackTrace = new String(baos.toByteArray()); assertFalse(stackTrace.indexOf(mesg) == -1); } - + public void testNestedCheckedExceptionWithRootCause() { String myMessage = "mesg for this exception"; String rootCauseMesg = "this is the obscure message of the root cause"; @@ -89,7 +89,7 @@ public void testNestedCheckedExceptionWithRootCause() { Assert.assertEquals(nex.getCause(), rootCause); assertTrue(nex.getMessage().indexOf(myMessage) != -1); assertTrue(nex.getMessage().indexOf(rootCauseMesg) != -1); - + // check PrintStackTrace ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); diff --git a/spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java b/spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java index 9c9d515bab65..b9c25f5ec7dc 100644 --- a/spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ */ public final class OrderComparatorTests extends TestCase { - private Comparator comparator; + private Comparator comparator; protected void setUp() throws Exception { diff --git a/spring-core/src/test/java/org/springframework/core/PrioritizedParameterNameDiscovererTests.java b/spring-core/src/test/java/org/springframework/core/PrioritizedParameterNameDiscovererTests.java index c51d8c1dbfa9..c78013a7c423 100644 --- a/spring-core/src/test/java/org/springframework/core/PrioritizedParameterNameDiscovererTests.java +++ b/spring-core/src/test/java/org/springframework/core/PrioritizedParameterNameDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,60 +25,62 @@ import org.springframework.beans.TestBean; public class PrioritizedParameterNameDiscovererTests extends TestCase { - + private static final String[] FOO_BAR = new String[] { "foo", "bar" }; - + private static final String[] SOMETHING_ELSE = new String[] { "something", "else" }; - + ParameterNameDiscoverer returnsFooBar = new ParameterNameDiscoverer() { public String[] getParameterNames(Method m) { return FOO_BAR; } - public String[] getParameterNames(Constructor ctor) { + public String[] getParameterNames(Constructor ctor) { return FOO_BAR; } }; - + ParameterNameDiscoverer returnsSomethingElse = new ParameterNameDiscoverer() { public String[] getParameterNames(Method m) { return SOMETHING_ELSE; } - public String[] getParameterNames(Constructor ctor) { + public String[] getParameterNames(Constructor ctor) { return SOMETHING_ELSE; } }; - + private final Method anyMethod; - private final Class anyClass = Object.class; - + + @SuppressWarnings("unused") + private final Class anyClass = Object.class; + public PrioritizedParameterNameDiscovererTests() throws SecurityException, NoSuchMethodException { anyMethod = TestBean.class.getMethod("getAge", (Class[]) null); } - + public void testNoParametersDiscoverers() { ParameterNameDiscoverer pnd = new PrioritizedParameterNameDiscoverer(); assertNull(pnd.getParameterNames(anyMethod)); - assertNull(pnd.getParameterNames((Constructor) null)); + assertNull(pnd.getParameterNames((Constructor) null)); } - + public void testOrderedParameterDiscoverers1() { PrioritizedParameterNameDiscoverer pnd = new PrioritizedParameterNameDiscoverer(); pnd.addDiscoverer(returnsFooBar); assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames(anyMethod))); - assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames((Constructor) null))); + assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames((Constructor) null))); pnd.addDiscoverer(returnsSomethingElse); assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames(anyMethod))); - assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames((Constructor) null))); + assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames((Constructor) null))); } - + public void testOrderedParameterDiscoverers2() { PrioritizedParameterNameDiscoverer pnd = new PrioritizedParameterNameDiscoverer(); pnd.addDiscoverer(returnsSomethingElse); assertTrue(Arrays.equals(SOMETHING_ELSE, pnd.getParameterNames(anyMethod))); - assertTrue(Arrays.equals(SOMETHING_ELSE, pnd.getParameterNames((Constructor) null))); + assertTrue(Arrays.equals(SOMETHING_ELSE, pnd.getParameterNames((Constructor) null))); pnd.addDiscoverer(returnsFooBar); assertTrue(Arrays.equals(SOMETHING_ELSE, pnd.getParameterNames(anyMethod))); - assertTrue(Arrays.equals(SOMETHING_ELSE, pnd.getParameterNames((Constructor) null))); + assertTrue(Arrays.equals(SOMETHING_ELSE, pnd.getParameterNames((Constructor) null))); } } diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java index 7ae700786352..b02c6c3aaa1c 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java @@ -363,5 +363,5 @@ public void foo() { @Retention(RetentionPolicy.RUNTIME) @Inherited @interface Transactional { - + } diff --git a/spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java b/spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java index 21d87d9b15e2..5c9e17a160c0 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java @@ -194,10 +194,10 @@ public void parameterAnnotated() throws Exception { @Target({ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) public @interface ParameterAnnotation { - int value(); + } - public void testAnnotatedMethod(@ParameterAnnotation(123) String parameter) { + public void testAnnotatedMethod(@ParameterAnnotation String parameter) { } diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java index 67f5bcf61653..e1e965b40678 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,8 +71,8 @@ public void scalarList() throws Exception { @SuppressWarnings("unchecked") List result = (List) conversionService.convert(list, sourceType, targetType); assertFalse(list.equals(result)); - assertEquals((Integer) 9, result.get(0)); - assertEquals((Integer) 37, result.get(1)); + assertEquals(9, result.get(0)); + assertEquals(37, result.get(1)); } public ArrayList scalarListTarget; @@ -297,7 +297,7 @@ public void testCollectionsEmptyList() throws Exception { converter.convert(list, type, TypeDescriptor.valueOf(Class.forName("java.util.Collections$EmptyList"))); } - public List list = Collections.emptyList(); + public List list = Collections.emptyList(); @SuppressWarnings("rawtypes") private void testCollectionConversionToArrayList(Collection aSource) { diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java index e5d7e27d3af0..d6073184eaaf 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -291,6 +291,7 @@ public void convertArrayToCollectionInterface() { public List genericList = new ArrayList(); @Test + @SuppressWarnings("unchecked") public void convertArrayToCollectionGenericTypeConversion() throws Exception { List result = (List) conversionService.convert(new String[] { "1", "2", "3" }, TypeDescriptor .valueOf(String[].class), new TypeDescriptor(getClass().getDeclaredField("genericList"))); @@ -300,8 +301,9 @@ public void convertArrayToCollectionGenericTypeConversion() throws Exception { } @Test + @SuppressWarnings("unchecked") public void testSpr7766() throws Exception { - ConverterRegistry registry = ((ConverterRegistry) conversionService); + ConverterRegistry registry = conversionService; registry.addConverter(new ColorConverter()); List colors = (List) conversionService.convert(new String[] { "ffffff", "#000000" }, TypeDescriptor.valueOf(String[].class), new TypeDescriptor(new MethodParameter(getClass().getMethod("handlerMethod", List.class), 0))); assertEquals(2, colors.size()); @@ -461,7 +463,7 @@ public void convertCollectionToStringWithElementConversion() throws Exception { @Test public void convertStringToCollection() { - List result = conversionService.convert("1,2,3", List.class); + List result = conversionService.convert("1,2,3", List.class); assertEquals(3, result.size()); assertEquals("1", result.get(0)); assertEquals("2", result.get(1)); @@ -470,7 +472,7 @@ public void convertStringToCollection() { @Test public void convertStringToCollectionWithElementConversion() throws Exception { - List result = (List) conversionService.convert("1,2,3", TypeDescriptor.valueOf(String.class), + List result = (List) conversionService.convert("1,2,3", TypeDescriptor.valueOf(String.class), new TypeDescriptor(getClass().getField("genericList"))); assertEquals(3, result.size()); assertEquals(new Integer(1), result.get(0)); @@ -480,7 +482,7 @@ public void convertStringToCollectionWithElementConversion() throws Exception { @Test public void convertEmptyStringToCollection() { - Collection result = conversionService.convert("", Collection.class); + Collection result = conversionService.convert("", Collection.class); assertEquals(0, result.size()); } @@ -507,13 +509,15 @@ public void convertCollectionToObjectAssignableTarget() throws Exception { } @Test + @SuppressWarnings("unchecked") public void convertObjectToCollection() { - List result = (List) conversionService.convert(3L, List.class); + List result = conversionService.convert(3L, List.class); assertEquals(1, result.size()); assertEquals(3L, result.get(0)); } @Test + @SuppressWarnings("unchecked") public void convertObjectToCollectionWithElementConversion() throws Exception { List result = (List) conversionService.convert(3L, TypeDescriptor.valueOf(Long.class), new TypeDescriptor(getClass().getField("genericList"))); @@ -546,6 +550,7 @@ public void convertArrayToArrayAssignable() { } @Test + @SuppressWarnings("unchecked") public void convertCollectionToCollection() throws Exception { Set foo = new LinkedHashSet(); foo.add("1"); @@ -559,6 +564,7 @@ public void convertCollectionToCollection() throws Exception { } @Test + @SuppressWarnings("unchecked") public void convertCollectionToCollectionNull() throws Exception { List bar = (List) conversionService.convert(null, TypeDescriptor.valueOf(LinkedHashSet.class), new TypeDescriptor(getClass().getField("genericList"))); @@ -571,7 +577,7 @@ public void convertCollectionToCollectionNotGeneric() throws Exception { foo.add("1"); foo.add("2"); foo.add("3"); - List bar = (List) conversionService.convert(foo, TypeDescriptor.valueOf(LinkedHashSet.class), TypeDescriptor + List bar = (List) conversionService.convert(foo, TypeDescriptor.valueOf(LinkedHashSet.class), TypeDescriptor .valueOf(List.class)); assertEquals("1", bar.get(0)); assertEquals("2", bar.get(1)); @@ -579,12 +585,13 @@ public void convertCollectionToCollectionNotGeneric() throws Exception { } @Test + @SuppressWarnings("unchecked") public void convertCollectionToCollectionSpecialCaseSourceImpl() throws Exception { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap(); map.put("1", "1"); map.put("2", "2"); map.put("3", "3"); - Collection values = map.values(); + Collection values = map.values(); List bar = (List) conversionService.convert(values, TypeDescriptor.forObject(values), new TypeDescriptor(getClass().getField("genericList"))); assertEquals(3, bar.size()); @@ -594,6 +601,7 @@ public void convertCollectionToCollectionSpecialCaseSourceImpl() throws Exceptio } @Test + @SuppressWarnings("unchecked") public void collection() { List strings = new ArrayList(); strings.add("3"); @@ -606,6 +614,7 @@ public void collection() { public Map genericMap = new HashMap(); @Test + @SuppressWarnings("unchecked") public void convertMapToMap() throws Exception { Map foo = new HashMap(); foo.put("1", "BAR"); @@ -617,6 +626,7 @@ public void convertMapToMap() throws Exception { } @Test + @SuppressWarnings("unchecked") public void map() { Map strings = new HashMap(); strings.put("3", "9"); diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/MapToMapConverterTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/MapToMapConverterTests.java index 635382e7c778..7463d32410d9 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/MapToMapConverterTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/MapToMapConverterTests.java @@ -96,6 +96,7 @@ public void scalarMapNotGenericSourceField() throws Exception { assertEquals((Integer) 37, result.get(2)); } + @SuppressWarnings("rawtypes") public Map notGenericMapSource; @Test diff --git a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java index 0e57814ac567..ed0947237743 100644 --- a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java +++ b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ * @author Juergen Hoeller * @author Sam Brannen */ +@SuppressWarnings("deprecation") public class LabeledEnumTests extends TestCase { private byte[] serializeObject(final Object obj) throws IOException { @@ -103,7 +104,7 @@ public void testLabelFoundForAbstractEnums() { public void testDoesNotMatchWrongClass() { try { - LabeledEnum none = StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class, + StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class, new Short((short) 1)); fail("Should have failed"); } @@ -121,9 +122,9 @@ public void testEquals() { private static class Other extends StaticLabeledEnum { public static final Other THING1 = new Other(1, "Thing1"); + @SuppressWarnings("unused") public static final Other THING2 = new Other(2, "Thing2"); - private Other(int code, String name) { super(code, name); } @@ -141,7 +142,7 @@ public String getLabel() { // Overriding getType() is no longer necessary as of Spring 2.5; // however, this is left here to provide valid testing for // backwards compatibility. - public Class getType() { + public Class getType() { return Dog.class; } }; diff --git a/spring-core/src/test/java/org/springframework/core/enums/StandAloneStaticLabeledEnum.java b/spring-core/src/test/java/org/springframework/core/enums/StandAloneStaticLabeledEnum.java index 078f39864c5a..38cef58124c1 100644 --- a/spring-core/src/test/java/org/springframework/core/enums/StandAloneStaticLabeledEnum.java +++ b/spring-core/src/test/java/org/springframework/core/enums/StandAloneStaticLabeledEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ * @author Sam Brannen * @since 2.5 */ +@SuppressWarnings("deprecation") public class StandAloneStaticLabeledEnum extends StaticLabeledEnum { private static final long serialVersionUID = 1L; diff --git a/spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java b/spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java index 3717edb38eb8..f430a29935ff 100644 --- a/spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java @@ -32,7 +32,7 @@ /** * Unit tests for {@link AbstractPropertySource} implementations. - * + * * @author Chris Beams * @since 3.1 */ diff --git a/spring-core/src/test/java/org/springframework/core/io/ResourceEditorTests.java b/spring-core/src/test/java/org/springframework/core/io/ResourceEditorTests.java index ff6a1fc6e51d..4980056eb598 100644 --- a/spring-core/src/test/java/org/springframework/core/io/ResourceEditorTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/ResourceEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java b/spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java index 0db7b301ff5b..f936b782820a 100644 --- a/spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,13 +91,13 @@ public void testClasspathStarWithPatternOnFileSystem() throws IOException { Resource[] resources = resolver.getResources("classpath*:org/springframework/core/io/sup*/*.class"); // Have to exclude Clover-generated class files here, // as we might be running as part of a Clover test run. - List noCloverResources = new ArrayList(); + List noCloverResources = new ArrayList(); for (int i = 0; i < resources.length; i++) { if (resources[i].getFilename().indexOf("$__CLOVER_") == -1) { noCloverResources.add(resources[i]); } } - resources = (Resource[]) noCloverResources.toArray(new Resource[noCloverResources.size()]); + resources = noCloverResources.toArray(new Resource[noCloverResources.size()]); assertProtocolAndFilenames(resources, "file", CLASSES_IN_CORE_IO_SUPPORT, TEST_CLASSES_IN_CORE_IO_SUPPORT); } @@ -119,9 +119,9 @@ private void assertProtocolAndFilename(Resource resource, String urlProtocol, St private void assertProtocolAndFilenames( Resource[] resources, String urlProtocol, String[] fileNames1, String[] fileNames2) throws IOException { - List fileNames = new ArrayList(Arrays.asList(fileNames1)); + List fileNames = new ArrayList(Arrays.asList(fileNames1)); fileNames.addAll(Arrays.asList(fileNames2)); - assertProtocolAndFilenames(resources, urlProtocol, (String[]) fileNames.toArray(new String[fileNames.size()])); + assertProtocolAndFilenames(resources, urlProtocol, fileNames.toArray(new String[fileNames.size()])); } private void assertProtocolAndFilenames(Resource[] resources, String urlProtocol, String[] fileNames) @@ -137,14 +137,14 @@ private void assertProtocolAndFilenames(Resource[] resources, String urlProtocol // List expectedNames = new LinkedList(Arrays.asList(fileNames)); // Collections.sort(sortedActualNames); // Collections.sort(expectedNames); -// +// // System.out.println("-----------"); // System.out.println("Expected: " + StringUtils.collectionToCommaDelimitedString(expectedNames)); // System.out.println("Actual: " + StringUtils.collectionToCommaDelimitedString(sortedActualNames)); // for (int i = 0; i < resources.length; i++) { // System.out.println(resources[i]); // } - + assertEquals("Correct number of files found", fileNames.length, resources.length); for (int i = 0; i < resources.length; i++) { Resource resource = resources[i]; diff --git a/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java b/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java index c12bd5b8e7e7..4bc59aac3e72 100644 --- a/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ public void testVanillaResource() throws Exception { @Test public void testPatternResource() throws Exception { - // N.B. this will sometimes fail if you use classpath: instead of classpath*:. + // N.B. this will sometimes fail if you use classpath: instead of classpath*:. // The result depends on the classpath - if test-classes are segregated from classes // and they come first on the classpath (like in Maven) then it breaks, if classes // comes first (like in Spring Build) then it is OK. @@ -65,6 +65,7 @@ public void testSystemPropertyReplacement() { } } + @SuppressWarnings("deprecation") @Test(expected=IllegalArgumentException.class) public void testStrictSystemPropertyReplacement() { PropertyEditor editor = new ResourceArrayPropertyEditor(new PathMatchingResourcePatternResolver(), false); diff --git a/spring-core/src/test/java/org/springframework/core/io/support/ResourcePropertySourceTests.java b/spring-core/src/test/java/org/springframework/core/io/support/ResourcePropertySourceTests.java index 1b77a9f542ce..8f11a2f582df 100644 --- a/spring-core/src/test/java/org/springframework/core/io/support/ResourcePropertySourceTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/support/ResourcePropertySourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/core/serializer/SerializationConverterTests.java b/spring-core/src/test/java/org/springframework/core/serializer/SerializationConverterTests.java index 42c724ec2cdf..2a15d175bf54 100644 --- a/spring-core/src/test/java/org/springframework/core/serializer/SerializationConverterTests.java +++ b/spring-core/src/test/java/org/springframework/core/serializer/SerializationConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java b/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java index 928486b3962e..ce8f71bfef06 100644 --- a/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java +++ b/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,14 @@ package org.springframework.core.style; import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import junit.framework.TestCase; -import org.springframework.core.CollectionFactory; import org.springframework.util.ObjectUtils; /** @@ -52,7 +53,7 @@ public String toString() { } public void testDefaultStyleMap() { - final Map map = getMap(); + final Map map = getMap(); Object stringy = new Object() { public String toString() { return new ToStringCreator(this).append("familyFavoriteSport", map).toString(); @@ -63,8 +64,8 @@ public String toString() { stringy.toString()); } - private Map getMap() { - Map map = CollectionFactory.createLinkedMapIfPossible(3); + private Map getMap() { + Map map = new LinkedHashMap(3); map.put("Keri", "Softball"); map.put("Scot", "Fishing"); map.put("Keith", "Flag Football"); @@ -85,7 +86,7 @@ public void testPrimitiveArrays() { } public void testList() { - List list = new ArrayList(); + List list = new ArrayList(); list.add(s1); list.add(s2); list.add(s3); @@ -95,7 +96,7 @@ public void testList() { } public void testSet() { - Set set = CollectionFactory.createLinkedSetIfPossible(3); + Set set = new LinkedHashSet(); set.add(s1); set.add(s2); set.add(s3); @@ -111,7 +112,7 @@ public void testClass() { } public void testMethod() throws Exception { - String str = new ToStringCreator(this).append("myMethod", this.getClass().getMethod("testMethod", null)) + String str = new ToStringCreator(this).append("myMethod", this.getClass().getMethod("testMethod")) .toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myMethod = testMethod@ToStringCreatorTests]", str); diff --git a/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java b/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java index 6f051a16e705..a2dd2edbd573 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java @@ -147,7 +147,7 @@ private void doTestAnnotationInfo(AnnotationMetadata metadata) { assertThat(specialAttrs.getString("clazz"), is(String.class.getName())); AnnotationAttributes nestedAnno = specialAttrs.getAnnotation("nestedAnno"); - assertArrayEquals(new String[]{String.class.getName()}, (String[])nestedAnno.getStringArray("classArray")); + assertArrayEquals(new String[]{String.class.getName()}, nestedAnno.getStringArray("classArray")); assertArrayEquals(new String[]{String.class.getName()}, nestedAnno.getStringArray("classArray")); AnnotationAttributes[] nestedAnnoArray = specialAttrs.getAnnotationArray("nestedAnnoArray"); @@ -214,9 +214,9 @@ public static enum SomeEnum { }) @SuppressWarnings({"serial", "unused"}) private static class AnnotatedComponent implements Serializable { - - @TestAutowired - public void doWork(@TestQualifier("myColor") java.awt.Color color) { + + @Autowired + public void doWork(@Qualifier("myColor") java.awt.Color color) { } public void doSleep() { diff --git a/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java index e9d8c1e19de7..16b8967b52eb 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,42 +108,42 @@ public void testMatchesInterfacesIfConfigured() throws Exception { // and interfering with ClassloadingAssertions.assertClassNotLoaded() @Inherited - private static @interface InheritedAnnotation { + public static @interface InheritedAnnotation { } @InheritedAnnotation - private static class SomeComponent { + public static class SomeComponent { } @InheritedAnnotation - private static interface SomeComponentInterface { + public static interface SomeComponentInterface { } - private static class SomeSubClassOfSomeComponentInterface implements SomeComponentInterface { + public static class SomeSubClassOfSomeComponentInterface implements SomeComponentInterface { } - private static class SomeSubClassOfSomeComponent extends SomeComponent { + public static class SomeSubClassOfSomeComponent extends SomeComponent { } - private static @interface NonInheritedAnnotation { + public static @interface NonInheritedAnnotation { } @NonInheritedAnnotation - private static class SomeClassMarkedWithNonInheritedAnnotation { + public static class SomeClassMarkedWithNonInheritedAnnotation { } - private static class SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation extends SomeClassMarkedWithNonInheritedAnnotation { + public static class SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation extends SomeClassMarkedWithNonInheritedAnnotation { } - private static class SomeNonCandidateClass { + public static class SomeNonCandidateClass { } } diff --git a/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java index 45abc29cc17d..d5e5c582ff7e 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java index ef547f5fb81f..f6cd69c63306 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AssignableTypeFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public void testDirectMatch() throws Exception { assertFalse(notMatchingFilter.match(metadataReader, metadataReaderFactory)); assertTrue(matchingFilter.match(metadataReader, metadataReaderFactory)); } - + public void testInterfaceMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$TestInterfaceImpl"; @@ -49,7 +49,7 @@ public void testInterfaceMatch() throws Exception { assertTrue(filter.match(metadataReader, metadataReaderFactory)); ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } - + public void testSuperClassMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$SomeDaoLikeImpl"; @@ -59,7 +59,7 @@ public void testSuperClassMatch() throws Exception { assertTrue(filter.match(metadataReader, metadataReaderFactory)); ClassloadingAssertions.assertClassNotLoaded(classUnderTest); } - + public void testInterfaceThroughSuperClassMatch() throws Exception { MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory(); String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$SomeDaoLikeImpl"; @@ -73,30 +73,30 @@ public void testInterfaceThroughSuperClassMatch() throws Exception { // We must use a standalone set of types to ensure that no one else is loading them // and interfere with ClassloadingAssertions.assertClassNotLoaded() - private static class TestNonInheritingClass { + public static class TestNonInheritingClass { } - private static interface TestInterface { + public static interface TestInterface { } - private static class TestInterfaceImpl implements TestInterface { + public static class TestInterfaceImpl implements TestInterface { } - private static interface SomeDaoLikeInterface { + public static interface SomeDaoLikeInterface { } - private static class SomeDaoLikeImpl extends SimpleJdbcDaoSupport implements SomeDaoLikeInterface { + public static class SomeDaoLikeImpl extends SimpleJdbcDaoSupport implements SomeDaoLikeInterface { } - private static interface JdbcDaoSupport { + public static interface JdbcDaoSupport { } - private static class SimpleJdbcDaoSupport implements JdbcDaoSupport { + public static class SimpleJdbcDaoSupport implements JdbcDaoSupport { } diff --git a/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java b/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java index e6128c35bfbc..c11ea0907cc3 100644 --- a/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java +++ b/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTest.java @@ -1,12 +1,12 @@ /* - * Copyright 2006-2010 the original author or authors. - * + * Copyright 2006-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,13 +27,12 @@ import org.springframework.core.type.classreading.CachingMetadataReaderFactory; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; /** - * Unit test checking the behaviour of {@link CachingMetadataReaderFactory under load. + * Unit test checking the behaviour of {@link CachingMetadataReaderFactory} under load. * If the cache is not controller, this test should fail with an out of memory exception around entry - * 5k. - * + * 5k. + * * @author Costin Leau */ public class CachingMetadataReaderLeakTest { @@ -55,7 +54,6 @@ public void testSignificantLoad() throws Exception { // look at a LOT of items for (int i = 0; i < ITEMS_LOAD; i++) { Resource resource = new UrlResource(url) { - private int counter = 0; @Override public boolean equals(Object obj) { diff --git a/spring-core/src/test/java/org/springframework/core/type/ClassloadingAssertions.java b/spring-core/src/test/java/org/springframework/core/type/ClassloadingAssertions.java index a9996e3334ec..8fb250c59acb 100644 --- a/spring-core/src/test/java/org/springframework/core/type/ClassloadingAssertions.java +++ b/spring-core/src/test/java/org/springframework/core/type/ClassloadingAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public static boolean isClassLoaded(String className) { ClassLoader cl = ClassUtils.getDefaultClassLoader(); Method findLoadeClassMethod = ReflectionUtils.findMethod(cl.getClass(), "findLoadedClass", new Class[]{String.class}); findLoadeClassMethod.setAccessible(true); - Class loadedClass = (Class)ReflectionUtils.invokeMethod(findLoadeClassMethod, cl, new Object[]{className}); + Class loadedClass = (Class)ReflectionUtils.invokeMethod(findLoadeClassMethod, cl, new Object[]{className}); return loadedClass != null; } @@ -42,4 +42,4 @@ public static void assertClassLoaded(String className) { public static void assertClassNotLoaded(String className) { TestCase.assertFalse("Class shouldn't have been loaded", isClassLoaded(className)); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/stereotype/Component.java b/spring-core/src/test/java/org/springframework/stereotype/Component.java index e0b637f815c9..41167832c964 100644 --- a/spring-core/src/test/java/org/springframework/stereotype/Component.java +++ b/spring-core/src/test/java/org/springframework/stereotype/Component.java @@ -51,4 +51,4 @@ */ public abstract String value() default ""; -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java b/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java index e960a62ea658..62a4339ea3a3 100644 --- a/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java +++ b/spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/AssertTests.java b/spring-core/src/test/java/org/springframework/util/AssertTests.java index 2fe76022f0c0..7fcb391a5699 100644 --- a/spring-core/src/test/java/org/springframework/util/AssertTests.java +++ b/spring-core/src/test/java/org/springframework/util/AssertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ public class AssertTests { @Test(expected = IllegalArgumentException.class) public void instanceOf() { - final Set set = new HashSet(); + final Set set = new HashSet(); Assert.isInstanceOf(HashSet.class, set); Assert.isInstanceOf(HashMap.class, set); } @@ -105,12 +105,12 @@ public void doesNotContainWithEmptySubstringDoesNotThrowException() throws Excep @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithNullCollectionThrowsException() throws Exception { - Assert.notEmpty((Collection) null); + Assert.notEmpty((Collection) null); } @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithEmptyCollectionThrowsException() throws Exception { - Assert.notEmpty(new ArrayList()); + Assert.notEmpty(new ArrayList()); } @Test @@ -122,12 +122,12 @@ public void assertNotEmptyWithCollectionSunnyDay() throws Exception { @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithNullMapThrowsException() throws Exception { - Assert.notEmpty((Map) null); + Assert.notEmpty((Map) null); } @Test(expected = IllegalArgumentException.class) public void assertNotEmptyWithEmptyMapThrowsException() throws Exception { - Assert.notEmpty(new HashMap()); + Assert.notEmpty(new HashMap()); } @Test diff --git a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java index cca9da12e611..9d74a50f2dac 100644 --- a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java +++ b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,22 +30,22 @@ public class AutoPopulatingListTests extends TestCase { public void testWithClass() throws Exception { - doTestWithClass(new AutoPopulatingList(TestBean.class)); + doTestWithClass(new AutoPopulatingList(TestBean.class)); } public void testWithClassAndUserSuppliedBackingList() throws Exception { - doTestWithClass(new AutoPopulatingList(new LinkedList(), TestBean.class)); + doTestWithClass(new AutoPopulatingList(new LinkedList(), TestBean.class)); } public void testWithElementFactory() throws Exception { - doTestWithElementFactory(new AutoPopulatingList(new MockElementFactory())); + doTestWithElementFactory(new AutoPopulatingList(new MockElementFactory())); } public void testWithElementFactoryAndUserSuppliedBackingList() throws Exception { - doTestWithElementFactory(new AutoPopulatingList(new LinkedList(), new MockElementFactory())); + doTestWithElementFactory(new AutoPopulatingList(new LinkedList(), new MockElementFactory())); } - private void doTestWithClass(AutoPopulatingList list) { + private void doTestWithClass(AutoPopulatingList list) { Object lastElement = null; for (int x = 0; x < 10; x++) { Object element = list.get(x); @@ -66,7 +66,7 @@ private void doTestWithClass(AutoPopulatingList list) { assertTrue(list.get(20) instanceof TestBean); } - private void doTestWithElementFactory(AutoPopulatingList list) { + private void doTestWithElementFactory(AutoPopulatingList list) { doTestWithClass(list); for(int x = 0; x < list.size(); x++) { @@ -78,12 +78,12 @@ private void doTestWithElementFactory(AutoPopulatingList list) { } public void testSerialization() throws Exception { - AutoPopulatingList list = new AutoPopulatingList(TestBean.class); + AutoPopulatingList list = new AutoPopulatingList(TestBean.class); Assert.assertEquals(list, SerializationTestUtils.serializeAndDeserialize(list)); } - private static class MockElementFactory implements AutoPopulatingList.ElementFactory { + private static class MockElementFactory implements AutoPopulatingList.ElementFactory { public Object createElement(int index) { TestBean bean = new TestBean(); diff --git a/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java index 64a24084ba0b..1fb54bb9f75b 100644 --- a/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ * @author Rob Harrop * @author Rick Evans */ +@SuppressWarnings("deprecation") public class ClassUtilsTests extends TestCase { public void setUp() { @@ -171,14 +172,14 @@ public void testGetQualifiedNameForMultiDimensionalPrimitiveArrayClass() { } public void testHasMethod() throws Exception { - assertTrue(ClassUtils.hasMethod(Collection.class, "size", null)); + assertTrue(ClassUtils.hasMethod(Collection.class, "size")); assertTrue(ClassUtils.hasMethod(Collection.class, "remove", new Class[] {Object.class})); - assertFalse(ClassUtils.hasMethod(Collection.class, "remove", null)); - assertFalse(ClassUtils.hasMethod(Collection.class, "someOtherMethod", null)); + assertFalse(ClassUtils.hasMethod(Collection.class, "remove")); + assertFalse(ClassUtils.hasMethod(Collection.class, "someOtherMethod")); } public void testGetMethodIfAvailable() throws Exception { - Method method = ClassUtils.getMethodIfAvailable(Collection.class, "size", null); + Method method = ClassUtils.getMethodIfAvailable(Collection.class, "size"); assertNotNull(method); assertEquals("size", method.getName()); @@ -186,8 +187,8 @@ public void testGetMethodIfAvailable() throws Exception { assertNotNull(method); assertEquals("remove", method.getName()); - assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "remove", null)); - assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "someOtherMethod", null)); + assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "remove")); + assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "someOtherMethod")); } public void testGetMethodCountForName() { @@ -258,7 +259,7 @@ public void testAddResourcePathToPackagePath() { public void testGetAllInterfaces() { DerivedTestBean testBean = new DerivedTestBean(); - List ifcs = Arrays.asList(ClassUtils.getAllInterfaces(testBean)); + List> ifcs = Arrays.asList(ClassUtils.getAllInterfaces(testBean)); assertEquals("Correct number of interfaces", 4, ifcs.size()); assertTrue("Contains Serializable", ifcs.contains(Serializable.class)); assertTrue("Contains ITestBean", ifcs.contains(ITestBean.class)); @@ -266,13 +267,13 @@ public void testGetAllInterfaces() { } public void testClassNamesToString() { - List ifcs = new LinkedList(); + List> ifcs = new LinkedList>(); ifcs.add(Serializable.class); ifcs.add(Runnable.class); assertEquals("[interface java.io.Serializable, interface java.lang.Runnable]", ifcs.toString()); assertEquals("[java.io.Serializable, java.lang.Runnable]", ClassUtils.classNamesToString(ifcs)); - List classes = new LinkedList(); + List> classes = new LinkedList>(); classes.add(LinkedList.class); classes.add(Integer.class); assertEquals("[class java.util.LinkedList, class java.lang.Integer]", classes.toString()); @@ -282,7 +283,7 @@ public void testClassNamesToString() { assertEquals("[java.util.List]", ClassUtils.classNamesToString(List.class)); assertEquals("[]", Collections.EMPTY_LIST.toString()); - assertEquals("[]", ClassUtils.classNamesToString(Collections.EMPTY_LIST)); + assertEquals("[]", ClassUtils.classNamesToString(Collections.>emptyList())); } @@ -305,7 +306,7 @@ public static void argStaticMethod(String anArg) { } } - private static class OverloadedMethodsClass { + public static class OverloadedMethodsClass { public void print(String messages) { /* no-op */ } @@ -314,7 +315,7 @@ public void print(String[] messages) { } } - private static class SubOverloadedMethodsClass extends OverloadedMethodsClass{ + public static class SubOverloadedMethodsClass extends OverloadedMethodsClass{ public void print(String header, String[] messages) { /* no-op */ } diff --git a/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java b/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java index 820755a09175..e404db766d3c 100644 --- a/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,16 +40,16 @@ public class CollectionUtilsTests { @Test public void testIsEmpty() { - assertTrue(CollectionUtils.isEmpty((Set) null)); - assertTrue(CollectionUtils.isEmpty((Map) null)); - assertTrue(CollectionUtils.isEmpty(new HashMap())); - assertTrue(CollectionUtils.isEmpty(new HashSet())); + assertTrue(CollectionUtils.isEmpty((Set) null)); + assertTrue(CollectionUtils.isEmpty((Map) null)); + assertTrue(CollectionUtils.isEmpty(new HashMap())); + assertTrue(CollectionUtils.isEmpty(new HashSet())); - List list = new LinkedList(); + List list = new LinkedList(); list.add(new Object()); assertFalse(CollectionUtils.isEmpty(list)); - Map map = new HashMap(); + HashMap map = new HashMap(); map.put("foo", "bar"); assertFalse(CollectionUtils.isEmpty(map)); } @@ -57,7 +57,7 @@ public void testIsEmpty() { @Test public void testMergeArrayIntoCollection() { Object[] arr = new Object[] {"value1", "value2"}; - List list = new LinkedList(); + List list = new LinkedList(); list.add("value3"); CollectionUtils.mergeArrayIntoCollection(arr, list); @@ -69,7 +69,7 @@ public void testMergeArrayIntoCollection() { @Test public void testMergePrimitiveArrayIntoCollection() { int[] arr = new int[] {1, 2}; - List list = new LinkedList(); + List list = new LinkedList(); list.add(new Integer(3)); CollectionUtils.mergeArrayIntoCollection(arr, list); @@ -86,7 +86,7 @@ public void testMergePropertiesIntoMap() { props.setProperty("prop2", "value2"); props.put("prop3", new Integer(3)); - Map map = new HashMap(); + Map map = new HashMap(); map.put("prop4", "value4"); CollectionUtils.mergePropertiesIntoMap(props, map); @@ -98,28 +98,28 @@ public void testMergePropertiesIntoMap() { @Test public void testContains() { - assertFalse(CollectionUtils.contains((Iterator) null, "myElement")); - assertFalse(CollectionUtils.contains((Enumeration) null, "myElement")); - assertFalse(CollectionUtils.contains(new LinkedList().iterator(), "myElement")); - assertFalse(CollectionUtils.contains(new Hashtable().keys(), "myElement")); + assertFalse(CollectionUtils.contains((Iterator) null, "myElement")); + assertFalse(CollectionUtils.contains((Enumeration) null, "myElement")); + assertFalse(CollectionUtils.contains(new LinkedList().iterator(), "myElement")); + assertFalse(CollectionUtils.contains(new Hashtable().keys(), "myElement")); - List list = new LinkedList(); + List list = new LinkedList(); list.add("myElement"); assertTrue(CollectionUtils.contains(list.iterator(), "myElement")); - Hashtable ht = new Hashtable(); + Hashtable ht = new Hashtable(); ht.put("myElement", "myValue"); assertTrue(CollectionUtils.contains(ht.keys(), "myElement")); } @Test public void testContainsAny() throws Exception { - List source = new ArrayList(); + ArrayList source = new ArrayList(); source.add("abc"); source.add("def"); source.add("ghi"); - List candidates = new ArrayList(); + ArrayList candidates = new ArrayList(); candidates.add("xyz"); candidates.add("def"); candidates.add("abc"); @@ -139,7 +139,7 @@ public void testContainsInstanceWithNullCollection() throws Exception { @Test public void testContainsInstanceWithInstancesThatAreEqualButDistinct() throws Exception { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new Instance("fiona")); assertFalse("Must return false if instance is not in the supplied Collection argument", CollectionUtils.containsInstance(list, new Instance("fiona"))); @@ -147,7 +147,7 @@ public void testContainsInstanceWithInstancesThatAreEqualButDistinct() throws Ex @Test public void testContainsInstanceWithSameInstance() throws Exception { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new Instance("apple")); Instance instance = new Instance("fiona"); list.add(instance); @@ -157,7 +157,7 @@ public void testContainsInstanceWithSameInstance() throws Exception { @Test public void testContainsInstanceWithNullInstance() throws Exception { - List list = new ArrayList(); + List list = new ArrayList(); list.add(new Instance("apple")); list.add(new Instance("fiona")); assertFalse("Must return false if null instance is supplied", @@ -166,12 +166,12 @@ public void testContainsInstanceWithNullInstance() throws Exception { @Test public void testFindFirstMatch() throws Exception { - List source = new ArrayList(); + List source = new ArrayList(); source.add("abc"); source.add("def"); source.add("ghi"); - List candidates = new ArrayList(); + List candidates = new ArrayList(); candidates.add("xyz"); candidates.add("def"); candidates.add("abc"); @@ -181,35 +181,35 @@ public void testFindFirstMatch() throws Exception { @Test public void testHasUniqueObject() { - List list = new LinkedList(); + List list = new LinkedList(); list.add("myElement"); list.add("myOtherElement"); assertFalse(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add("myElement"); assertTrue(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add("myElement"); list.add(null); assertFalse(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add(null); list.add("myElement"); assertFalse(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add(null); list.add(null); assertTrue(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); list.add(null); assertTrue(CollectionUtils.hasUniqueObject(list)); - list = new LinkedList(); + list = new LinkedList(); assertFalse(CollectionUtils.hasUniqueObject(list)); } diff --git a/spring-core/src/test/java/org/springframework/util/CompositeIteratorTests.java b/spring-core/src/test/java/org/springframework/util/CompositeIteratorTests.java index 451005558e33..f105f460231b 100644 --- a/spring-core/src/test/java/org/springframework/util/CompositeIteratorTests.java +++ b/spring-core/src/test/java/org/springframework/util/CompositeIteratorTests.java @@ -9,13 +9,13 @@ /** * Test case for {@link CompositeIterator}. - * + * * @author Erwin Vervaet */ public class CompositeIteratorTests extends TestCase { public void testNoIterators() { - CompositeIterator it = new CompositeIterator(); + CompositeIterator it = new CompositeIterator(); assertFalse(it.hasNext()); try { it.next(); @@ -26,7 +26,7 @@ public void testNoIterators() { } public void testSingleIterator() { - CompositeIterator it = new CompositeIterator(); + CompositeIterator it = new CompositeIterator(); it.add(Arrays.asList(new String[] { "0", "1" }).iterator()); for (int i = 0; i < 2; i++) { assertTrue(it.hasNext()); @@ -42,7 +42,7 @@ public void testSingleIterator() { } public void testMultipleIterators() { - CompositeIterator it = new CompositeIterator(); + CompositeIterator it = new CompositeIterator(); it.add(Arrays.asList(new String[] { "0", "1" }).iterator()); it.add(Arrays.asList(new String[] { "2" }).iterator()); it.add(Arrays.asList(new String[] { "3", "4" }).iterator()); @@ -60,8 +60,8 @@ public void testMultipleIterators() { } public void testInUse() { - List list = Arrays.asList(new String[] { "0", "1" }); - CompositeIterator it = new CompositeIterator(); + List list = Arrays.asList(new String[] { "0", "1" }); + CompositeIterator it = new CompositeIterator(); it.add(list.iterator()); it.hasNext(); try { @@ -70,7 +70,7 @@ public void testInUse() { } catch (IllegalStateException e) { // expected } - it = new CompositeIterator(); + it = new CompositeIterator(); it.add(list.iterator()); it.next(); try { @@ -82,9 +82,9 @@ public void testInUse() { } public void testDuplicateIterators() { - List list = Arrays.asList(new String[] { "0", "1" }); - Iterator iterator = list.iterator(); - CompositeIterator it = new CompositeIterator(); + List list = Arrays.asList(new String[] { "0", "1" }); + Iterator iterator = list.iterator(); + CompositeIterator it = new CompositeIterator(); it.add(iterator); it.add(list.iterator()); try { diff --git a/spring-core/src/test/java/org/springframework/util/DigestUtilsTests.java b/spring-core/src/test/java/org/springframework/util/DigestUtilsTests.java index 7233ad381c79..681e61ae1b43 100644 --- a/spring-core/src/test/java/org/springframework/util/DigestUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/DigestUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,4 +53,4 @@ public void md5StringBuilder() throws UnsupportedEncodingException { } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java b/spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java index f15b52ffc4d6..5eaa203ef5a6 100644 --- a/spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/FileSystemUtilsTests.java @@ -24,51 +24,51 @@ * @author Rob Harrop */ public class FileSystemUtilsTests extends TestCase { - + public void testDeleteRecursively() throws Exception { File root = new File("./tmp/root"); File child = new File(root, "child"); File grandchild = new File(child, "grandchild"); - + grandchild.mkdirs(); - + File bar = new File(child, "bar.txt"); bar.createNewFile(); - + assertTrue(root.exists()); assertTrue(child.exists()); assertTrue(grandchild.exists()); assertTrue(bar.exists()); - + FileSystemUtils.deleteRecursively(root); - + assertFalse(root.exists()); assertFalse(child.exists()); assertFalse(grandchild.exists()); assertFalse(bar.exists()); } - + public void testCopyRecursively() throws Exception { File src = new File("./tmp/src"); File child = new File(src, "child"); File grandchild = new File(child, "grandchild"); - + grandchild.mkdirs(); - + File bar = new File(child, "bar.txt"); bar.createNewFile(); - + assertTrue(src.exists()); assertTrue(child.exists()); assertTrue(grandchild.exists()); assertTrue(bar.exists()); - + File dest = new File("./dest"); FileSystemUtils.copyRecursively(src, dest); - + assertTrue(dest.exists()); assertTrue(new File(dest, child.getName()).exists()); - + FileSystemUtils.deleteRecursively(src); assertTrue(!src.exists()); } diff --git a/spring-core/src/test/java/org/springframework/util/LinkedMultiValueMapTests.java b/spring-core/src/test/java/org/springframework/util/LinkedMultiValueMapTests.java index 7e274557f9e9..c134f38502e9 100644 --- a/spring-core/src/test/java/org/springframework/util/LinkedMultiValueMapTests.java +++ b/spring-core/src/test/java/org/springframework/util/LinkedMultiValueMapTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java b/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java index 1b75fd96e9d8..90d40d7b5d6c 100644 --- a/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java +++ b/spring-core/src/test/java/org/springframework/util/Log4jConfigurerTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java b/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java index 955d788c7462..6c030d46fbe3 100644 --- a/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java +++ b/spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,14 +43,14 @@ public void testPlainMethodInvoker() throws Exception { mi = new MethodInvoker(); mi.setTargetClass(TestClass1.class); mi.setTargetMethod("supertypes"); - mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello"}); + mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello"}); mi.prepare(); assertEquals("hello", mi.invoke()); mi = new MethodInvoker(); mi.setTargetClass(TestClass1.class); mi.setTargetMethod("supertypes2"); - mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", "bogus"}); + mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", "bogus"}); mi.prepare(); assertEquals("hello", mi.invoke()); @@ -58,7 +58,7 @@ public void testPlainMethodInvoker() throws Exception { mi = new MethodInvoker(); mi.setTargetClass(TestClass1.class); mi.setTargetMethod("supertypes2"); - mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", Boolean.TRUE}); + mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", Boolean.TRUE}); try { mi.prepare(); fail("Shouldn't have matched without argument conversion"); @@ -169,23 +169,23 @@ public static void intArgument(int arg) { public static void intArguments(int[] arg) { } - public static String supertypes(Collection c, Integer i) { + public static String supertypes(Collection c, Integer i) { return i.toString(); } - public static String supertypes(Collection c, List l, String s) { + public static String supertypes(Collection c, List l, String s) { return s; } - public static String supertypes2(Collection c, List l, Integer i) { + public static String supertypes2(Collection c, List l, Integer i) { return i.toString(); } - public static String supertypes2(Collection c, List l, String s, Integer i) { + public static String supertypes2(Collection c, List l, String s, Integer i) { return s; } - public static String supertypes2(Collection c, List l, String s, String s2) { + public static String supertypes2(Collection c, List l, String s, String s2) { return s; } } @@ -209,6 +209,7 @@ String greet(Customer customer) { } // should handle Regular (exact) and VIP (closest match) + @SuppressWarnings("unused") private String greet(Regular regular) { return "regular: " + regular.getGreeting(); } diff --git a/spring-core/src/test/java/org/springframework/util/MockLog4jAppender.java b/spring-core/src/test/java/org/springframework/util/MockLog4jAppender.java index 18bc8b2d5b21..4b7dde4c47f9 100644 --- a/spring-core/src/test/java/org/springframework/util/MockLog4jAppender.java +++ b/spring-core/src/test/java/org/springframework/util/MockLog4jAppender.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,11 +26,11 @@ * @author Alef Arendsen */ public class MockLog4jAppender extends AppenderSkeleton { - - public static final List loggingStrings = new ArrayList(); - + + public static final List loggingStrings = new ArrayList(); + public static boolean closeCalled = false; - + /* (non-Javadoc) * @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent) */ @@ -38,7 +38,7 @@ protected void append(LoggingEvent evt) { //System.out.println("Adding " + evt.getMessage()); loggingStrings.add(evt.getMessage()); } - + /* (non-Javadoc) * @see org.apache.log4j.Appender#close() */ @@ -49,11 +49,11 @@ public void close() { /* (non-Javadoc) * @see org.apache.log4j.Appender#requiresLayout() */ - public boolean requiresLayout() { + public boolean requiresLayout() { return false; } - - + + } diff --git a/spring-core/src/test/java/org/springframework/util/PropertyPlaceholderHelperTests.java b/spring-core/src/test/java/org/springframework/util/PropertyPlaceholderHelperTests.java index 58f8f14af35a..d353cb9e0a9b 100644 --- a/spring-core/src/test/java/org/springframework/util/PropertyPlaceholderHelperTests.java +++ b/spring-core/src/test/java/org/springframework/util/PropertyPlaceholderHelperTests.java @@ -98,7 +98,7 @@ public void testUnresolvedPlaceholderIsIgnored() { String text = "foo=${foo},bar=${bar}"; Properties props = new Properties(); props.setProperty("foo", "bar"); - + assertEquals("foo=bar,bar=${bar}", this.helper.replacePlaceholders(text, props)); } diff --git a/spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java index bdffe7578da9..3b0eac21310e 100644 --- a/spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java +++ b/spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java @@ -27,13 +27,13 @@ * @author Rod Johnson */ public class SerializationTestUtils extends TestCase { - + public static void testSerialization(Object o) throws IOException { OutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); } - + public static boolean isSerializable(Object o) throws IOException { try { testSerialization(o); @@ -43,7 +43,7 @@ public static boolean isSerializable(Object o) throws IOException { return false; } } - + public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); @@ -51,24 +51,24 @@ public static Object serializeAndDeserialize(Object o) throws IOException, Class oos.flush(); baos.flush(); byte[] bytes = baos.toByteArray(); - + ByteArrayInputStream is = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(is); Object o2 = ois.readObject(); - + return o2; } - + public SerializationTestUtils(String s) { super(s); } - + public void testWithNonSerializableObject() throws IOException { TestBean o = new TestBean(); assertFalse(o instanceof Serializable); - + assertFalse(isSerializable(o)); - + try { testSerialization(o); fail(); @@ -77,17 +77,18 @@ public void testWithNonSerializableObject() throws IOException { // Ok } } - + + @SuppressWarnings("cast") public void testWithSerializableObject() throws Exception { int x = 5; int y = 10; Point p = new Point(x, y); assertTrue(p instanceof Serializable); - + testSerialization(p); - + assertTrue(isSerializable(p)); - + Point p2 = (Point) serializeAndDeserialize(p); assertNotSame(p, p2); assertEquals(x, (int) p2.getX()); diff --git a/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java b/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java index 46a1287f5c72..5b9c43c10ef5 100644 --- a/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Test for static utility to help with serialization. - * + * * @author Dave Syer * @since 3.0.5 */ diff --git a/spring-core/src/test/java/org/springframework/util/StopWatchTests.java b/spring-core/src/test/java/org/springframework/util/StopWatchTests.java index a066318ebf8f..eb0cea75d28f 100644 --- a/spring-core/src/test/java/org/springframework/util/StopWatchTests.java +++ b/spring-core/src/test/java/org/springframework/util/StopWatchTests.java @@ -1,13 +1,13 @@ - + /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,17 +33,17 @@ public void testValidUsage() throws Exception { long int2 = 45L; String name1 = "Task 1"; String name2 = "Task 2"; - - long fudgeFactor = 5L; + assertFalse(sw.isRunning()); sw.start(name1); Thread.sleep(int1); assertTrue(sw.isRunning()); sw.stop(); - + // TODO are timings off in JUnit? Why do these assertions sometimes fail + // long fudgeFactor = 5L; // under both Ant and Eclipse? - + //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor); sw.start(name2); @@ -51,19 +51,19 @@ public void testValidUsage() throws Exception { sw.stop(); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1 + int2); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + int2 + fudgeFactor); - + assertTrue(sw.getTaskCount() == 2); String pp = sw.prettyPrint(); assertTrue(pp.indexOf(name1) != -1); assertTrue(pp.indexOf(name2) != -1); - + StopWatch.TaskInfo[] tasks = sw.getTaskInfo(); assertTrue(tasks.length == 2); assertTrue(tasks[0].getTaskName().equals(name1)); assertTrue(tasks[1].getTaskName().equals(name2)); sw.toString(); } - + public void testValidUsageNotKeepingTaskList() throws Exception { StopWatch sw = new StopWatch(); sw.setKeepTaskList(false); @@ -71,17 +71,17 @@ public void testValidUsageNotKeepingTaskList() throws Exception { long int2 = 45L; String name1 = "Task 1"; String name2 = "Task 2"; - - long fudgeFactor = 5L; + assertFalse(sw.isRunning()); sw.start(name1); Thread.sleep(int1); assertTrue(sw.isRunning()); sw.stop(); - + // TODO are timings off in JUnit? Why do these assertions sometimes fail + //long fudgeFactor = 5L; // under both Ant and Eclipse? - + //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor); sw.start(name2); @@ -89,12 +89,12 @@ public void testValidUsageNotKeepingTaskList() throws Exception { sw.stop(); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1 + int2); //assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + int2 + fudgeFactor); - + assertTrue(sw.getTaskCount() == 2); String pp = sw.prettyPrint(); assertTrue(pp.indexOf("kept") != -1); sw.toString(); - + try { sw.getTaskInfo(); fail(); @@ -103,7 +103,7 @@ public void testValidUsageNotKeepingTaskList() throws Exception { // Ok } } - + public void testFailureToStartBeforeGettingTimings() { StopWatch sw = new StopWatch(); try { @@ -114,7 +114,7 @@ public void testFailureToStartBeforeGettingTimings() { // Ok } } - + public void testFailureToStartBeforeStop() { StopWatch sw = new StopWatch(); try { @@ -125,7 +125,7 @@ public void testFailureToStartBeforeStop() { // Ok } } - + public void testRejectsStartTwice() { StopWatch sw = new StopWatch(); try { diff --git a/spring-core/src/test/java/org/springframework/util/SystemPropertyUtilsTests.java b/spring-core/src/test/java/org/springframework/util/SystemPropertyUtilsTests.java index d1fb6f8ffa0e..14ada4c541d1 100644 --- a/spring-core/src/test/java/org/springframework/util/SystemPropertyUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/SystemPropertyUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxContentHandlerTestCase.java b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxContentHandlerTestCase.java index 9cab8c0d3fd7..074fbcbeb633 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxContentHandlerTestCase.java +++ b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxContentHandlerTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java index 83f8221a044a..b9504586f3e9 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java +++ b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import org.easymock.AbstractMatcher; import org.easymock.MockControl; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; diff --git a/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTest.java b/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTest.java index 40ee7e6a68ce..50ed835fd808 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTest.java +++ b/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,4 +92,4 @@ public void contentHandlerElement() throws Exception { assertXMLEqual("Invalid result", expected, result); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/xml/SimpleNamespaceContextTests.java b/spring-core/src/test/java/org/springframework/util/xml/SimpleNamespaceContextTests.java index 64f7de882315..78cf81041ae0 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/SimpleNamespaceContextTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/SimpleNamespaceContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,32 +74,32 @@ public void getPrefixes() { public void multiplePrefixes() { context.bindNamespaceUri("prefix1", "namespace"); context.bindNamespaceUri("prefix2", "namespace"); - Iterator iterator = context.getPrefixes("namespace"); + Iterator iterator = context.getPrefixes("namespace"); assertNotNull("getPrefixes returns null", iterator); assertTrue("iterator is empty", iterator.hasNext()); - String result = (String) iterator.next(); + String result = iterator.next(); assertTrue("Invalid prefix", result.equals("prefix1") || result.equals("prefix2")); assertTrue("iterator is empty", iterator.hasNext()); - result = (String) iterator.next(); + result = iterator.next(); assertTrue("Invalid prefix", result.equals("prefix1") || result.equals("prefix2")); assertFalse("iterator contains more than two values", iterator.hasNext()); } private void assertPrefixes(String namespaceUri, String prefix) { - Iterator iterator = context.getPrefixes(namespaceUri); + Iterator iterator = context.getPrefixes(namespaceUri); assertNotNull("getPrefixes returns null", iterator); assertTrue("iterator is empty", iterator.hasNext()); - String result = (String) iterator.next(); + String result = iterator.next(); assertEquals("Invalid prefix", prefix, result); assertFalse("iterator contains multiple values", iterator.hasNext()); } @Test public void getBoundPrefixes() throws Exception { - Iterator iterator = context.getBoundPrefixes(); + Iterator iterator = context.getBoundPrefixes(); assertNotNull("getPrefixes returns null", iterator); assertTrue("iterator is empty", iterator.hasNext()); - String result = (String) iterator.next(); + String result = iterator.next(); assertEquals("Invalid prefix", "prefix", result); assertFalse("iterator contains multiple values", iterator.hasNext()); } diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxEventContentHandlerTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxEventContentHandlerTests.java index da1657b8914a..d5f3ed156c3c 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxEventContentHandlerTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxEventContentHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,4 +27,4 @@ protected AbstractStaxContentHandler createStaxContentHandler(Writer writer) thr XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); return new StaxEventContentHandler(outputFactory.createXMLEventWriter(writer)); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxEventXMLReaderTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxEventXMLReaderTests.java index f13cf00318fb..8d1e6e2ca69c 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxEventXMLReaderTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxEventXMLReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java index ecd6a26ea880..5747d814aa6e 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,4 +74,4 @@ public void eventWriterSource() throws Exception { assertXMLEqual("Invalid result", XML, stringWriter.toString()); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java index a2b668fa6d36..66b2ca197203 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,4 +101,4 @@ public void eventReaderSourceToDOMResult() throws Exception { transformer.transform(source, new DOMResult(result)); assertXMLEqual("Invalid result", expected, result); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxStreamContentHandlerTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxStreamContentHandlerTests.java index f39f0bff1105..bba1be30b8cf 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxStreamContentHandlerTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxStreamContentHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,4 +27,4 @@ protected AbstractStaxContentHandler createStaxContentHandler(Writer writer) thr XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); return new StaxStreamContentHandler(outputFactory.createXMLStreamWriter(writer)); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxStreamXMLReaderTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxStreamXMLReaderTests.java index f9a00625d048..e0814800f296 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxStreamXMLReaderTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxStreamXMLReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxUtilsTest.java b/spring-core/src/test/java/org/springframework/util/xml/StaxUtilsTest.java index abe115282473..859b50522f89 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxUtilsTest.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/xml/TransformerUtilsTests.java b/spring-core/src/test/java/org/springframework/util/xml/TransformerUtilsTests.java index 21eb30b72b73..ba61ef6b132e 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/TransformerUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/TransformerUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java index 6e752b9d2e75..ad081b98bbe2 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,4 +60,4 @@ public void readCorrect() throws Exception { assertXMLEqual(XML, writer.toString()); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java index 1cf4bf3c0a0f..00fb47bddb7a 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java @@ -42,7 +42,7 @@ public void createStreamReader() throws Exception { XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(stringWriter); streamWriter = new XMLEventStreamWriter(eventWriter, XMLEventFactory.newInstance()); } - + @Test public void write() throws Exception { streamWriter.writeStartDocument(); diff --git a/spring-expression/src/main/java/org/springframework/expression/AccessException.java b/spring-expression/src/main/java/org/springframework/expression/AccessException.java index d0b41aab6dd0..09efbbe45d57 100644 --- a/spring-expression/src/main/java/org/springframework/expression/AccessException.java +++ b/spring-expression/src/main/java/org/springframework/expression/AccessException.java @@ -18,7 +18,7 @@ /** * An AccessException is thrown by an accessor if it has an unexpected problem. - * + * * @author Andy Clement * @since 3.0 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/BeanResolver.java b/spring-expression/src/main/java/org/springframework/expression/BeanResolver.java index c3857d8e98d9..2b5e33d594c1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/BeanResolver.java +++ b/spring-expression/src/main/java/org/springframework/expression/BeanResolver.java @@ -35,4 +35,3 @@ public interface BeanResolver { Object resolve(EvaluationContext context, String beanName) throws AccessException; } - \ No newline at end of file diff --git a/spring-expression/src/main/java/org/springframework/expression/ConstructorExecutor.java b/spring-expression/src/main/java/org/springframework/expression/ConstructorExecutor.java index 34bda66d9e42..260f93e4d819 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ConstructorExecutor.java +++ b/spring-expression/src/main/java/org/springframework/expression/ConstructorExecutor.java @@ -23,10 +23,10 @@ * back to the resolvers. For example, the particular constructor to run on a class may be discovered by the reflection * constructor resolver - it will then build a ConstructorExecutor that executes that constructor and the * ConstructorExecutor can be reused without needing to go back to the resolver to discover the constructor again. - * + * * They can become stale, and in that case should throw an AccessException - this will cause the infrastructure to go * back to the resolvers to ask for a new one. - * + * * @author Andy Clement * @since 3.0 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/EvaluationException.java b/spring-expression/src/main/java/org/springframework/expression/EvaluationException.java index 995c65d0d3a3..8b3224aed06b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/EvaluationException.java +++ b/spring-expression/src/main/java/org/springframework/expression/EvaluationException.java @@ -18,7 +18,7 @@ /** * Represent an exception that occurs during expression evaluation. - * + * * @author Andy Clement * @since 3.0 */ @@ -28,7 +28,7 @@ public class EvaluationException extends ExpressionException { * Creates a new expression evaluation exception. * @param position the position in the expression where the problem occurred * @param message description of the problem that occurred - */ + */ public EvaluationException(int position, String message) { super(position, message); } @@ -37,7 +37,7 @@ public EvaluationException(int position, String message) { * Creates a new expression evaluation exception. * @param expressionString the expression that could not be evaluated * @param message description of the problem that occurred - */ + */ public EvaluationException(String expressionString, String message) { super(expressionString, message); } @@ -47,7 +47,7 @@ public EvaluationException(String expressionString, String message) { * @param position the position in the expression where the problem occurred * @param message description of the problem that occurred * @param cause the underlying cause of this exception - */ + */ public EvaluationException(int position, String message, Throwable cause) { super(position, message, cause); } @@ -55,7 +55,7 @@ public EvaluationException(int position, String message, Throwable cause) { /** * Creates a new expression evaluation exception. * @param message description of the problem that occurred - */ + */ public EvaluationException(String message) { super(message); } @@ -64,4 +64,4 @@ public EvaluationException(String message, Throwable cause) { super(message,cause); } -} \ No newline at end of file +} diff --git a/spring-expression/src/main/java/org/springframework/expression/Expression.java b/spring-expression/src/main/java/org/springframework/expression/Expression.java index e0cddfa68a68..261310b23bb3 100644 --- a/spring-expression/src/main/java/org/springframework/expression/Expression.java +++ b/spring-expression/src/main/java/org/springframework/expression/Expression.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,14 +37,14 @@ public interface Expression { */ Object getValue() throws EvaluationException; - /** + /** * Evaluate this expression against the specified root object * @param rootObject the root object against which properties/etc will be resolved * @return the evaluation result * @throws EvaluationException if there is a problem during evaluation */ Object getValue(Object rootObject) throws EvaluationException; - + /** * Evaluate the expression in the default context. If the result of the evaluation does not match (and * cannot be converted to) the expected result type then an exception will be returned. @@ -53,10 +53,10 @@ public interface Expression { * @throws EvaluationException if there is a problem during evaluation */ T getValue(Class desiredResultType) throws EvaluationException; - + /** - * Evaluate the expression in the default context against the specified root object. If the - * result of the evaluation does not match (and cannot be converted to) the expected result type + * Evaluate the expression in the default context against the specified root object. If the + * result of the evaluation does not match (and cannot be converted to) the expected result type * then an exception will be returned. * @param rootObject the root object against which properties/etc will be resolved * @param desiredResultType the class the caller would like the result to be @@ -82,7 +82,7 @@ public interface Expression { * @throws EvaluationException if there is a problem during evaluation */ Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException; - + /** * Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc - * the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it @@ -113,7 +113,7 @@ public interface Expression { * @return the most general type of value that can be set on this context * @throws EvaluationException if there is a problem determining the type */ - Class getValueType() throws EvaluationException; + Class getValueType() throws EvaluationException; /** * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} @@ -122,7 +122,7 @@ public interface Expression { * @return the most general type of value that can be set on this context * @throws EvaluationException if there is a problem determining the type */ - Class getValueType(Object rootObject) throws EvaluationException; + Class getValueType(Object rootObject) throws EvaluationException; /** * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} @@ -131,8 +131,8 @@ public interface Expression { * @return the most general type of value that can be set on this context * @throws EvaluationException if there is a problem determining the type */ - Class getValueType(EvaluationContext context) throws EvaluationException; - + Class getValueType(EvaluationContext context) throws EvaluationException; + /** * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} * method for the given context. The supplied root object overrides any specified in the context. @@ -141,7 +141,7 @@ public interface Expression { * @return the most general type of value that can be set on this context * @throws EvaluationException if there is a problem determining the type */ - Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException; + Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException; /** * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} @@ -150,7 +150,7 @@ public interface Expression { * @throws EvaluationException if there is a problem determining the type */ TypeDescriptor getValueTypeDescriptor() throws EvaluationException; - + /** * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} * method using the default context. @@ -207,13 +207,13 @@ public interface Expression { /** * Set this expression in the provided context to the value provided. - * + * * @param context the context in which to set the value of the expression * @param value the new value * @throws EvaluationException if there is a problem during evaluation */ void setValue(EvaluationContext context, Object value) throws EvaluationException; - + /** * Set this expression in the provided context to the value provided. * @param rootObject the root object against which to evaluate the expression @@ -231,7 +231,7 @@ public interface Expression { * @throws EvaluationException if there is a problem during evaluation */ void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException; - + /** * Returns the original string used to create this expression, unmodified. * @return the original expression string diff --git a/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java b/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java index b02852ddc0fc..c04d03ae28d5 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java +++ b/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java @@ -38,7 +38,7 @@ public ExpressionException(String expressionString, String message) { this.position = -1; this.expressionString = expressionString; } - + /** * Creates a new expression exception. * @param expressionString the expression string @@ -66,7 +66,7 @@ public ExpressionException(int position, String message) { * @param position the position in the expression string where the problem occurred * @param message a descriptive message * @param cause the underlying cause of this exception - */ + */ public ExpressionException(int position, String message, Throwable cause) { super(message,cause); this.position = position; @@ -75,7 +75,7 @@ public ExpressionException(int position, String message, Throwable cause) { /** * Creates a new expression exception. * @param message a descriptive message - */ + */ public ExpressionException(String message) { super(message); } @@ -99,11 +99,11 @@ public String toDetailedString() { output.append(getMessage()); return output.toString(); } - + public final String getExpressionString() { return this.expressionString; } - + public final int getPosition() { return position; } diff --git a/spring-expression/src/main/java/org/springframework/expression/ExpressionInvocationTargetException.java b/spring-expression/src/main/java/org/springframework/expression/ExpressionInvocationTargetException.java index 6668fff4150f..00caf12c4f28 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ExpressionInvocationTargetException.java +++ b/spring-expression/src/main/java/org/springframework/expression/ExpressionInvocationTargetException.java @@ -20,7 +20,7 @@ * It differs from a SpelEvaluationException because this indicates the occurrence of a checked exception * that the invoked method was defined to throw. SpelEvaluationExceptions are for handling (and wrapping) * unexpected exceptions. - * + * * @author Andy Clement * @since 3.0.3 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/MethodFilter.java b/spring-expression/src/main/java/org/springframework/expression/MethodFilter.java index b2567425d426..d04a2779b3c9 100644 --- a/spring-expression/src/main/java/org/springframework/expression/MethodFilter.java +++ b/spring-expression/src/main/java/org/springframework/expression/MethodFilter.java @@ -21,26 +21,26 @@ /** * MethodFilter instances allow SpEL users to fine tune the behaviour of the method resolution * process. Method resolution (which translates from a method name in an expression to a real - * method to invoke) will normally retrieve candidate methods for invocation via a simple call - * to 'Class.getMethods()' and will choose the first one that is suitable for the - * input parameters. By registering a MethodFilter the user can receive a callback + * method to invoke) will normally retrieve candidate methods for invocation via a simple call + * to 'Class.getMethods()' and will choose the first one that is suitable for the + * input parameters. By registering a MethodFilter the user can receive a callback * and change the methods that will be considered suitable. - * + * * @author Andy Clement * @since 3.0.1 */ public interface MethodFilter { /** - * Called by the method resolver to allow the SpEL user to organize the list of candidate - * methods that may be invoked. The filter can remove methods that should not be - * considered candidates and it may sort the results. The resolver will then search - * through the methods as returned from the filter when looking for a suitable + * Called by the method resolver to allow the SpEL user to organize the list of candidate + * methods that may be invoked. The filter can remove methods that should not be + * considered candidates and it may sort the results. The resolver will then search + * through the methods as returned from the filter when looking for a suitable * candidate to invoke. - * + * * @param methods the full list of methods the resolver was going to choose from * @return a possible subset of input methods that may be sorted by order of relevance */ List filter(List methods); - -} \ No newline at end of file + +} diff --git a/spring-expression/src/main/java/org/springframework/expression/Operation.java b/spring-expression/src/main/java/org/springframework/expression/Operation.java index 55055a5b4fe3..27239c862e2f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/Operation.java +++ b/spring-expression/src/main/java/org/springframework/expression/Operation.java @@ -18,7 +18,7 @@ /** * Supported operations that an {@link OperatorOverloader} can implement for any pair of operands. - * + * * @author Andy Clement * @since 3.0 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/OperatorOverloader.java b/spring-expression/src/main/java/org/springframework/expression/OperatorOverloader.java index 0dd7bd2e6c9a..ff4a2f7eafd1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/OperatorOverloader.java +++ b/spring-expression/src/main/java/org/springframework/expression/OperatorOverloader.java @@ -19,7 +19,7 @@ /** * By default the mathematical operators {@link Operation} support simple types like numbers. By providing an * implementation of OperatorOverloader, a user of the expression language can support these operations on other types. - * + * * @author Andy Clement * @since 3.0 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/ParseException.java b/spring-expression/src/main/java/org/springframework/expression/ParseException.java index cb0ff8ae882c..722eb4d88e63 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ParseException.java +++ b/spring-expression/src/main/java/org/springframework/expression/ParseException.java @@ -29,7 +29,7 @@ public class ParseException extends ExpressionException { * @param expressionString the expression string that could not be parsed * @param position the position in the expression string where the problem occurred * @param message description of the problem that occurred - */ + */ public ParseException(String expressionString, int position, String message) { super(expressionString, position, message); } @@ -39,16 +39,16 @@ public ParseException(String expressionString, int position, String message) { * @param position the position in the expression string where the problem occurred * @param message description of the problem that occurred * @param cause the underlying cause of this exception - */ + */ public ParseException(int position, String message, Throwable cause) { super(position, message, cause); } - + /** * Creates a new expression parsing exception. * @param position the position in the expression string where the problem occurred * @param message description of the problem that occurred - */ + */ public ParseException(int position, String message) { super(position, message); } diff --git a/spring-expression/src/main/java/org/springframework/expression/ParserContext.java b/spring-expression/src/main/java/org/springframework/expression/ParserContext.java index 2a32bb3dde13..a462c3531249 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ParserContext.java +++ b/spring-expression/src/main/java/org/springframework/expression/ParserContext.java @@ -28,13 +28,13 @@ public interface ParserContext { /** * Whether or not the expression being parsed is a template. A template expression consists of literal text that can * be mixed with evaluatable blocks. Some examples: - * + * *
     	 * 	   Some literal text
     	 *     Hello #{name.firstName}!
     	 *     #{3 + 4}
     	 * 
    - * + * * @return true if the expression is a template, false otherwise */ boolean isTemplate(); @@ -54,7 +54,7 @@ public interface ParserContext { * @return the suffix that identifies the end of an expression */ String getExpressionSuffix(); - + /** * The default ParserContext implementation that enables template expression parsing mode. * The expression prefix is #{ and the expression suffix is }. @@ -73,7 +73,7 @@ public String getExpressionSuffix() { public boolean isTemplate() { return true; } - + }; } diff --git a/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java b/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java index c5f474e3cace..160a7de9be78 100644 --- a/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/PropertyAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ * to determine if it can read or write them. Property resolvers are considered to be ordered and each will be called in * turn. The only rule that affects the call order is that any naming the target class directly in * getSpecifiedTargetClasses() will be called first, before the general resolvers. - * + * * @author Andy Clement * @since 3.0 */ @@ -36,7 +36,7 @@ public interface PropertyAccessor { * resolver that can be called in an attempt to resolve a property on any type. * @return an array of classes that this resolver is suitable for (or null if a general resolver) */ - Class[] getSpecificTargetClasses(); + Class[] getSpecificTargetClasses(); /** * Called to determine if a resolver instance is able to access a specified property on a specified target object. diff --git a/spring-expression/src/main/java/org/springframework/expression/TypeComparator.java b/spring-expression/src/main/java/org/springframework/expression/TypeComparator.java index 117ac772ab1c..6b0f61e8ce2f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/TypeComparator.java +++ b/spring-expression/src/main/java/org/springframework/expression/TypeComparator.java @@ -19,7 +19,7 @@ /** * Instances of a type comparator should be able to compare pairs of objects for equality, the specification of the * return value is the same as for {@link Comparable}. - * + * * @author Andy Clement * @since 3.0 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/TypedValue.java b/spring-expression/src/main/java/org/springframework/expression/TypedValue.java index ec063ff54c69..c9db4a8f041c 100644 --- a/spring-expression/src/main/java/org/springframework/expression/TypedValue.java +++ b/spring-expression/src/main/java/org/springframework/expression/TypedValue.java @@ -56,12 +56,12 @@ public TypedValue(Object value, TypeDescriptor typeDescriptor) { this.value = value; this.typeDescriptor = typeDescriptor; } - + public Object getValue() { return this.value; } - + public TypeDescriptor getTypeDescriptor() { if (this.typeDescriptor == null) { this.typeDescriptor = TypeDescriptor.forObject(this.value); @@ -76,5 +76,5 @@ public String toString() { str.append("TypedValue: '").append(this.value).append("' of [").append(getTypeDescriptor() + "]"); return str.toString(); } - + } diff --git a/spring-expression/src/main/java/org/springframework/expression/common/CompositeStringExpression.java b/spring-expression/src/main/java/org/springframework/expression/common/CompositeStringExpression.java index 04fc1a561ece..59609118b17f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/common/CompositeStringExpression.java +++ b/spring-expression/src/main/java/org/springframework/expression/common/CompositeStringExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ * which will be represented as a CompositeStringExpression of two parts. The first part being a * LiteralExpression representing 'Hello ' and the second part being a real expression that will * call getName() when invoked. - * + * * @author Andy Clement * @author Juergen Hoeller * @since 3.0 @@ -60,7 +60,7 @@ public String getValue() throws EvaluationException { String value = expression.getValue(String.class); if (value != null) { sb.append(value); - } + } } return sb.toString(); } @@ -71,7 +71,7 @@ public String getValue(Object rootObject) throws EvaluationException { String value = expression.getValue(rootObject, String.class); if (value != null) { sb.append(value); - } + } } return sb.toString(); } @@ -93,16 +93,16 @@ public String getValue(EvaluationContext context, Object rootObject) throws Eval String value = expression.getValue(context, rootObject, String.class); if (value != null) { sb.append(value); - } + } } return sb.toString(); } - public Class getValueType(EvaluationContext context) { + public Class getValueType(EvaluationContext context) { return String.class; } - public Class getValueType() { + public Class getValueType() { return String.class; } @@ -131,7 +131,7 @@ public T getValue(Class expectedResultType) throws EvaluationException { public boolean isWritable(EvaluationContext context) { return false; } - + public Expression[] getExpressions() { return expressions; } @@ -148,11 +148,11 @@ public T getValue(EvaluationContext context, Object rootObject, Class des return ExpressionUtils.convert(context, value, desiredResultType); } - public Class getValueType(Object rootObject) throws EvaluationException { + public Class getValueType(Object rootObject) throws EvaluationException { return String.class; } - public Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException { + public Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException { return String.class; } diff --git a/spring-expression/src/main/java/org/springframework/expression/common/LiteralExpression.java b/spring-expression/src/main/java/org/springframework/expression/common/LiteralExpression.java index 43d61bedfb74..381d222334a1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/common/LiteralExpression.java +++ b/spring-expression/src/main/java/org/springframework/expression/common/LiteralExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,12 +52,12 @@ public String getValue() { public String getValue(EvaluationContext context) { return this.literalValue; } - + public String getValue(Object rootObject) { return this.literalValue; } - public Class getValueType(EvaluationContext context) { + public Class getValueType(EvaluationContext context) { return String.class; } @@ -87,7 +87,7 @@ public boolean isWritable(EvaluationContext context) { return false; } - public Class getValueType() { + public Class getValueType() { return String.class; } @@ -105,11 +105,11 @@ public T getValue(EvaluationContext context, Object rootObject, Class des return ExpressionUtils.convert(null, value, desiredResultType); } - public Class getValueType(Object rootObject) throws EvaluationException { + public Class getValueType(Object rootObject) throws EvaluationException { return String.class; } - public Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException { + public Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException { return String.class; } diff --git a/spring-expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java b/spring-expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java index c1ed129dec36..5df9c134fe1b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java +++ b/spring-expression/src/main/java/org/springframework/expression/common/TemplateParserContext.java @@ -38,7 +38,7 @@ public class TemplateParserContext implements ParserContext { public TemplateParserContext() { this("#{", "}"); } - + /** * Create a new TemplateParserContext for the given prefix and suffix. * @param expressionPrefix the expression prefix to use diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ExpressionState.java b/spring-expression/src/main/java/org/springframework/expression/spel/ExpressionState.java index 47ee693d8262..c28e2ecbbcd0 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ExpressionState.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ExpressionState.java @@ -36,22 +36,22 @@ * expressions but it gives a place to hold local variables and for component expressions in a compound expression to * communicate state. This is in contrast to the EvaluationContext, which is shared amongst expression evaluations, and * any changes to it will be seen by other expressions or any code that chooses to ask questions of the context. - * + * *

    It also acts as a place for to define common utility routines that the various Ast nodes might need. - * + * * @author Andy Clement * @since 3.0 */ public class ExpressionState { private final EvaluationContext relatedContext; - - private Stack variableScopes; + + private Stack variableScopes; private Stack contextObjects; - + private final TypedValue rootObject; - + private SpelParserConfiguration configuration; @@ -59,30 +59,30 @@ public ExpressionState(EvaluationContext context) { this.relatedContext = context; this.rootObject = context.getRootObject(); } - + public ExpressionState(EvaluationContext context, SpelParserConfiguration configuration) { this.relatedContext = context; this.configuration = configuration; this.rootObject = context.getRootObject(); } - + public ExpressionState(EvaluationContext context, TypedValue rootObject) { this.relatedContext = context; this.rootObject = rootObject; } - + public ExpressionState(EvaluationContext context, TypedValue rootObject, SpelParserConfiguration configuration) { this.relatedContext = context; this.configuration = configuration; this.rootObject = rootObject; } - + private void ensureVariableScopesInitialized() { if (this.variableScopes == null) { this.variableScopes = new Stack(); // top level empty variable scope - this.variableScopes.add(new VariableScope()); + this.variableScopes.add(new VariableScope()); } } @@ -93,7 +93,7 @@ public TypedValue getActiveContextObject() { if (this.contextObjects==null || this.contextObjects.isEmpty()) { return this.rootObject; } - + return this.contextObjects.peek(); } @@ -140,10 +140,6 @@ public Class findType(String type) throws EvaluationException { public Object convertValue(Object value, TypeDescriptor targetTypeDescriptor) throws EvaluationException { return this.relatedContext.getTypeConverter().convertValue(value, TypeDescriptor.forObject(value), targetTypeDescriptor); } - - public TypeConverter getTypeConverter() { - return this.relatedContext.getTypeConverter(); - } public Object convertValue(TypedValue value, TypeDescriptor targetTypeDescriptor) throws EvaluationException { Object val = value.getValue(); @@ -153,7 +149,7 @@ public Object convertValue(TypedValue value, TypeDescriptor targetTypeDescriptor /* * A new scope is entered when a function is invoked */ - + public void enterScope(Map argMap) { ensureVariableScopesInitialized(); this.variableScopes.push(new VariableScope(argMap)); @@ -226,7 +222,7 @@ public VariableScope(Map arguments) { this.vars.putAll(arguments); } } - + public VariableScope(String name, Object value) { this.vars.put(name,value); } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/InternalParseException.java b/spring-expression/src/main/java/org/springframework/expression/spel/InternalParseException.java index fd3dcb5549c4..c28110599e6a 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/InternalParseException.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/InternalParseException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,11 @@ package org.springframework.expression.spel; -import org.springframework.expression.spel.SpelParseException; /** * Wraps a real parse exception. This exception flows to the top parse method and then * the wrapped exception is thrown as the real problem. - * + * * @author Andy Clement * @since 3.0 */ @@ -30,9 +29,9 @@ public class InternalParseException extends RuntimeException { public InternalParseException(SpelParseException cause) { super(cause); } - + public SpelParseException getCause() { return (SpelParseException) super.getCause(); } - + } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/SpelEvaluationException.java b/spring-expression/src/main/java/org/springframework/expression/spel/SpelEvaluationException.java index e736d3bf7400..e5bb78e995bf 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/SpelEvaluationException.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/SpelEvaluationException.java @@ -21,7 +21,7 @@ * Root exception for Spring EL related exceptions. Rather than holding a hard coded string indicating the problem, it * records a message key and the inserts for the message. See {@link SpelMessage} for the list of all possible messages * that can occur. - * + * * @author Andy Clement * @since 3.0 */ @@ -37,7 +37,7 @@ public SpelEvaluationException(SpelMessage message, Object... inserts) { } public SpelEvaluationException(int position, SpelMessage message, Object... inserts) { - super(position, message.formatMessage(position, inserts)); + super(position, message.formatMessage(position, inserts)); this.message = message; this.inserts = inserts; } @@ -75,7 +75,7 @@ public SpelMessage getMessageCode() { /** * Set the position in the related expression which gave rise to this exception. - * + * * @param position the position in the expression that gave rise to the exception */ public void setPosition(int position) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java b/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java index 5ee88152eb2b..a7f457e147dd 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java @@ -24,13 +24,13 @@ * enabling the message text to more easily be modified and the tests to run successfully in different locales. *

    * When a message is formatted, it will have this kind of form - * + * *

      * EL1004E: (pos 34): Type cannot be found 'String'
      * 
    - * + * * The prefix captures the code and the error kind, whilst the position is included if it is known. - * + * * @author Andy Clement * @since 3.0 */ @@ -39,7 +39,7 @@ public enum SpelMessage { TYPE_CONVERSION_ERROR(Kind.ERROR, 1001, "Type conversion problem, cannot convert from {0} to {1}"), // CONSTRUCTOR_NOT_FOUND(Kind.ERROR, 1002, "Constructor call: No suitable constructor found on type {0} for arguments {1}"), // CONSTRUCTOR_INVOCATION_PROBLEM(Kind.ERROR, 1003, "A problem occurred whilst attempting to construct an object of type ''{0}'' using arguments ''{1}''"), // - METHOD_NOT_FOUND(Kind.ERROR, 1004, "Method call: Method {0} cannot be found on {1} type"), // + METHOD_NOT_FOUND(Kind.ERROR, 1004, "Method call: Method {0} cannot be found on {1} type"), // TYPE_NOT_FOUND(Kind.ERROR, 1005, "Type cannot be found ''{0}''"), // FUNCTION_NOT_DEFINED(Kind.ERROR, 1006, "The function ''{0}'' could not be found"), // PROPERTY_OR_FIELD_NOT_READABLE_ON_NULL(Kind.ERROR, 1007, "Field or property ''{0}'' cannot be found on null"), // @@ -47,7 +47,7 @@ public enum SpelMessage { PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL(Kind.ERROR, 1009, "Field or property ''{0}'' cannot be set on null"), // PROPERTY_OR_FIELD_NOT_WRITABLE(Kind.ERROR, 1010, "Field or property ''{0}'' cannot be set on object of type ''{1}''"), // METHOD_CALL_ON_NULL_OBJECT_NOT_ALLOWED(Kind.ERROR, 1011, "Method call: Attempted to call method {0} on null context object"), // - CANNOT_INDEX_INTO_NULL_VALUE(Kind.ERROR, 1012, "Cannot index into a null value"), + CANNOT_INDEX_INTO_NULL_VALUE(Kind.ERROR, 1012, "Cannot index into a null value"), NOT_COMPARABLE(Kind.ERROR, 1013, "Cannot compare instances of {0} and {1}"), // INCORRECT_NUMBER_OF_ARGUMENTS_TO_FUNCTION(Kind.ERROR, 1014, "Incorrect number of arguments for function, {0} supplied but function takes {1}"), // INVALID_TYPE_FOR_SELECTION(Kind.ERROR, 1015, "Cannot perform selection on input data of type ''{0}''"), // @@ -60,22 +60,22 @@ public enum SpelMessage { FUNCTION_REFERENCE_CANNOT_BE_INVOKED(Kind.ERROR, 1022, "The function ''{0}'' mapped to an object of type ''{1}'' which cannot be invoked"), // EXCEPTION_DURING_FUNCTION_CALL(Kind.ERROR, 1023, "A problem occurred whilst attempting to invoke the function ''{0}'': ''{1}''"), // ARRAY_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1024, "The array has ''{0}'' elements, index ''{1}'' is invalid"), // - COLLECTION_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1025, "The collection has ''{0}'' elements, index ''{1}'' is invalid"), // + COLLECTION_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1025, "The collection has ''{0}'' elements, index ''{1}'' is invalid"), // STRING_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1026, "The string has ''{0}'' characters, index ''{1}'' is invalid"), // INDEXING_NOT_SUPPORTED_FOR_TYPE(Kind.ERROR, 1027, "Indexing into type ''{0}'' is not supported"), // INSTANCEOF_OPERATOR_NEEDS_CLASS_OPERAND(Kind.ERROR, 1028, "The operator 'instanceof' needs the right operand to be a class, not a ''{0}''"), // - EXCEPTION_DURING_METHOD_INVOCATION(Kind.ERROR, 1029, "A problem occurred when trying to execute method ''{0}'' on object of type ''{1}'': ''{2}''"), // + EXCEPTION_DURING_METHOD_INVOCATION(Kind.ERROR, 1029, "A problem occurred when trying to execute method ''{0}'' on object of type ''{1}'': ''{2}''"), // OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES(Kind.ERROR, 1030, "The operator ''{0}'' is not supported between objects of type ''{1}'' and ''{2}''"), // - PROBLEM_LOCATING_METHOD(Kind.ERROR, 1031, "Problem locating method {0} cannot on type {1}"), + PROBLEM_LOCATING_METHOD(Kind.ERROR, 1031, "Problem locating method {0} cannot on type {1}"), SETVALUE_NOT_SUPPORTED( Kind.ERROR, 1032, "setValue(ExpressionState, Object) not supported for ''{0}''"), // MULTIPLE_POSSIBLE_METHODS(Kind.ERROR, 1033, "Method call of ''{0}'' is ambiguous, supported type conversions allow multiple variants to match"), // EXCEPTION_DURING_PROPERTY_WRITE(Kind.ERROR, 1034, "A problem occurred whilst attempting to set the property ''{0}'': {1}"), // NOT_AN_INTEGER(Kind.ERROR, 1035, "The value ''{0}'' cannot be parsed as an int"), // - NOT_A_LONG(Kind.ERROR, 1036, "The value ''{0}'' cannot be parsed as a long"), // + NOT_A_LONG(Kind.ERROR, 1036, "The value ''{0}'' cannot be parsed as a long"), // INVALID_FIRST_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1037, "First operand to matches operator must be a string. ''{0}'' is not"), // INVALID_SECOND_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1038, "Second operand to matches operator must be a string. ''{0}'' is not"), // FUNCTION_MUST_BE_STATIC(Kind.ERROR, 1039, "Only static methods can be called via function references. The method ''{0}'' referred to by name ''{1}'' is not static."),// - NOT_A_REAL(Kind.ERROR, 1040, "The value ''{0}'' cannot be parsed as a double"), // + NOT_A_REAL(Kind.ERROR, 1040, "The value ''{0}'' cannot be parsed as a double"), // MORE_INPUT(Kind.ERROR,1041, "After parsing a valid expression, there is still more data in the expression: ''{0}''"), RIGHT_OPERAND_PROBLEM(Kind.ERROR,1042, "Problem parsing right operand"), NOT_EXPECTED_TOKEN(Kind.ERROR,1043,"Unexpected token. Expected ''{0}'' but was ''{1}''"), @@ -93,7 +93,7 @@ public enum SpelMessage { UNABLE_TO_CREATE_MAP_FOR_INDEXING(Kind.ERROR,1055,"Unable to dynamically create a Map to replace a null value"),// UNABLE_TO_DYNAMICALLY_CREATE_OBJECT(Kind.ERROR,1056,"Unable to dynamically create instance of ''{0}'' to replace a null value"),// NO_BEAN_RESOLVER_REGISTERED(Kind.ERROR,1057,"No bean resolver registered in the context to resolve access to bean ''{0}''"),// - EXCEPTION_DURING_BEAN_RESOLUTION(Kind.ERROR, 1058, "A problem occurred when trying to resolve bean ''{0}'':''{1}''"), // + EXCEPTION_DURING_BEAN_RESOLUTION(Kind.ERROR, 1058, "A problem occurred when trying to resolve bean ''{0}'':''{1}''"), // INVALID_BEAN_REFERENCE(Kind.ERROR,1059,"@ can only be followed by an identifier or a quoted name"),// TYPE_NAME_EXPECTED_FOR_ARRAY_CONSTRUCTION(Kind.ERROR, 1060, "Expected the type of the new array to be specified as a String but found ''{0}''"), // @@ -125,7 +125,7 @@ private SpelMessage(Kind kind, int code, String message) { /** * Produce a complete message including the prefix, the position (if known) and with the inserts applied to the * message. - * + * * @param pos the position, if less than zero it is ignored and not included in the message * @param inserts the inserts to put into the formatted message * @return a formatted message diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/SpelParseException.java b/spring-expression/src/main/java/org/springframework/expression/spel/SpelParseException.java index 3b8c14ff130e..86499273f8a3 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/SpelParseException.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/SpelParseException.java @@ -22,7 +22,7 @@ * Root exception for Spring EL related exceptions. Rather than holding a hard coded string indicating the problem, it * records a message key and the inserts for the message. See {@link SpelMessage} for the list of all possible messages * that can occur. - * + * * @author Andy Clement * @since 3.0 */ @@ -41,7 +41,7 @@ public SpelParseException(String expressionString, int position, SpelMessage mes super(expressionString, position, message.formatMessage(position,inserts)); this.position = position; this.message = message; - this.inserts = inserts; + this.inserts = inserts; } public SpelParseException(int position, SpelMessage message, Object... inserts) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java index f3c4197377e9..900270b62eaf 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/AstUtils.java @@ -29,7 +29,7 @@ * @since 3.0.2 */ public class AstUtils { - + /** * Determines the set of property resolvers that should be used to try and access a property on the specified target * type. The resolvers are considered to be in an ordered list, however in the returned list any that are exact @@ -37,7 +37,7 @@ public class AstUtils { * the start of the list. In addition, there are specific resolvers that exactly name the class in question and * resolvers that name a specific class but it is a supertype of the class we have. These are put at the end of the * specific resolvers set and will be tried after exactly matching accessors but before generic accessors. - * + * * @param targetType the type upon which property access is being attempted * @return a list of resolvers that should be tried in order to access the property */ diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java index e7c7eb850b49..09e4a0a11443 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java @@ -26,13 +26,13 @@ /** * Represents a bean reference to a type, for example "@foo" or "@'foo.bar'" - * + * * @author Andy Clement */ public class BeanReference extends SpelNodeImpl { private String beanname; - + public BeanReference(int pos,String beanname) { super(pos); this.beanname = beanname; @@ -64,5 +64,5 @@ public String toStringAST() { } return sb.toString(); } - + } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java index 7dfec0ca331a..b632adec5e7b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java @@ -23,7 +23,7 @@ /** * Represents a DOT separated expression sequence, such as 'property1.property2.methodOne()' - * + * * @author Andy Clement * @since 3.0 */ @@ -36,6 +36,7 @@ public CompoundExpression(int pos,SpelNodeImpl... expressionComponents) { } } + @Override protected ValueRef getValueRef(ExpressionState state) throws EvaluationException { if (getChildCount()==1) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java index ceb1d401e9c0..6558498b8586 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java @@ -44,7 +44,7 @@ * new String('hello world')
    * new int[]{1,2,3,4}
    * new int[3] new int[3]{1,2,3} - * + * * @author Andy Clement * @author Juergen Hoeller * @since 3.0 @@ -137,7 +137,7 @@ private TypedValue createNewInstance(ExpressionState state) throws EvaluationExc throw new SpelEvaluationException(getStartPosition(), rootCause, SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM, typename, FormatHelper .formatMethodForMessage("", argumentTypes)); - } + } } // at this point we know it wasn't a user problem so worth a retry if a better candidate can be found diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/FormatHelper.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/FormatHelper.java index 3983c207a2e7..414580db5abe 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/FormatHelper.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/FormatHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Utility methods (formatters, etc) used during parsing and evaluation. - * + * * @author Andy Clement */ public class FormatHelper { @@ -46,7 +46,7 @@ public static String formatMethodForMessage(String name, List ar sb.append(formatClassNameForMessage(typeDescriptor.getType())); } else { - sb.append(formatClassNameForMessage(null)); + sb.append(formatClassNameForMessage(null)); } } sb.append(")"); @@ -60,13 +60,13 @@ public static String formatMethodForMessage(String name, List ar * @return a formatted string suitable for message inclusion */ public static String formatClassNameForMessage(Class clazz) { - if (clazz == null) { + if (clazz == null) { return "null"; } StringBuilder fmtd = new StringBuilder(); if (clazz.isArray()) { int dims = 1; - Class baseClass = clazz.getComponentType(); + Class baseClass = clazz.getComponentType(); while (baseClass.isArray()) { baseClass = baseClass.getComponentType(); dims++; diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java index edac92f09539..1bc897efcc69 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java @@ -74,7 +74,7 @@ public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep /** * Execute a function represented as a java.lang.reflect.Method. - * + * * @param state the expression evaluation state * @param the java method to invoke * @return the return value of the invoked Java method diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java index f0613262511e..eb84c3859472 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java @@ -44,22 +44,18 @@ // TODO support correct syntax for multidimensional [][][] and not [,,,] public class Indexer extends SpelNodeImpl { - // These fields are used when the indexer is being used as a property read accessor. - // If the name and target type match these cached values then the cachedReadAccessor - // is used to read the property. If they do not match, the correct accessor is - // discovered and then cached for later use. - + // These fields are used when the indexer is being used as a property read accessor. If the name and + // target type match these cached values then the cachedReadAccessor is used to read the property. + // If they do not match, the correct accessor is discovered and then cached for later use. private String cachedReadName; private Class cachedReadTargetType; private PropertyAccessor cachedReadAccessor; - // These fields are used when the indexer is being used as a property write accessor. - // If the name and target type match these cached values then the cachedWriteAccessor - // is used to write the property. If they do not match, the correct accessor is - // discovered and then cached for later use. - + // These fields are used when the indexer is being used as a property write accessor. If the name and + // target type match these cached values then the cachedWriteAccessor is used to write the property. + // If they do not match, the correct accessor is discovered and then cached for later use. private String cachedWriteName; private Class cachedWriteTargetType; @@ -74,40 +70,29 @@ public Indexer(int pos, SpelNodeImpl expr) { @Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { - return getValueRef(state).getValue(); - } - - @Override - public void setValue(ExpressionState state, Object newValue) throws EvaluationException { - getValueRef(state).setValue(newValue); - } - - @Override - public boolean isWritable(ExpressionState expressionState) throws SpelEvaluationException { - return true; - } - - - private class ArrayIndexingValueRef implements ValueRef { - - private final TypeConverter typeConverter; - - private final Object array; - - private final int idx; - - private final TypeDescriptor typeDescriptor; + TypedValue context = state.getActiveContextObject(); + Object targetObject = context.getValue(); + TypeDescriptor targetObjectTypeDescriptor = context.getTypeDescriptor(); + TypedValue indexValue = null; + Object index = null; - ArrayIndexingValueRef(TypeConverter typeConverter, Object array, int idx, TypeDescriptor typeDescriptor) { - this.typeConverter = typeConverter; - this.array = array; - this.idx = idx; - this.typeDescriptor = typeDescriptor; + // This first part of the if clause prevents a 'double dereference' of the property (SPR-5847) + if (targetObject instanceof Map && (children[0] instanceof PropertyOrFieldReference)) { + PropertyOrFieldReference reference = (PropertyOrFieldReference)children[0]; + index = reference.getName(); + indexValue = new TypedValue(index); } - - public TypedValue getValue() { - Object arrayElement = accessArrayElement(this.array, this.idx); - return new TypedValue(arrayElement, this.typeDescriptor.elementTypeDescriptor(arrayElement)); + else { + // In case the map key is unqualified, we want it evaluated against the root object so + // temporarily push that on whilst evaluating the key + try { + state.pushActiveContextObject(state.getRootContextObject()); + indexValue = children[0].getValueInternal(state); + index = indexValue.getValue(); + } + finally { + state.popActiveContextObject(); + } } public void setValue(Object newValue) { @@ -152,37 +137,22 @@ public void setValue(Object newValue) { this.map.put(this.key, newValue); } - public boolean isWritable() { - return true; - } - } - - - private class PropertyIndexingValueRef implements ValueRef { - - private final Object targetObject; - - private final String name; - - private final EvaluationContext eContext; - - private final TypeDescriptor td; - - public PropertyIndexingValueRef(Object targetObject, String value, EvaluationContext evaluationContext, - TypeDescriptor targetObjectTypeDescriptor) { - this.targetObject = targetObject; - this.name = value; - this.eContext = evaluationContext; - this.td = targetObjectTypeDescriptor; + if (targetObject == null) { + throw new SpelEvaluationException(getStartPosition(),SpelMessage.CANNOT_INDEX_INTO_NULL_VALUE); } - public TypedValue getValue() { - Class targetObjectRuntimeClass = getObjectClass(targetObject); - try { - if (cachedReadName != null && cachedReadName.equals(name) && cachedReadTargetType != null && - cachedReadTargetType.equals(targetObjectRuntimeClass)) { - // it is OK to use the cached accessor - return cachedReadAccessor.read(this.eContext, this.targetObject, this.name); + // if the object is something that looks indexable by an integer, attempt to treat the index value as a number + if (targetObject instanceof Collection || targetObject.getClass().isArray() || targetObject instanceof String) { + int idx = (Integer) state.convertValue(index, TypeDescriptor.valueOf(Integer.class)); + if (targetObject.getClass().isArray()) { + Object arrayElement = accessArrayElement(targetObject, idx); + return new TypedValue(arrayElement, targetObjectTypeDescriptor.elementTypeDescriptor(arrayElement)); + } else if (targetObject instanceof Collection) { + Collection c = (Collection) targetObject; + if (idx >= c.size()) { + if (!growCollection(state, targetObjectTypeDescriptor, idx, c)) { + throw new SpelEvaluationException(getStartPosition(),SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS, c.size(), idx); + } } List accessorsToTry = AstUtils.getPropertyAccessorsToTry(targetObjectRuntimeClass, eContext.getPropertyAccessors()); @@ -209,6 +179,13 @@ public TypedValue getValue() { this.td.toString()); } + // Try and treat the index value as a property of the context object + // TODO could call the conversion service to convert the value to a String + if (indexValue.getTypeDescriptor().getType()==String.class) { + Class targetObjectRuntimeClass = getObjectClass(targetObject); + String name = (String)indexValue.getValue(); + EvaluationContext eContext = state.getEvaluationContext(); + public void setValue(Object newValue) { Class contextObjectClass = getObjectClass(targetObject); try { @@ -218,8 +195,9 @@ public void setValue(Object newValue) { cachedWriteAccessor.write(this.eContext, this.targetObject, this.name, newValue); return; } - List accessorsToTry = - AstUtils.getPropertyAccessorsToTry(contextObjectClass, this.eContext.getPropertyAccessors()); + + List accessorsToTry = AstUtils.getPropertyAccessorsToTry(targetObjectRuntimeClass, state); + if (accessorsToTry != null) { for (PropertyAccessor accessor : accessorsToTry) { if (accessor.canWrite(this.eContext, this.targetObject, this.name)) { @@ -241,117 +219,16 @@ public void setValue(Object newValue) { public boolean isWritable() { return true; } - } - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - private class CollectionIndexingValueRef implements ValueRef { - - private final Collection collection; - - private final int index; - - private final TypeDescriptor collectionEntryTypeDescriptor; - - private final TypeConverter typeConverter; - - private final boolean growCollection; - - CollectionIndexingValueRef(Collection collection, int index, TypeDescriptor collectionEntryTypeDescriptor, - TypeConverter typeConverter, boolean growCollection) { - this.collection = collection; - this.index = index; - this.collectionEntryTypeDescriptor = collectionEntryTypeDescriptor; - this.typeConverter = typeConverter; - this.growCollection = growCollection; - } - - public TypedValue getValue() { - if (this.index >= this.collection.size()) { - if (this.growCollection) { - growCollection(this.collectionEntryTypeDescriptor, this.index, this.collection); - } - else { - throw new SpelEvaluationException(getStartPosition(), SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS, - this.collection.size(), this.index); - } - } - if (this.collection instanceof List) { - Object o = ((List) this.collection).get(this.index); - return new TypedValue(o, this.collectionEntryTypeDescriptor.elementTypeDescriptor(o)); - } - int pos = 0; - for (Object o : this.collection) { - if (pos == this.index) { - return new TypedValue(o, this.collectionEntryTypeDescriptor.elementTypeDescriptor(o)); - } - pos++; - } - throw new IllegalStateException("Failed to find indexed element " + this.index + ": " + this.collection); - } - public void setValue(Object newValue) { - if (this.index >= this.collection.size()) { - if (this.growCollection) { - growCollection(this.collectionEntryTypeDescriptor, this.index, this.collection); - } - else { - throw new SpelEvaluationException(getStartPosition(), SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS, - this.collection.size(), this.index); - } - } - if (this.collection instanceof List) { - List list = (List) this.collection; - if (this.collectionEntryTypeDescriptor.getElementTypeDescriptor() != null) { - newValue = this.typeConverter.convertValue(newValue, TypeDescriptor.forObject(newValue), - this.collectionEntryTypeDescriptor.getElementTypeDescriptor()); - } - list.set(this.index, newValue); - } - else { - throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, - this.collectionEntryTypeDescriptor.toString()); - } - } - - public boolean isWritable() { - return true; - } + throw new SpelEvaluationException(getStartPosition(),SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, targetObjectTypeDescriptor.toString()); } - - private class StringIndexingLValue implements ValueRef { - - private final String target; - - private final int index; - - private final TypeDescriptor td; - - public StringIndexingLValue(String target, int index, TypeDescriptor td) { - this.target = target; - this.index = index; - this.td = td; - } - - public TypedValue getValue() { - if (this.index >= this.target.length()) { - throw new SpelEvaluationException(getStartPosition(), SpelMessage.STRING_INDEX_OUT_OF_BOUNDS, - this.target.length(), index); - } - return new TypedValue(String.valueOf(this.target.charAt(this.index))); - } - - public void setValue(Object newValue) { - throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, - this.td.toString()); - } - - public boolean isWritable() { - return true; - } + @Override + public boolean isWritable(ExpressionState expressionState) throws SpelEvaluationException { + return true; } + @SuppressWarnings("unchecked") @Override protected ValueRef getValueRef(ExpressionState state) throws EvaluationException { TypedValue context = state.getActiveContextObject(); @@ -382,9 +259,13 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException // Indexing into a Map if (targetObject instanceof Map) { - Object key = index; + Map map = (Map) targetObject; + Object key = index.getValue(); if (targetObjectTypeDescriptor.getMapKeyTypeDescriptor() != null) { - key = state.convertValue(key, targetObjectTypeDescriptor.getMapKeyTypeDescriptor()); + key = state.convertValue(index, targetObjectTypeDescriptor.getMapKeyTypeDescriptor()); + } + if (targetObjectTypeDescriptor.getMapValueTypeDescriptor() != null) { + newValue = state.convertValue(newValue, targetObjectTypeDescriptor.getMapValueTypeDescriptor()); } return new MapIndexingValueRef(state.getTypeConverter(), (Map) targetObject, key, targetObjectTypeDescriptor); @@ -398,18 +279,55 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException // attempt to treat the index value as a number if (targetObject.getClass().isArray() || targetObject instanceof Collection || targetObject instanceof String) { int idx = (Integer) state.convertValue(index, TypeDescriptor.valueOf(Integer.class)); - if (targetObject.getClass().isArray()) { - return new ArrayIndexingValueRef(state.getTypeConverter(), targetObject, idx, targetObjectTypeDescriptor); + Collection c = (Collection) targetObject; + if (idx >= c.size()) { + if (!growCollection(state, targetObjectTypeDescriptor, idx, c)) { + throw new SpelEvaluationException(getStartPosition(),SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS, c.size(), idx); + } } - else if (targetObject instanceof Collection) { - return new CollectionIndexingValueRef((Collection) targetObject, idx, targetObjectTypeDescriptor, - state.getTypeConverter(), state.getConfiguration().isAutoGrowCollections()); + if (targetObject instanceof List) { + List list = (List) targetObject; + if (targetObjectTypeDescriptor.getElementTypeDescriptor() != null) { + newValue = state.convertValue(newValue, targetObjectTypeDescriptor.getElementTypeDescriptor()); + } + list.set(idx, newValue); + return; } else if (targetObject instanceof String) { return new StringIndexingLValue((String) targetObject, idx, targetObjectTypeDescriptor); } } + // Try and treat the index value as a property of the context object + // TODO could call the conversion service to convert the value to a String + if (index.getTypeDescriptor().getType() == String.class) { + Class contextObjectClass = getObjectClass(contextObject.getValue()); + String name = (String)index.getValue(); + EvaluationContext eContext = state.getEvaluationContext(); + try { + if (cachedWriteName!=null && cachedWriteName.equals(name) && cachedWriteTargetType!=null && cachedWriteTargetType.equals(contextObjectClass)) { + // it is OK to use the cached accessor + cachedWriteAccessor.write(eContext, targetObject, name,newValue); + return; + } + + List accessorsToTry = AstUtils.getPropertyAccessorsToTry(contextObjectClass, state); + if (accessorsToTry != null) { + for (PropertyAccessor accessor : accessorsToTry) { + if (accessor.canWrite(eContext, contextObject.getValue(), name)) { + this.cachedWriteName = name; + this.cachedWriteTargetType = contextObjectClass; + this.cachedWriteAccessor = accessor; + accessor.write(eContext, contextObject.getValue(), name, newValue); + return; + } + } + } + } catch (AccessException ae) { + throw new SpelEvaluationException(getStartPosition(), ae, SpelMessage.EXCEPTION_DURING_PROPERTY_WRITE, + name, ae.getMessage()); + } + // Try and treat the index value as a property of the context object // TODO could call the conversion service to convert the value to a String if (indexValue.getTypeDescriptor().getType() == String.class) { @@ -417,27 +335,36 @@ else if (targetObject instanceof String) { state.getEvaluationContext(), targetObjectTypeDescriptor); } - throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, - targetObjectTypeDescriptor.toString()); + throw new SpelEvaluationException(getStartPosition(),SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, targetObjectTypeDescriptor.toString()); } /** * Attempt to grow the specified collection so that the specified index is valid. - * @param targetType the type of the elements in the collection + * + * @param state the expression state + * @param elementType the type of the elements in the collection * @param index the index into the collection that needs to be valid * @param collection the collection to grow with elements */ - private void growCollection(TypeDescriptor targetType, int index, Collection collection) { - if (targetType.getElementTypeDescriptor() == null) { - throw new SpelEvaluationException(getStartPosition(), SpelMessage.UNABLE_TO_GROW_COLLECTION_UNKNOWN_ELEMENT_TYPE); - } - TypeDescriptor elementType = targetType.getElementTypeDescriptor(); - Object newCollectionElement; - try { - int newElements = index - collection.size(); - while (newElements > 0) { - collection.add(elementType.getType().newInstance()); - newElements--; + @SuppressWarnings({ "unchecked", "rawtypes" }) + private boolean growCollection(ExpressionState state, TypeDescriptor targetType, int index, + Collection collection) { + if (state.getConfiguration().isAutoGrowCollections()) { + if (targetType.getElementTypeDescriptor() == null) { + throw new SpelEvaluationException(getStartPosition(), SpelMessage.UNABLE_TO_GROW_COLLECTION_UNKNOWN_ELEMENT_TYPE); + } + TypeDescriptor elementType = targetType.getElementTypeDescriptor(); + Object newCollectionElement = null; + try { + int newElements = index - collection.size(); + while (newElements>0) { + collection.add(elementType.getType().newInstance()); + newElements--; + } + newCollectionElement = elementType.getType().newInstance(); + } + catch (Exception ex) { + throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.UNABLE_TO_GROW_COLLECTION); } newCollectionElement = elementType.getType().newInstance(); } @@ -461,8 +388,7 @@ public String toStringAST() { return sb.toString(); } - private void setArrayElement(TypeConverter converter, Object ctx, int idx, Object newValue, Class clazz) - throws EvaluationException { + private void setArrayElement(ExpressionState state, Object ctx, int idx, Object newValue, Class clazz) throws EvaluationException { Class arrayComponentType = clazz; if (arrayComponentType == Integer.TYPE) { int[] array = (int[]) ctx; @@ -515,8 +441,7 @@ else if (arrayComponentType == Byte.TYPE) { else { Object[] array = (Object[]) ctx; checkAccess(array.length, idx); - array[idx] = converter.convertValue(newValue, TypeDescriptor.forObject(newValue), - TypeDescriptor.valueOf(clazz)); + array[idx] = state.convertValue(newValue, TypeDescriptor.valueOf(clazz)); } } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineList.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineList.java index ad7bf42a84ca..e0b2b8d4deff 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineList.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineList.java @@ -26,7 +26,7 @@ /** * Represent a list in an expression, e.g. '{1,2,3}' - * + * * @author Andy Clement * @since 3.0.4 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/IntLiteral.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/IntLiteral.java index 15dc80d2dbc4..466e03e9d6fa 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/IntLiteral.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/IntLiteral.java @@ -28,7 +28,7 @@ public class IntLiteral extends Literal { private final TypedValue value; IntLiteral(String payload, int pos, int value) { - super(payload, pos); + super(payload, pos); this.value = new TypedValue(value); } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Literal.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Literal.java index 7a8cbdf47ccb..19ddf7caacb8 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Literal.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Literal.java @@ -21,13 +21,13 @@ /** * Common superclass for nodes representing literals (boolean, string, number, etc). - * + * * @author Andy Clement */ public abstract class Literal extends SpelNodeImpl { protected String literalValue; - + public Literal(String payload, int pos) { super(pos); this.literalValue = payload; @@ -53,7 +53,7 @@ public String toStringAST() { /** * Process the string form of a number, using the specified base if supplied and return an appropriate literal to * hold it. Any suffix to indicate a long will be taken into account (either 'l' or 'L' is supported). - * + * * @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE) * @param radix the base of number * @return a subtype of Literal that can represent it @@ -84,7 +84,7 @@ public static Literal getRealLiteral(String numberToken, int pos, boolean isFloa return new FloatLiteral(numberToken, pos, value); } else { double value = Double.parseDouble(numberToken); - return new RealLiteral(numberToken, pos, value); + return new RealLiteral(numberToken, pos, value); } } catch (NumberFormatException nfe) { throw new InternalParseException(new SpelParseException(pos>>16, nfe, SpelMessage.NOT_A_REAL, numberToken)); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/LongLiteral.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/LongLiteral.java index 6ac11d8372e1..c6b1b303af46 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/LongLiteral.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/LongLiteral.java @@ -29,7 +29,7 @@ public class LongLiteral extends Literal { private final TypedValue value; LongLiteral(String payload, int pos, long value) { - super(payload, pos); + super(payload, pos); this.value = new TypedValue(value); } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpLT.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpLT.java index 6fab393a19fb..0f0e12d045ee 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpLT.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpLT.java @@ -31,7 +31,7 @@ public class OpLT extends Operator { public OpLT(int pos, SpelNodeImpl... operands) { super("<", pos, operands); } - + @Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { Object left = getLeftOperand().getValueInternal(state).getValue(); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpMultiply.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpMultiply.java index 507acac3ad36..d97033ddc80b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpMultiply.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OpMultiply.java @@ -24,7 +24,7 @@ /** * Implements the {@code multiply} operator. * - *

    Conversions and promotions are handled as defined in + *

    Conversions and promotions are handled as defined in * Section 5.6.2 * of the Java Language Specification: * @@ -48,6 +48,7 @@ public OpMultiply(int pos, SpelNodeImpl... operands) { * Implements the {@code multiply} operator directly here for certain types * of supported operands and otherwise delegates to any registered overloader * for types not supported here. + * *

    Supported operand types: *

      *
    • doubles diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java index 79c190f4640c..b629ff54b7c1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java @@ -27,12 +27,12 @@ public abstract class Operator extends SpelNodeImpl { String operatorName; - + public Operator(String payload,int pos,SpelNodeImpl... operands) { super(pos, operands); this.operatorName = payload; } - + public SpelNodeImpl getLeftOperand() { return children[0]; } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorBetween.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorBetween.java index 2095e64680ec..d89e5bd6b846 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorBetween.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorBetween.java @@ -29,7 +29,7 @@ * Represents the between operator. The left operand to between must be a single value and the right operand must be a * list - this operator returns true if the left operand is between (using the registered comparator) the two elements * in the list. The definition of between being inclusive follows the SQL BETWEEN definition. - * + * * @author Andy Clement * @since 3.0 */ diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorPower.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorPower.java index 41c5cee03718..0c41e6a8dc2f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorPower.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorPower.java @@ -23,7 +23,7 @@ /** * The power operator. - * + * * @author Andy Clement * @since 3.0 */ @@ -37,7 +37,7 @@ public OperatorPower(int pos, SpelNodeImpl... operands) { public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { SpelNodeImpl leftOp = getLeftOperand(); SpelNodeImpl rightOp = getRightOperand(); - + Object operandOne = leftOp.getValueInternal(state).getValue(); Object operandTwo = rightOp.getValueInternal(state).getValue(); if (operandOne instanceof Number && operandTwo instanceof Number) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java index 2d572e5d8355..226063cf7c0a 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java @@ -32,7 +32,7 @@ import org.springframework.util.ObjectUtils; /** - * Represents projection, where a given operation is performed on all elements in some input sequence, returning + * Represents projection, where a given operation is performed on all elements in some input sequence, returning * a new sequence of the same size. For example: * "{1,2,3,4,5,6,7,8,9,10}.!{#isEven(#this)}" returns "[n, y, n, y, n, y, n, y, n, y]" * @@ -43,7 +43,7 @@ public class Projection extends SpelNodeImpl { private final boolean nullSafe; - + public Projection(boolean nullSafe, int pos, SpelNodeImpl expression) { super(pos, expression); this.nullSafe = nullSafe; @@ -61,7 +61,7 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException Object operand = op.getValue(); boolean operandIsArray = ObjectUtils.isArray(operand); // TypeDescriptor operandTypeDescriptor = op.getTypeDescriptor(); - + // When the input is a map, we push a special context object on the stack // before calling the specified operation. This special context object // has two fields 'key' and 'value' that refer to the map entries key @@ -70,7 +70,7 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException if (operand instanceof Map) { Map mapData = (Map) operand; List result = new ArrayList(); - for (Map.Entry entry : mapData.entrySet()) { + for (Map.Entry entry : mapData.entrySet()) { try { state.pushActiveContextObject(new TypedValue(entry)); result.add(this.children[0].getValueInternal(state).getValue()); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java index c7f85333a01c..ce5112a475cc 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java @@ -34,10 +34,10 @@ /** * Represents a simple property or field reference. - * + * * @author Andy Clement * @author Juergen Hoeller - * @author Clark Duplichien + * @author Clark Duplichien * @since 3.0 */ public class PropertyOrFieldReference extends SpelNodeImpl { @@ -104,26 +104,22 @@ public ValueRef getValueRef(ExpressionState state) throws EvaluationException { @Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { - return getValueInternal(state.getActiveContextObject(), state.getEvaluationContext(), state.getConfiguration().isAutoGrowNullReferences()); - } - - private TypedValue getValueInternal(TypedValue contextObject, EvaluationContext eContext, boolean isAutoGrowNullReferences) throws EvaluationException { - - TypedValue result = readProperty(contextObject, eContext, this.name); + TypedValue result = readProperty(state, this.name); - // Dynamically create the objects if the user has requested that optional behavior - if (result.getValue() == null && isAutoGrowNullReferences && + // Dynamically create the objects if the user has requested that optional behaviour + if (result.getValue() == null && state.getConfiguration().isAutoGrowNullReferences() && nextChildIs(Indexer.class, PropertyOrFieldReference.class)) { TypeDescriptor resultDescriptor = result.getTypeDescriptor(); // Creating lists and maps if ((resultDescriptor.getType().equals(List.class) || resultDescriptor.getType().equals(Map.class))) { // Create a new collection or map ready for the indexer if (resultDescriptor.getType().equals(List.class)) { - try { - if (isWritableProperty(this.name,contextObject,eContext)) { - List newList = ArrayList.class.newInstance(); - writeProperty(contextObject, eContext, this.name, newList); - result = readProperty(contextObject, eContext, this.name); + try { + if (isWritable(state)) { + @SuppressWarnings("rawtypes") + List newList = ArrayList.class.newInstance(); + writeProperty(state, this.name, newList); + result = readProperty(state, this.name); } } catch (InstantiationException ex) { @@ -136,11 +132,12 @@ private TypedValue getValueInternal(TypedValue contextObject, EvaluationContext } } else { - try { - if (isWritableProperty(this.name,contextObject,eContext)) { - Map newMap = HashMap.class.newInstance(); - writeProperty(contextObject, eContext, name, newMap); - result = readProperty(contextObject, eContext, this.name); + try { + if (isWritable(state)) { + @SuppressWarnings("rawtypes") + Map newMap = HashMap.class.newInstance(); + writeProperty(state, name, newMap); + result = readProperty(state, this.name); } } catch (InstantiationException ex) { @@ -155,8 +152,8 @@ private TypedValue getValueInternal(TypedValue contextObject, EvaluationContext } else { // 'simple' object - try { - if (isWritableProperty(this.name,contextObject,eContext)) { + try { + if (isWritable(state)) { Object newObject = result.getTypeDescriptor().getType().newInstance(); writeProperty(contextObject, eContext, name, newObject); result = readProperty(contextObject, eContext, this.name); @@ -169,7 +166,7 @@ private TypedValue getValueInternal(TypedValue contextObject, EvaluationContext catch (IllegalAccessException ex) { throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.UNABLE_TO_DYNAMICALLY_CREATE_OBJECT, result.getTypeDescriptor().getType()); - } + } } } return result; @@ -248,8 +245,10 @@ private TypedValue readProperty(TypedValue contextObject, EvaluationContext eCon } } - private void writeProperty(TypedValue contextObject, EvaluationContext eContext, String name, Object newValue) throws SpelEvaluationException { - + private void writeProperty(ExpressionState state, String name, Object newValue) throws SpelEvaluationException { + TypedValue contextObject = state.getActiveContextObject(); + EvaluationContext eContext = state.getEvaluationContext(); + if (contextObject.getValue() == null && nullSafe) { return; } @@ -257,7 +256,7 @@ private void writeProperty(TypedValue contextObject, EvaluationContext eContext, PropertyAccessor accessorToUse = this.cachedWriteAccessor; if (accessorToUse != null) { try { - accessorToUse.write(eContext, contextObject.getValue(), name, newValue); + accessorToUse.write(state.getEvaluationContext(), contextObject.getValue(), name, newValue); return; } catch (AccessException ae) { @@ -339,7 +338,7 @@ private List getPropertyAccessorsToTry(Class targetType, Li specificAccessors.add( resolver); break; } - else if (clazz.isAssignableFrom(targetType)) { + else if (clazz.isAssignableFrom(targetType)) { generalAccessors.add(resolver); } } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/RealLiteral.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/RealLiteral.java index c3a1566a1ca9..194db8115d4b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/RealLiteral.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/RealLiteral.java @@ -27,7 +27,7 @@ public class RealLiteral extends Literal { private final TypedValue value; public RealLiteral(String payload, int pos, double value) { - super(payload, pos); + super(payload, pos); this.value = new TypedValue(value); } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java index 7c599c660545..9a41cd3e764d 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java @@ -54,7 +54,7 @@ public class Selection extends SpelNodeImpl { private final boolean nullSafe; public Selection(boolean nullSafe, int variant,int pos,SpelNodeImpl expression) { - super(pos,expression); + super(pos,expression); this.nullSafe = nullSafe; this.variant = variant; } @@ -73,9 +73,9 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException if (operand instanceof Map) { Map mapdata = (Map) operand; // TODO don't lose generic info for the new map - Map result = new HashMap(); + Map result = new HashMap(); Object lastKey = null; - for (Map.Entry entry : mapdata.entrySet()) { + for (Map.Entry entry : mapdata.entrySet()) { try { TypedValue kvpair = new TypedValue(entry); state.pushActiveContextObject(kvpair); @@ -101,7 +101,7 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException return new ValueRef.TypedValueHolderValueRef(new TypedValue(null),this); } if (variant == LAST) { - Map resultMap = new HashMap(); + Map resultMap = new HashMap(); Object lastValue = result.get(lastKey); resultMap.put(lastKey,lastValue); return new ValueRef.TypedValueHolderValueRef(new TypedValue(resultMap),this); @@ -153,8 +153,8 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException } } else { if (operand==null) { - if (nullSafe) { - return ValueRef.NullValueRef.instance; + if (nullSafe) { + return TypedValue.NULL; } else { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INVALID_TYPE_FOR_SELECTION, "null"); @@ -162,7 +162,7 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException } else { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INVALID_TYPE_FOR_SELECTION, operand.getClass().getName()); - } + } } } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java index 109de5fdc1b1..5b5959fbbed4 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java @@ -66,7 +66,7 @@ protected SpelNodeImpl getPreviousChild() { /** * @return true if the next child is one of the specified classes */ - protected boolean nextChildIs(Class... clazzes) { + protected boolean nextChildIs(Class... clazzes) { if (parent!=null) { SpelNodeImpl[] peers = parent.children; for (int i=0,max=peers.length;i=max) { return false; } else { - Class clazz = peers[i+1].getClass(); - for (Class desiredClazz: clazzes) { + Class clazz = peers[i+1].getClass(); + for (Class desiredClazz: clazzes) { if (clazz.equals(desiredClazz)) { return true; } @@ -146,8 +146,4 @@ public int getEndPosition() { return (pos&0xffff); } - protected ValueRef getValueRef(ExpressionState state) throws EvaluationException { - throw new SpelEvaluationException(pos,SpelMessage.NOT_ASSIGNABLE,toStringAST()); - } - } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeCode.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeCode.java index aeb7ca1cc6f5..c91ccad46755 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeCode.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeCode.java @@ -18,7 +18,7 @@ /** * Captures primitive types and their corresponding class objects, plus one special entry that represents all reference * (non-primitive) types. - * + * * @author Andy Clement */ public enum TypeCode { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java index 9f9bb0af59ab..f5e53b0b8288 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java @@ -58,7 +58,7 @@ public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep return new TypedValue(clazz); } - private Class makeArrayIfNecessary(Class clazz) { + private Class makeArrayIfNecessary(Class clazz) { if (dimensions!=0) { for (int i=0;i T getValue(EvaluationContext context, Class expectedResultType) th TypedValue typedResultValue = ast.getTypedValue(new ExpressionState(context, configuration)); return ExpressionUtils.convertTypedValue(context, typedResultValue, expectedResultType); } - + public T getValue(EvaluationContext context, Object rootObject, Class expectedResultType) throws EvaluationException { TypedValue typedResultValue = ast.getTypedValue(new ExpressionState(context, toTypedValue(rootObject), configuration)); return ExpressionUtils.convertTypedValue(context, typedResultValue, expectedResultType); @@ -128,56 +127,56 @@ public Class getValueType(EvaluationContext context, Object rootObject) throw public TypeDescriptor getValueTypeDescriptor() throws EvaluationException { return getValueTypeDescriptor(getEvaluationContext()); } - + public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException { ExpressionState eState = new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration); return ast.getValueInternal(eState).getTypeDescriptor(); } - + public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException { Assert.notNull(context, "The EvaluationContext is required"); ExpressionState eState = new ExpressionState(context, configuration); return ast.getValueInternal(eState).getTypeDescriptor(); } - + public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException { Assert.notNull(context, "The EvaluationContext is required"); ExpressionState eState = new ExpressionState(context, toTypedValue(rootObject), configuration); return ast.getValueInternal(eState).getTypeDescriptor(); } - + public String getExpressionString() { return expression; } public boolean isWritable(EvaluationContext context) throws EvaluationException { - Assert.notNull(context, "The EvaluationContext is required"); + Assert.notNull(context, "The EvaluationContext is required"); return ast.isWritable(new ExpressionState(context, configuration)); } public boolean isWritable(Object rootObject) throws EvaluationException { return ast.isWritable(new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration)); } - + public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException { - Assert.notNull(context, "The EvaluationContext is required"); + Assert.notNull(context, "The EvaluationContext is required"); return ast.isWritable(new ExpressionState(context, toTypedValue(rootObject), configuration)); } public void setValue(EvaluationContext context, Object value) throws EvaluationException { - Assert.notNull(context, "The EvaluationContext is required"); + Assert.notNull(context, "The EvaluationContext is required"); ast.setValue(new ExpressionState(context, configuration), value); } public void setValue(Object rootObject, Object value) throws EvaluationException { ast.setValue(new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration), value); } - + public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException { - Assert.notNull(context, "The EvaluationContext is required"); + Assert.notNull(context, "The EvaluationContext is required"); ast.setValue(new ExpressionState(context, toTypedValue(rootObject), configuration), value); } - + // impl only /** @@ -196,7 +195,7 @@ public SpelNode getAST() { public String toStringAST() { return ast.toStringAST(); } - + /** * Return the default evaluation context that will be used if none is supplied on an evaluation call * @return the default evaluation context @@ -207,7 +206,7 @@ public EvaluationContext getEvaluationContext() { } return defaultContext; } - + /** * Set the evaluation context that will be used if none is specified on an evaluation call. * @param context an evaluation context diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpressionParser.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpressionParser.java index 7c6c6f987ea8..7762d75c855b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpressionParser.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpressionParser.java @@ -24,7 +24,7 @@ /** * SpEL parser. Instances are reusable and thread-safe. - * + * * @author Andy Clement * @author Juergen Hoeller * @since 3.0 diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java index 5d3d248fa0f8..5ad614cf8669 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java @@ -18,17 +18,17 @@ /** * Holder for a kind of token, the associated data and its position in the input data stream (start/end). - * + * * @author Andy Clement * @since 3.0 */ class Token { - + TokenKind kind; String data; int startpos; // index of first character int endpos; // index of char after the last character - + /** * Constructor for use when there is no particular data for the token (eg. TRUE or '+') * @param startpos the exact start @@ -39,17 +39,17 @@ class Token { this.startpos = startpos; this.endpos = endpos; } - + Token(TokenKind tokenKind, char[] tokenData, int pos, int endpos) { this(tokenKind,pos,endpos); this.data = new String(tokenData); } - - + + public TokenKind getKind() { return kind; } - + public String toString() { StringBuilder s = new StringBuilder(); s.append("[").append(kind.toString()); @@ -84,4 +84,4 @@ public Token asMatchesToken() { public Token asBetweenToken() { return new Token(TokenKind.BETWEEN,startpos,endpos); } -} \ No newline at end of file +} diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/TokenKind.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/TokenKind.java index 6484a98fa214..cd1db13d6d41 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/TokenKind.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/TokenKind.java @@ -22,9 +22,9 @@ */ enum TokenKind { // ordered by priority - operands first - LITERAL_INT, LITERAL_LONG, LITERAL_HEXINT, LITERAL_HEXLONG, LITERAL_STRING, LITERAL_REAL, LITERAL_REAL_FLOAT, + LITERAL_INT, LITERAL_LONG, LITERAL_HEXINT, LITERAL_HEXLONG, LITERAL_STRING, LITERAL_REAL, LITERAL_REAL_FLOAT, LPAREN("("), RPAREN(")"), COMMA(","), IDENTIFIER, - COLON(":"),HASH("#"),RSQUARE("]"), LSQUARE("["), + COLON(":"),HASH("#"),RSQUARE("]"), LSQUARE("["), LCURLY("{"),RCURLY("}"), DOT("."), PLUS("+"), STAR("*"), MINUS("-"), SELECT_FIRST("^["), SELECT_LAST("$["), QMARK("?"), PROJECT("!["), DIV("/"), GE(">="), GT(">"), LE("<="), LT("<"), EQ("=="), NE("!="), @@ -56,4 +56,4 @@ public boolean hasPayload() { public int getLength() { return tokenChars.length; } -} \ No newline at end of file +} diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java index 44e122266b0f..7c5d71e8d26b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Tokenizer.java @@ -27,12 +27,12 @@ /** * Lex some input data into a stream of tokens that can then be parsed. - * + * * @author Andy Clement * @since 3.0 */ class Tokenizer { - + String expressionString; char[] toProcess; int pos; @@ -117,7 +117,7 @@ public void process() { if (isTwoCharToken(TokenKind.SELECT_FIRST)) { pushPairToken(TokenKind.SELECT_FIRST); } else { - pushCharToken(TokenKind.POWER); + pushCharToken(TokenKind.POWER); } break; case '!': @@ -154,7 +154,7 @@ public void process() { } else if (isTwoCharToken(TokenKind.SAFE_NAVI)) { pushPairToken(TokenKind.SAFE_NAVI); } else { - pushCharToken(TokenKind.QMARK); + pushCharToken(TokenKind.QMARK); } break; case '$': @@ -216,10 +216,11 @@ public void process() { } } - public List getTokens() { + public List getTokens() { return tokens; } + // STRING_LITERAL: '\''! (APOS|~'\'')* '\''!; private void lexQuotedStringLiteral() { int start = pos; @@ -251,12 +252,7 @@ private void lexDoubleQuotedStringLiteral() { pos++; char ch = toProcess[pos]; if (ch=='"') { - // may not be the end if the char after is also a " - if (toProcess[pos+1]=='"') { - pos++; // skip over that too, and continue - } else { - terminated = true; - } + terminated = true; } if (ch==0) { throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NON_TERMINATING_DOUBLE_QUOTED_STRING)); @@ -266,26 +262,27 @@ private void lexDoubleQuotedStringLiteral() { tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start,pos), start, pos)); } -// REAL_LITERAL : + +// REAL_LITERAL : // ('.' (DECIMAL_DIGIT)+ (EXPONENT_PART)? (REAL_TYPE_SUFFIX)?) | // ((DECIMAL_DIGIT)+ '.' (DECIMAL_DIGIT)+ (EXPONENT_PART)? (REAL_TYPE_SUFFIX)?) | // ((DECIMAL_DIGIT)+ (EXPONENT_PART) (REAL_TYPE_SUFFIX)?) | // ((DECIMAL_DIGIT)+ (REAL_TYPE_SUFFIX)); // fragment INTEGER_TYPE_SUFFIX : ( 'L' | 'l' ); -// fragment HEX_DIGIT : '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'A'|'B'|'C'|'D'|'E'|'F'|'a'|'b'|'c'|'d'|'e'|'f'; -// -// fragment EXPONENT_PART : 'e' (SIGN)* (DECIMAL_DIGIT)+ | 'E' (SIGN)* (DECIMAL_DIGIT)+ ; +// fragment HEX_DIGIT : '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'A'|'B'|'C'|'D'|'E'|'F'|'a'|'b'|'c'|'d'|'e'|'f'; +// +// fragment EXPONENT_PART : 'e' (SIGN)* (DECIMAL_DIGIT)+ | 'E' (SIGN)* (DECIMAL_DIGIT)+ ; // fragment SIGN : '+' | '-' ; // fragment REAL_TYPE_SUFFIX : 'F' | 'f' | 'D' | 'd'; // INTEGER_LITERAL -// : (DECIMAL_DIGIT)+ (INTEGER_TYPE_SUFFIX)?; +// : (DECIMAL_DIGIT)+ (INTEGER_TYPE_SUFFIX)?; private void lexNumericLiteral(boolean firstCharIsZero) { boolean isReal = false; int start = pos; char ch = toProcess[pos+1]; boolean isHex = ch=='x' || ch=='X'; - + // deal with hexadecimal if (firstCharIsZero && isHex) { pos=pos+1; @@ -293,16 +290,16 @@ private void lexNumericLiteral(boolean firstCharIsZero) { pos++; } while (isHexadecimalDigit(toProcess[pos])); if (isChar('L','l')) { - pushHexIntToken(subarray(start+2,pos),true, start, pos); + pushHexIntToken(subarray(start+2,pos),true, start, pos); pos++; } else { - pushHexIntToken(subarray(start+2,pos),false, start, pos); + pushHexIntToken(subarray(start+2,pos),false, start, pos); } return; } // real numbers must have leading digits - + // Consume first part of number do { pos++; @@ -311,8 +308,7 @@ private void lexNumericLiteral(boolean firstCharIsZero) { // a '.' indicates this number is a real ch = toProcess[pos]; if (ch=='.') { - isReal = true; - int dotpos = pos; + isReal = true; // carry on consuming digits do { pos++; @@ -328,9 +324,9 @@ private void lexNumericLiteral(boolean firstCharIsZero) { } int endOfNumber = pos; - + // Now there may or may not be an exponent - + // is it a long ? if (isChar('L','l')) { if (isReal) { // 3.4L - not allowed @@ -345,7 +341,7 @@ private void lexNumericLiteral(boolean firstCharIsZero) { if (isSign(possibleSign)) { pos++; } - + // exponent digits do { pos++; @@ -354,7 +350,7 @@ private void lexNumericLiteral(boolean firstCharIsZero) { if (isFloatSuffix(toProcess[pos])) { isFloat = true; endOfNumber = ++pos; - } else if (isDoubleSuffix(toProcess[pos])) { + } else if (isDoubleSuffix(toProcess[pos])) { endOfNumber = ++pos; } pushRealToken(subarray(start,pos), isFloat, start, pos); @@ -367,7 +363,7 @@ private void lexNumericLiteral(boolean firstCharIsZero) { endOfNumber = ++pos; } else if (isDoubleSuffix(ch)) { isReal = true; - endOfNumber = ++pos; + endOfNumber = ++pos; } if (isReal) { pushRealToken(subarray(start,endOfNumber), isFloat, start, endOfNumber); @@ -386,7 +382,7 @@ private void lexIdentifier() { pos++; } while (isIdentifier(toProcess[pos])); char[] subarray = subarray(start,pos); - + // Check if this is the alternative (textual) representation of an operator (see alternativeOperatorNames) if ((pos-start)==2 || (pos-start)==3) { String asString = new String(subarray).toUpperCase(); @@ -409,7 +405,7 @@ private void pushIntToken(char[] data,boolean isLong, int start, int end) { private void pushHexIntToken(char[] data,boolean isLong, int start, int end) { if (data.length==0) { - if (isLong) { + if (isLong) { throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_A_LONG,expressionString.substring(start,end+1))); } else { throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_AN_INTEGER,expressionString.substring(start,end))); @@ -426,7 +422,7 @@ private void pushRealToken(char[] data, boolean isFloat, int start, int end) { if (isFloat) { tokens.add(new Token(TokenKind.LITERAL_REAL_FLOAT, data, start, end)); } else { - tokens.add(new Token(TokenKind.LITERAL_REAL, data, start, end)); + tokens.add(new Token(TokenKind.LITERAL_REAL, data, start, end)); } } @@ -512,7 +508,7 @@ private boolean isHexadecimalDigit(char ch) { return (flags[ch] & IS_HEXDIGIT)!=0; } - private static final byte flags[] = new byte[256]; + private static final byte flags[] = new byte[256]; private static final byte IS_DIGIT=0x01; private static final byte IS_HEXDIGIT=0x02; private static final byte IS_ALPHA=0x04; @@ -535,4 +531,5 @@ private boolean isHexadecimalDigit(char ch) { } } + } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/BooleanTypedValue.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/BooleanTypedValue.java index b397f1ac04c9..8de215472055 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/BooleanTypedValue.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/BooleanTypedValue.java @@ -32,7 +32,7 @@ public class BooleanTypedValue extends TypedValue { private BooleanTypedValue(boolean b) { super(b); } - + public static BooleanTypedValue forValue(boolean b) { if (b) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java index 40dcbc2ca76b..578cbcca0e30 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ static ArgumentsMatchInfo compareArguments( if (suppliedArg.isAssignableTo(expectedArg)) { if (match != ArgsMatchKind.REQUIRES_CONVERSION) { match = ArgsMatchKind.CLOSE; - } + } } else if (typeConverter.canConvert(suppliedArg, expectedArg)) { if (argsRequiringConversion == null) { @@ -103,7 +103,7 @@ else if (typeConverter.canConvert(suppliedArg, expectedArg)) { } } } - + /** * Based on {@link MethodInvoker#getTypeDifferenceWeight(Class[], Object[])} but operates on TypeDescriptors. */ @@ -121,11 +121,11 @@ public static int getTypeDifferenceWeight(List paramTypes, List< return Integer.MAX_VALUE; } if (argType != null) { - Class paramTypeClazz = paramType.getType(); + Class paramTypeClazz = paramType.getType(); if (paramTypeClazz.isPrimitive()) { paramTypeClazz = Object.class; } - Class superClass = argType.getClass().getSuperclass(); + Class superClass = argType.getClass().getSuperclass(); while (superClass != null) { if (paramType.equals(superClass)) { result = result + 2; @@ -153,17 +153,17 @@ else if (ClassUtils.isAssignable(paramTypeClazz, superClass)) { * type by the converter. This variant of compareArguments also allows for a varargs match. * @param expectedArgTypes the array of types the method/constructor is expecting * @param suppliedArgTypes the array of types that are being supplied at the point of invocation - * @param typeConverter a registered type converter + * @param typeConverter a registered type converter * @return a MatchInfo object indicating what kind of match it was or null if it was not a match */ static ArgumentsMatchInfo compareArgumentsVarargs( List expectedArgTypes, List suppliedArgTypes, TypeConverter typeConverter) { - + Assert.isTrue(expectedArgTypes != null && expectedArgTypes.size() > 0, "Expected arguments must at least include one array (the vargargs parameter)"); Assert.isTrue(expectedArgTypes.get(expectedArgTypes.size() - 1).isArray(), "Final expected argument should be array type (the varargs parameter)"); - + ArgsMatchKind match = ArgsMatchKind.EXACT; List argsRequiringConversion = null; @@ -213,7 +213,7 @@ else if (typeConverter.canConvert(suppliedArg, expectedArg)) { else { // Now... we have the final argument in the method we are checking as a match and we have 0 or more other // arguments left to pass to it. - Class varargsParameterType = expectedArgTypes.get(expectedArgTypes.size() - 1).getElementTypeDescriptor().getType(); + Class varargsParameterType = expectedArgTypes.get(expectedArgTypes.size() - 1).getElementTypeDescriptor().getType(); // All remaining parameters must be of this type or convertable to this type for (int i = expectedArgTypes.size() - 1; i < suppliedArgTypes.size(); i++) { @@ -221,7 +221,7 @@ else if (typeConverter.canConvert(suppliedArg, expectedArg)) { if (suppliedArg == null) { if (varargsParameterType.isPrimitive()) { match = null; - } + } } else { if (varargsParameterType != suppliedArg.getType()) { if (ClassUtils.isAssignable(varargsParameterType, suppliedArg.getType())) { @@ -284,18 +284,18 @@ static void convertArguments(TypeConverter converter, Object[] arguments, Object for (int i = 0; i < varargsPosition; i++) { TypeDescriptor targetType = new TypeDescriptor(MethodParameter.forMethodOrConstructor(methodOrCtor, i)); Object argument = arguments[i]; - arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType); + arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType); } MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, varargsPosition); if (varargsPosition == arguments.length - 1) { - TypeDescriptor targetType = new TypeDescriptor(methodParam); + TypeDescriptor targetType = new TypeDescriptor(methodParam); Object argument = arguments[varargsPosition]; - arguments[varargsPosition] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType); + arguments[varargsPosition] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType); } else { TypeDescriptor targetType = TypeDescriptor.nested(methodParam, 1); for (int i = varargsPosition; i < arguments.length; i++) { Object argument = arguments[i]; - arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType); + arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType); } } } @@ -316,7 +316,7 @@ static void convertArguments(TypeConverter converter, Object[] arguments, Object public static void convertAllArguments(TypeConverter converter, Object[] arguments, Method method) throws SpelEvaluationException { Integer varargsPosition = null; if (method.isVarArgs()) { - Class[] paramTypes = method.getParameterTypes(); + Class[] paramTypes = method.getParameterTypes(); varargsPosition = paramTypes.length - 1; } for (int argPosition = 0; argPosition < arguments.length; argPosition++) { @@ -358,7 +358,7 @@ public static void convertAllArguments(TypeConverter converter, Object[] argumen * @param args the arguments to be setup ready for the invocation * @return a repackaged array of arguments where any varargs setup has been done */ - public static Object[] setupArgumentsForVarargsInvocation(Class[] requiredParameterTypes, Object... args) { + public static Object[] setupArgumentsForVarargsInvocation(Class[] requiredParameterTypes, Object... args) { // Check if array already built for final argument int parameterCount = requiredParameterTypes.length; int argumentCount = args.length; @@ -371,7 +371,7 @@ public static Object[] setupArgumentsForVarargsInvocation(Class[] requiredParame if (argumentCount >= parameterCount) { arraySize = argumentCount - (parameterCount - 1); } - + // Create an array for the varargs arguments Object[] newArgs = new Object[parameterCount]; for (int i = 0; i < newArgs.length - 1; i++) { @@ -446,9 +446,9 @@ public static Object[] setupArgumentsForVarargsInvocation(Class[] requiredParame public static enum ArgsMatchKind { // An exact match is where the parameter types exactly match what the method/constructor being invoked is expecting - EXACT, + EXACT, // A close match is where the parameter types either exactly match or are assignment compatible with the method/constructor being invoked - CLOSE, + CLOSE, // A conversion match is where the type converter must be used to transform some of the parameter types REQUIRES_CONVERSION } @@ -474,11 +474,11 @@ public static class ArgumentsMatchInfo { ArgumentsMatchInfo(ArgsMatchKind kind) { this.kind = kind; } - + public boolean isExactMatch() { return (this.kind == ArgsMatchKind.EXACT); } - + public boolean isCloseMatch() { return (this.kind == ArgsMatchKind.CLOSE); } @@ -486,7 +486,7 @@ public boolean isCloseMatch() { public boolean isMatchRequiringConversion() { return (this.kind == ArgsMatchKind.REQUIRES_CONVERSION); } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ArgumentMatch: ").append(this.kind); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java index 6c1d3c5a1779..fa5d3ed16ea7 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ class ReflectiveConstructorExecutor implements ConstructorExecutor { public ReflectiveConstructorExecutor(Constructor ctor, int[] argsRequiringConversion) { this.ctor = ctor; if (ctor.isVarArgs()) { - Class[] paramTypes = ctor.getParameterTypes(); + Class[] paramTypes = ctor.getParameterTypes(); this.varargsPosition = paramTypes.length - 1; } else { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java index a2768fc09977..f85b30aeda39 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ /** * A constructor resolver that uses reflection to locate the constructor that should be invoked - * + * * @author Andy Clement * @author Juergen Hoeller * @since 3.0 @@ -55,22 +55,22 @@ public ConstructorExecutor resolve(EvaluationContext context, String typename, L try { TypeConverter typeConverter = context.getTypeConverter(); Class type = context.getTypeLocator().findType(typename); - Constructor[] ctors = type.getConstructors(); + Constructor[] ctors = type.getConstructors(); - Arrays.sort(ctors, new Comparator() { - public int compare(Constructor c1, Constructor c2) { + Arrays.sort(ctors, new Comparator>() { + public int compare(Constructor c1, Constructor c2) { int c1pl = c1.getParameterTypes().length; int c2pl = c2.getParameterTypes().length; return (new Integer(c1pl)).compareTo(c2pl); } }); - Constructor closeMatch = null; + Constructor closeMatch = null; int[] argsToConvert = null; - Constructor matchRequiringConversion = null; + Constructor matchRequiringConversion = null; - for (Constructor ctor : ctors) { - Class[] paramTypes = ctor.getParameterTypes(); + for (Constructor ctor : ctors) { + Class[] paramTypes = ctor.getParameterTypes(); List paramDescriptors = new ArrayList(paramTypes.length); for (int i = 0; i < paramTypes.length; i++) { paramDescriptors.add(new TypeDescriptor(new MethodParameter(ctor, i))); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java index a54dbac7bc03..02372c9055f1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ class ReflectiveMethodExecutor implements MethodExecutor { public ReflectiveMethodExecutor(Method theMethod, int[] argumentsRequiringConversion) { this.method = theMethod; if (theMethod.isVarArgs()) { - Class[] paramTypes = theMethod.getParameterTypes(); + Class[] paramTypes = theMethod.getParameterTypes(); this.varargsPosition = paramTypes.length - 1; } else { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java index 6e112b0e01cf..0ba434388920 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java @@ -36,9 +36,8 @@ import org.springframework.util.StringUtils; /** - * Simple PropertyAccessor that uses reflection to access properties for reading and writing. - * A property can be accessed if it is accessible as a field on the object or through a - * getter (if being read) or a setter (if being written). + * Simple PropertyAccessor that uses reflection to access properties for reading and writing. A property can be accessed + * if it is accessible as a field on the object or through a getter (if being read) or a setter (if being written). * * @author Andy Clement * @author Juergen Hoeller @@ -50,7 +49,9 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { private final Map writerCache = new ConcurrentHashMap(64); - private final Map typeDescriptorCache = new ConcurrentHashMap(64); + protected final Map writerCache = new ConcurrentHashMap(); + + protected final Map typeDescriptorCache = new ConcurrentHashMap(); /** @@ -86,7 +87,7 @@ public boolean canRead(EvaluationContext context, Object target, String name) th Field field = findField(name, type, target); if (field != null) { TypeDescriptor typeDescriptor = new TypeDescriptor(field); - this.readerCache.put(cacheKey, new InvokerPair(field, typeDescriptor)); + this.readerCache.put(cacheKey, new InvokerPair(field,typeDescriptor)); this.typeDescriptorCache.put(cacheKey, typeDescriptor); return true; } @@ -366,6 +367,52 @@ protected Field findField(String name, Class clazz, boolean mustBeStatic) { return null; } + /** + * Captures the member (method/field) to call reflectively to access a property value and the type descriptor for the + * value returned by the reflective call. + */ + private static class InvokerPair { + + final Member member; + + final TypeDescriptor typeDescriptor; + + public InvokerPair(Member member, TypeDescriptor typeDescriptor) { + this.member = member; + this.typeDescriptor = typeDescriptor; + } + + } + + private static class CacheKey { + + private final Class clazz; + + private final String name; + + public CacheKey(Class clazz, String name) { + this.clazz = clazz; + this.name = name; + } + + @Override + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof CacheKey)) { + return false; + } + CacheKey otherKey = (CacheKey) other; + return (this.clazz.equals(otherKey.clazz) && this.name.equals(otherKey.name)); + } + + @Override + public int hashCode() { + return this.clazz.hashCode() * 29 + this.name.hashCode(); + } + } + /** * Attempt to create an optimized property accessor tailored for a property of a particular name on * a particular class. The general ReflectivePropertyAccessor will always work but is not optimal @@ -418,61 +465,11 @@ public PropertyAccessor createOptimalAccessor(EvaluationContext eContext, Object return this; } - /** - * Captures the member (method/field) to call reflectively to access a property value - * and the type descriptor for the value returned by the reflective call. - */ - private static class InvokerPair { - - final Member member; - - final TypeDescriptor typeDescriptor; - - public InvokerPair(Member member, TypeDescriptor typeDescriptor) { - this.member = member; - this.typeDescriptor = typeDescriptor; - } - } - - - private static class CacheKey { - - private final Class clazz; - - private final String name; - - public CacheKey(Class clazz, String name) { - this.clazz = clazz; - this.name = name; - } - - @Override - public boolean equals(Object other) { - if (this == other) { - return true; - } - if (!(other instanceof CacheKey)) { - return false; - } - CacheKey otherKey = (CacheKey) other; - return (this.clazz.equals(otherKey.clazz) && this.name.equals(otherKey.name)); - } - - @Override - public int hashCode() { - return this.clazz.hashCode() * 29 + this.name.hashCode(); - } - } - - - /** - * An optimized form of a PropertyAccessor that will use reflection but only knows - * how to access a particular property on a particular class. This is unlike the - * general ReflectivePropertyResolver which manages a cache of methods/fields that - * may be invoked to access different properties on different classes. This optimal - * accessor exists because looking up the appropriate reflective object by class/name - * on each read is not cheap. + * An optimized form of a PropertyAccessor that will use reflection but only knows how to access a particular property + * on a particular class. This is unlike the general ReflectivePropertyResolver which manages a cache of methods/fields that + * may be invoked to access different properties on different classes. This optimal accessor exists because looking up + * the appropriate reflective object by class/name on each read is not cheap. */ private static class OptimalPropertyAccessor implements PropertyAccessor { @@ -486,9 +483,9 @@ private static class OptimalPropertyAccessor implements PropertyAccessor { this.member = target.member; this.typeDescriptor = target.typeDescriptor; if (this.member instanceof Field) { - Field field = (Field) this.member; - this.needsToBeMadeAccessible = (!Modifier.isPublic(field.getModifiers()) || - !Modifier.isPublic(field.getDeclaringClass().getModifiers())) && !field.isAccessible(); + Field field = (Field)member; + needsToBeMadeAccessible = (!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) + && !field.isAccessible(); } else { Method method = (Method) this.member; @@ -497,7 +494,7 @@ private static class OptimalPropertyAccessor implements PropertyAccessor { } } - public Class[] getSpecificTargetClasses() { + public Class[] getSpecificTargetClasses() { throw new UnsupportedOperationException("Should not be called on an OptimalPropertyAccessor"); } @@ -537,7 +534,7 @@ public TypedValue read(EvaluationContext context, Object target, String name) th throw new AccessException("Unable to access property '" + name + "' through getter", ex); } } - if (this.member instanceof Field) { + if (member instanceof Field) { try { if (this.needsToBeMadeAccessible) { ReflectionUtils.makeAccessible((Field) this.member); @@ -556,7 +553,8 @@ public boolean canWrite(EvaluationContext context, Object target, String name) { throw new UnsupportedOperationException("Should not be called on an OptimalPropertyAccessor"); } - public void write(EvaluationContext context, Object target, String name, Object newValue) { + public void write(EvaluationContext context, Object target, String name, Object newValue) + throws AccessException { throw new UnsupportedOperationException("Should not be called on an OptimalPropertyAccessor"); } } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java index 88118cea321f..e4f108f865a4 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java @@ -47,13 +47,13 @@ * @since 3.0 */ public class StandardEvaluationContext implements EvaluationContext { - + private TypedValue rootObject; private List constructorResolvers; private List methodResolvers; - + private ReflectiveMethodResolver reflectiveMethodResolver; private List propertyAccessors; @@ -67,14 +67,14 @@ public class StandardEvaluationContext implements EvaluationContext { private OperatorOverloader operatorOverloader = new StandardOperatorOverloader(); private final Map variables = new HashMap(); - + private BeanResolver beanResolver; public StandardEvaluationContext() { setRootObject(null); } - + public StandardEvaluationContext(Object rootObject) { this(); setRootObject(rootObject); @@ -102,12 +102,12 @@ public boolean removeConstructorResolver(ConstructorResolver resolver) { ensureConstructorResolversInitialized(); return this.constructorResolvers.remove(resolver); } - + public List getConstructorResolvers() { ensureConstructorResolversInitialized(); return this.constructorResolvers; } - + public void setConstructorResolvers(List constructorResolvers) { this.constructorResolvers = constructorResolvers; } @@ -117,7 +117,7 @@ public void addMethodResolver(MethodResolver resolver) { ensureMethodResolversInitialized(); this.methodResolvers.add(this.methodResolvers.size() - 1, resolver); } - + public boolean removeMethodResolver(MethodResolver methodResolver) { ensureMethodResolversInitialized(); return this.methodResolvers.remove(methodResolver); @@ -131,21 +131,21 @@ public List getMethodResolvers() { public void setBeanResolver(BeanResolver beanResolver) { this.beanResolver = beanResolver; } - + public BeanResolver getBeanResolver() { return this.beanResolver; } - + public void setMethodResolvers(List methodResolvers) { this.methodResolvers = methodResolvers; } - + public void addPropertyAccessor(PropertyAccessor accessor) { ensurePropertyAccessorsInitialized(); this.propertyAccessors.add(this.propertyAccessors.size() - 1, accessor); } - + public boolean removePropertyAccessor(PropertyAccessor accessor) { return this.propertyAccessors.remove(accessor); } @@ -154,7 +154,7 @@ public List getPropertyAccessors() { ensurePropertyAccessorsInitialized(); return this.propertyAccessors; } - + public void setPropertyAccessors(List propertyAccessors) { this.propertyAccessors = propertyAccessors; } @@ -219,11 +219,9 @@ public Object lookupVariable(String name) { } /** - * Register a {@code MethodFilter} which will be called during method resolution - * for the specified type. - * - *

      The {@code MethodFilter} may remove methods and/or sort the methods which - * will then be used by SpEL as the candidates to look through for a match. + * Register a MethodFilter which will be called during method resolution for the + * specified type. The MethodFilter may remove methods and/or sort the methods + * which will then be used by SpEL as the candidates to look through for a match. * * @param type the type for which the filter should be called * @param filter a {@code MethodFilter}, or {@code null} to unregister a filter for the type diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeComparator.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeComparator.java index 4cb99f4d5f34..123e016ef9db 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeComparator.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * A simple basic TypeComparator implementation. It supports comparison of numbers and types implementing Comparable. - * + * * @author Andy Clement * @author Juergen Hoeller * @since 3.0 @@ -63,12 +63,12 @@ public int compare(Object left, Object right) throws SpelEvaluationException { try { if (left instanceof Comparable) { - return ((Comparable) left).compareTo(right); + return ((Comparable) left).compareTo(right); } } catch (ClassCastException cce) { throw new SpelEvaluationException(cce, SpelMessage.NOT_COMPARABLE, left.getClass(), right.getClass()); } - + throw new SpelEvaluationException(SpelMessage.NOT_COMPARABLE, left.getClass(), right.getClass()); } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java index 49c0b3c2bdcd..1cc1d6f394ad 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java @@ -29,7 +29,7 @@ /** * Default implementation of the {@link TypeConverter} interface, * delegating to a core Spring {@link ConversionService}. - * + * * @author Juergen Hoeller * @author Andy Clement * @since 3.0 @@ -38,7 +38,7 @@ public class StandardTypeConverter implements TypeConverter { private static ConversionService defaultConversionService; - + private final ConversionService conversionService; diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java index 18d9df11f24f..e46c53462f9b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java @@ -29,7 +29,7 @@ /** * A default implementation of a TypeLocator that uses the context classloader (or any classloader set upon it). It * supports 'well known' packages so if a type cannot be found it will try the registered imports to locate it. - * + * * @author Andy Clement * @author Juergen Hoeller * @since 3.0 @@ -95,9 +95,9 @@ public void registerImport(String prefix) { public List getImportPrefixes() { return Collections.unmodifiableList(this.knownPackagePrefixes); } - + public void removeImport(String prefix) { - this.knownPackagePrefixes.remove(prefix); + this.knownPackagePrefixes.remove(prefix); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ArrayConstructorTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ArrayConstructorTests.java index d48266f45181..6a0a2f9c2a2c 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ArrayConstructorTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ArrayConstructorTests.java @@ -22,7 +22,7 @@ /** * Test construction of arrays. - * + * * @author Andy Clement */ public class ArrayConstructorTests extends ExpressionTestCase { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ConstructorInvocationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ConstructorInvocationTests.java index 3d3be623a5be..eab2a6f0c28b 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ConstructorInvocationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ConstructorInvocationTests.java @@ -34,7 +34,7 @@ /** * Tests invocation of constructors. - * + * * @author Andy Clement */ public class ConstructorInvocationTests extends ExpressionTestCase { @@ -43,22 +43,22 @@ public class ConstructorInvocationTests extends ExpressionTestCase { public void testTypeConstructors() { evaluate("new String('hello world')", "hello world", String.class); } - + @Test public void testNonExistentType() { evaluateAndCheckError("new FooBar()",SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM); } - + static class TestException extends Exception { - + } - + static class Tester { public static int counter; public int i; - + public Tester() {} - + public Tester(int i) throws Exception { counter++; if (i==1) { @@ -72,11 +72,11 @@ public Tester(int i) throws Exception { } this.i = i; } - + public Tester(PlaceOfBirth pob) { - + } - + } @Test public void testConstructorThrowingException_SPR6760() { @@ -85,7 +85,7 @@ public void testConstructorThrowingException_SPR6760() { // On 2 it will throw a RuntimeException // On 3 it will exit normally // In each case it increments the Tester field 'counter' when invoked - + SpelExpressionParser parser = new SpelExpressionParser(); Expression expr = parser.parseExpression("new org.springframework.expression.spel.ConstructorInvocationTests$Tester(#bar).i"); @@ -104,11 +104,11 @@ public void testConstructorThrowingException_SPR6760() { o = expr.getValue(eContext); Assert.assertEquals(0, o); // That confirms the logic to mark the cached reference stale and retry is working - - + + // Now let's cause the method to exit via exception and ensure it doesn't cause // a retry. - + // First, switch back to throwException(int) eContext.setVariable("bar",3); o = expr.getValue(eContext); @@ -130,8 +130,8 @@ public void testConstructorThrowingException_SPR6760() { } // If counter is 4 then the method got called twice! Assert.assertEquals(3,parser.parseExpression("counter").getValue(eContext)); - - + + // 1 will make it throw a RuntimeException - SpEL will let this through eContext.setVariable("bar",1); try { @@ -147,38 +147,38 @@ public void testConstructorThrowingException_SPR6760() { // If counter is 5 then the method got called twice! Assert.assertEquals(4,parser.parseExpression("counter").getValue(eContext)); } - + @Test public void testAddingConstructorResolvers() { StandardEvaluationContext ctx = new StandardEvaluationContext(); - + // reflective constructor accessor is the only one by default List constructorResolvers = ctx.getConstructorResolvers(); Assert.assertEquals(1,constructorResolvers.size()); - + ConstructorResolver dummy = new DummyConstructorResolver(); ctx.addConstructorResolver(dummy); Assert.assertEquals(2,ctx.getConstructorResolvers().size()); - + List copy = new ArrayList(); copy.addAll(ctx.getConstructorResolvers()); Assert.assertTrue(ctx.removeConstructorResolver(dummy)); Assert.assertFalse(ctx.removeConstructorResolver(dummy)); Assert.assertEquals(1,ctx.getConstructorResolvers().size()); - + ctx.setConstructorResolvers(copy); Assert.assertEquals(2,ctx.getConstructorResolvers().size()); } - + static class DummyConstructorResolver implements ConstructorResolver { public ConstructorExecutor resolve(EvaluationContext context, String typeName, List argumentTypes) throws AccessException { throw new UnsupportedOperationException("Auto-generated method stub"); } - + } - + @Test public void testVarargsInvocation01() { // Calling 'Fruit(String... strings)' @@ -201,7 +201,7 @@ public void testVarargsInvocation02() { evaluate("new org.springframework.expression.spel.testresources.Fruit(2,'a',3.0d).stringscount()", 4, Integer.class); evaluate("new org.springframework.expression.spel.testresources.Fruit(8,stringArrayOfThreeItems).stringscount()", 11, Integer.class); } - + /* * These tests are attempting to call constructors where we need to widen or convert the argument in order to * satisfy a suitable constructor. diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java index 37c0dd935d22..f28c7c295c44 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java @@ -24,7 +24,7 @@ /** * Unit tests for type comparison - * + * * @author Andy Clement */ public class DefaultComparatorUnitTests { @@ -52,12 +52,12 @@ public void testPrimitives() throws EvaluationException { Assert.assertTrue(comparator.compare(1, 2L) < 0); Assert.assertTrue(comparator.compare(1, 1L) == 0); Assert.assertTrue(comparator.compare(2, 1L) > 0); - + Assert.assertTrue(comparator.compare(1L, 2L) < 0); Assert.assertTrue(comparator.compare(1L, 1L) == 0); Assert.assertTrue(comparator.compare(2L, 1L) > 0); } - + @Test public void testNulls() throws EvaluationException { TypeComparator comparator = new StandardTypeComparator(); @@ -73,7 +73,7 @@ public void testObjects() throws EvaluationException { Assert.assertTrue(comparator.compare("a","b")<0); Assert.assertTrue(comparator.compare("b","a")>0); } - + @Test public void testCanCompare() throws EvaluationException { TypeComparator comparator = new StandardTypeComparator(); @@ -85,5 +85,5 @@ public void testCanCompare() throws EvaluationException { Assert.assertTrue(comparator.canCompare("abc",3)); Assert.assertFalse(comparator.canCompare(String.class,3)); } - + } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java index 696c68831d91..9a71a6df6aa3 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java @@ -75,8 +75,8 @@ public void testCreateListsOnAttemptToIndexNull01() throws EvaluationException, assertEquals(4, testClass.getFoo().size()); } - @Test(expected = SpelEvaluationException.class) - public void testCreateMapsOnAttemptToIndexNull01() throws Exception { + @Test + public void testCreateMapsOnAttemptToIndexNull01() throws EvaluationException, ParseException { TestClass testClass = new TestClass(); StandardEvaluationContext ctx = new StandardEvaluationContext(testClass); ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); @@ -84,10 +84,15 @@ public void testCreateMapsOnAttemptToIndexNull01() throws Exception { o = parser.parseExpression("map['a']").getValue(ctx); assertNull(o); o = parser.parseExpression("map").getValue(ctx); - assertNotNull(o); + Assert.assertNotNull(o); - o = parser.parseExpression("map2['a']").getValue(ctx); - // map2 should be null, there is no setter + try { + o = parser.parseExpression("map2['a']").getValue(ctx); + // fail! + Assert.fail("map2 should be null, there is no setter"); + } catch (Exception e) { + // success! + } } // wibble2 should be null (cannot be initialized dynamically), there is no setter @@ -100,14 +105,20 @@ public void testCreateObjectsOnAttemptToReferenceNull() throws Exception { o = parser.parseExpression("wibble.bar").getValue(ctx); assertEquals("hello", o); o = parser.parseExpression("wibble").getValue(ctx); - assertNotNull(o); + Assert.assertNotNull(o); - o = parser.parseExpression("wibble2.bar").getValue(ctx); + try { + o = parser.parseExpression("wibble2.bar").getValue(ctx); + // fail! + Assert.fail("wibble2 should be null (cannot be initialized dynamically), there is no setter"); + } catch (Exception e) { + // success! + } } - @SuppressWarnings("rawtypes") static class TestClass { + public Foo wibble; private Foo wibble2; public Map map; @@ -115,7 +126,6 @@ static class TestClass { public List list; public List list2; private Map map2; - private List foo; public Map getMap2() { return this.map2; } public Foo getWibble2() { return this.wibble2; } @@ -128,7 +138,6 @@ public Foo() {} public String bar = "hello"; } - @Test public void testElvis01() { evaluate("'Andy'?:'Dave'", "Andy", String.class); @@ -237,13 +246,14 @@ public void testRogueTrailingDotCausesNPE_SPR6866() { new SpelExpressionParser().parseExpression("placeOfBirth.foo."); fail("Should have failed to parse"); } catch (ParseException e) { - assertTrue(e instanceof SpelParseException); - SpelParseException spe = (SpelParseException) e; - assertEquals(SpelMessage.OOD, spe.getMessageCode()); - assertEquals(16, spe.getPosition()); + Assert.assertTrue(e instanceof SpelParseException); + SpelParseException spe = (SpelParseException)e; + Assert.assertEquals(SpelMessage.OOD,spe.getMessageCode()); + Assert.assertEquals(16,spe.getPosition()); } } + // nested properties @Test public void testPropertiesNested01() { @@ -295,10 +305,10 @@ public void testConstructorInvocation06() throws Exception { String newString = expr.getValue(String.class); assertEquals("wibble", newString); newString = expr.getValue(String.class); - assertEquals("wibble", newString); + Assert.assertEquals("wibble",newString); // not writable - assertFalse(expr.isWritable(new StandardEvaluationContext())); + Assert.assertFalse(expr.isWritable(new StandardEvaluationContext())); // ast assertEquals("new String('wibble')", expr.toStringAST()); @@ -417,6 +427,7 @@ public void testIndexer03() { evaluate("'christian'[8]", "n", String.class); } + @Test public void testIndexerError() { evaluateAndCheckError("new org.springframework.expression.spel.testresources.Inventor().inventions[1]", @@ -492,6 +503,7 @@ public void testNumbers01() { evaluateAndAskForReturnType("3*4+5", "17", String.class); } + @Test public void testAdvancedNumerics() throws Exception { int twentyFour = parser.parseExpression("2.0 * 3e0 * 4").getValue(Integer.class); @@ -530,7 +542,7 @@ public void testResolvingList() throws Exception { @Test public void testResolvingString() throws Exception { Class stringClass = parser.parseExpression("T(String)").getValue(Class.class); - assertEquals(String.class, stringClass); + Assert.assertEquals(String.class,stringClass); } /** @@ -549,11 +561,11 @@ public void initializingCollectionElementsOnWrite() throws Exception { expression = parser.parseExpression("address.street"); expression.setValue(context, "123 High St"); - assertEquals("123 High St", person.getAddress().getStreet()); + Assert.assertEquals("123 High St",person.getAddress().getStreet()); expression = parser.parseExpression("address.crossStreets[0]"); expression.setValue(context, "Blah"); - assertEquals("Blah", person.getAddress().getCrossStreets().get(0)); + Assert.assertEquals("Blah",person.getAddress().getCrossStreets().get(0)); expression = parser.parseExpression("address.crossStreets[3]"); expression.setValue(context, "Wibble"); @@ -920,468 +932,4 @@ public void decrement02postfix() { assertEquals(14,helper.sss); } - @Test - public void decrement02prefix() { - Spr9751 helper = new Spr9751(); - StandardEvaluationContext ctx = new StandardEvaluationContext(helper); - ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); - Expression e = null; - - // double - e = parser.parseExpression("--ddd"); - assertEquals(2.0d,helper.ddd,0d); - double return_ddd = e.getValue(ctx,Double.TYPE); - assertEquals(1.0d,return_ddd,0d); - assertEquals(1.0d,helper.ddd,0d); - - // float - e = parser.parseExpression("--fff"); - assertEquals(3.0f,helper.fff,0d); - float return_fff = e.getValue(ctx,Float.TYPE); - assertEquals(2.0f,return_fff,0d); - assertEquals(2.0f,helper.fff,0d); - - // long - e = parser.parseExpression("--lll"); - assertEquals(66666L,helper.lll); - long return_lll = e.getValue(ctx,Long.TYPE); - assertEquals(66665L,return_lll); - assertEquals(66665L,helper.lll); - - // int - e = parser.parseExpression("--iii"); - assertEquals(42,helper.iii); - int return_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(41,return_iii); - assertEquals(41,helper.iii); - return_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(40,return_iii); - assertEquals(40,helper.iii); - - // short - e = parser.parseExpression("--sss"); - assertEquals(15,helper.sss); - int return_sss = (Integer)e.getValue(ctx); - assertEquals(14,return_sss); - assertEquals(14,helper.sss); - } - - @Test - public void decrement03() { - Spr9751 helper = new Spr9751(); - StandardEvaluationContext ctx = new StandardEvaluationContext(helper); - ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); - Expression e = null; - - e = parser.parseExpression("m()--"); - try { - e.getValue(ctx,Double.TYPE); - fail(); - } catch (SpelEvaluationException see) { - assertEquals(SpelMessage.OPERAND_NOT_DECREMENTABLE,see.getMessageCode()); - } - - e = parser.parseExpression("--m()"); - try { - e.getValue(ctx,Double.TYPE); - fail(); - } catch (SpelEvaluationException see) { - assertEquals(SpelMessage.OPERAND_NOT_DECREMENTABLE,see.getMessageCode()); - } - } - - - @Test - public void decrement04() { - Integer i = 42; - StandardEvaluationContext ctx = new StandardEvaluationContext(i); - ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); - try { - Expression e = parser.parseExpression("--1"); - e.getValue(ctx,Integer.class); - fail(); - } catch (SpelEvaluationException see) { - assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode()); - } - try { - Expression e = parser.parseExpression("1--"); - e.getValue(ctx,Integer.class); - fail(); - } catch (SpelEvaluationException see) { - assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode()); - } - } - - @Test - public void incdecTogether() { - Spr9751 helper = new Spr9751(); - StandardEvaluationContext ctx = new StandardEvaluationContext(helper); - ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); - Expression e = null; - - // index1 is 2 at the start - the 'intArray[#root.index1++]' should not be evaluated twice! - // intArray[2] is 3 - e = parser.parseExpression("intArray[#root.index1++]++"); - e.getValue(ctx,Integer.class); - assertEquals(3,helper.index1); - assertEquals(4,helper.intArray[2]); - - // index1 is 3 intArray[3] is 4 - e = parser.parseExpression("intArray[#root.index1++]--"); - assertEquals(4,e.getValue(ctx,Integer.class).intValue()); - assertEquals(4,helper.index1); - assertEquals(3,helper.intArray[3]); - - // index1 is 4, intArray[3] is 3 - e = parser.parseExpression("intArray[--#root.index1]++"); - assertEquals(3,e.getValue(ctx,Integer.class).intValue()); - assertEquals(3,helper.index1); - assertEquals(4,helper.intArray[3]); - } - - - - - private void expectFail(ExpressionParser parser, EvaluationContext eContext, String expressionString, SpelMessage messageCode) { - try { - Expression e = parser.parseExpression(expressionString); - SpelUtilities.printAbstractSyntaxTree(System.out, e); - e.getValue(eContext); - fail(); - } catch (SpelEvaluationException see) { - see.printStackTrace(); - assertEquals(messageCode,see.getMessageCode()); - } - } - - private void expectFailNotAssignable(ExpressionParser parser, EvaluationContext eContext, String expressionString) { - expectFail(parser,eContext,expressionString,SpelMessage.NOT_ASSIGNABLE); - } - - private void expectFailSetValueNotSupported(ExpressionParser parser, EvaluationContext eContext, String expressionString) { - expectFail(parser,eContext,expressionString,SpelMessage.SETVALUE_NOT_SUPPORTED); - } - - private void expectFailNotIncrementable(ExpressionParser parser, EvaluationContext eContext, String expressionString) { - expectFail(parser,eContext,expressionString,SpelMessage.OPERAND_NOT_INCREMENTABLE); - } - - private void expectFailNotDecrementable(ExpressionParser parser, EvaluationContext eContext, String expressionString) { - expectFail(parser,eContext,expressionString,SpelMessage.OPERAND_NOT_DECREMENTABLE); - } - - // Verify how all the nodes behave with assignment (++, --, =) - @Test - public void incrementAllNodeTypes() throws SecurityException, NoSuchMethodException { - Spr9751 helper = new Spr9751(); - StandardEvaluationContext ctx = new StandardEvaluationContext(helper); - ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); - Expression e = null; - - // BooleanLiteral - expectFailNotAssignable(parser, ctx, "true++"); - expectFailNotAssignable(parser, ctx, "--false"); - expectFailSetValueNotSupported(parser, ctx, "true=false"); - - // IntLiteral - expectFailNotAssignable(parser, ctx, "12++"); - expectFailNotAssignable(parser, ctx, "--1222"); - expectFailSetValueNotSupported(parser, ctx, "12=16"); - - // LongLiteral - expectFailNotAssignable(parser, ctx, "1.0d++"); - expectFailNotAssignable(parser, ctx, "--3.4d"); - expectFailSetValueNotSupported(parser, ctx, "1.0d=3.2d"); - - // NullLiteral - expectFailNotAssignable(parser, ctx, "null++"); - expectFailNotAssignable(parser, ctx, "--null"); - expectFailSetValueNotSupported(parser, ctx, "null=null"); - expectFailSetValueNotSupported(parser, ctx, "null=123"); - - // OpAnd - expectFailNotAssignable(parser, ctx, "(true && false)++"); - expectFailNotAssignable(parser, ctx, "--(false AND true)"); - expectFailSetValueNotSupported(parser, ctx, "(true && false)=(false && true)"); - - // OpDivide - expectFailNotAssignable(parser, ctx, "(3/4)++"); - expectFailNotAssignable(parser, ctx, "--(2/5)"); - expectFailSetValueNotSupported(parser, ctx, "(1/2)=(3/4)"); - - // OpEq - expectFailNotAssignable(parser, ctx, "(3==4)++"); - expectFailNotAssignable(parser, ctx, "--(2==5)"); - expectFailSetValueNotSupported(parser, ctx, "(1==2)=(3==4)"); - - // OpGE - expectFailNotAssignable(parser, ctx, "(3>=4)++"); - expectFailNotAssignable(parser, ctx, "--(2>=5)"); - expectFailSetValueNotSupported(parser, ctx, "(1>=2)=(3>=4)"); - - // OpGT - expectFailNotAssignable(parser, ctx, "(3>4)++"); - expectFailNotAssignable(parser, ctx, "--(2>5)"); - expectFailSetValueNotSupported(parser, ctx, "(1>2)=(3>4)"); - - // OpLE - expectFailNotAssignable(parser, ctx, "(3<=4)++"); - expectFailNotAssignable(parser, ctx, "--(2<=5)"); - expectFailSetValueNotSupported(parser, ctx, "(1<=2)=(3<=4)"); - - // OpLT - expectFailNotAssignable(parser, ctx, "(3<4)++"); - expectFailNotAssignable(parser, ctx, "--(2<5)"); - expectFailSetValueNotSupported(parser, ctx, "(1<2)=(3<4)"); - - // OpMinus - expectFailNotAssignable(parser, ctx, "(3-4)++"); - expectFailNotAssignable(parser, ctx, "--(2-5)"); - expectFailSetValueNotSupported(parser, ctx, "(1-2)=(3-4)"); - - // OpModulus - expectFailNotAssignable(parser, ctx, "(3%4)++"); - expectFailNotAssignable(parser, ctx, "--(2%5)"); - expectFailSetValueNotSupported(parser, ctx, "(1%2)=(3%4)"); - - // OpMultiply - expectFailNotAssignable(parser, ctx, "(3*4)++"); - expectFailNotAssignable(parser, ctx, "--(2*5)"); - expectFailSetValueNotSupported(parser, ctx, "(1*2)=(3*4)"); - - // OpNE - expectFailNotAssignable(parser, ctx, "(3!=4)++"); - expectFailNotAssignable(parser, ctx, "--(2!=5)"); - expectFailSetValueNotSupported(parser, ctx, "(1!=2)=(3!=4)"); - - // OpOr - expectFailNotAssignable(parser, ctx, "(true || false)++"); - expectFailNotAssignable(parser, ctx, "--(false OR true)"); - expectFailSetValueNotSupported(parser, ctx, "(true || false)=(false OR true)"); - - // OpPlus - expectFailNotAssignable(parser, ctx, "(3+4)++"); - expectFailNotAssignable(parser, ctx, "--(2+5)"); - expectFailSetValueNotSupported(parser, ctx, "(1+2)=(3+4)"); - - // RealLiteral - expectFailNotAssignable(parser, ctx, "1.0d++"); - expectFailNotAssignable(parser, ctx, "--2.0d"); - expectFailSetValueNotSupported(parser, ctx, "(1.0d)=(3.0d)"); - expectFailNotAssignable(parser, ctx, "1.0f++"); - expectFailNotAssignable(parser, ctx, "--2.0f"); - expectFailSetValueNotSupported(parser, ctx, "(1.0f)=(3.0f)"); - - // StringLiteral - expectFailNotAssignable(parser, ctx, "'abc'++"); - expectFailNotAssignable(parser, ctx, "--'def'"); - expectFailSetValueNotSupported(parser, ctx, "'abc'='def'"); - - // Ternary - expectFailNotAssignable(parser, ctx, "(true?true:false)++"); - expectFailNotAssignable(parser, ctx, "--(true?true:false)"); - expectFailSetValueNotSupported(parser, ctx, "(true?true:false)=(true?true:false)"); - - // TypeReference - expectFailNotAssignable(parser, ctx, "T(String)++"); - expectFailNotAssignable(parser, ctx, "--T(Integer)"); - expectFailSetValueNotSupported(parser, ctx, "T(String)=T(Integer)"); - - // OperatorBetween - expectFailNotAssignable(parser, ctx, "(3 between {1,5})++"); - expectFailNotAssignable(parser, ctx, "--(3 between {1,5})"); - expectFailSetValueNotSupported(parser, ctx, "(3 between {1,5})=(3 between {1,5})"); - - // OperatorInstanceOf - expectFailNotAssignable(parser, ctx, "(type instanceof T(String))++"); - expectFailNotAssignable(parser, ctx, "--(type instanceof T(String))"); - expectFailSetValueNotSupported(parser, ctx, "(type instanceof T(String))=(type instanceof T(String))"); - - // Elvis - expectFailNotAssignable(parser, ctx, "(true?:false)++"); - expectFailNotAssignable(parser, ctx, "--(true?:false)"); - expectFailSetValueNotSupported(parser, ctx, "(true?:false)=(true?:false)"); - - // OpInc - expectFailNotAssignable(parser, ctx, "(iii++)++"); - expectFailNotAssignable(parser, ctx, "--(++iii)"); - expectFailSetValueNotSupported(parser, ctx, "(iii++)=(++iii)"); - - // OpDec - expectFailNotAssignable(parser, ctx, "(iii--)++"); - expectFailNotAssignable(parser, ctx, "--(--iii)"); - expectFailSetValueNotSupported(parser, ctx, "(iii--)=(--iii)"); - - // OperatorNot - expectFailNotAssignable(parser, ctx, "(!true)++"); - expectFailNotAssignable(parser, ctx, "--(!false)"); - expectFailSetValueNotSupported(parser, ctx, "(!true)=(!false)"); - - // OperatorPower - expectFailNotAssignable(parser, ctx, "(iii^2)++"); - expectFailNotAssignable(parser, ctx, "--(iii^2)"); - expectFailSetValueNotSupported(parser, ctx, "(iii^2)=(iii^3)"); - - // Assign - // iii=42 - e = parser.parseExpression("iii=iii++"); - assertEquals(42,helper.iii); - int return_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(42,helper.iii); - assertEquals(42,return_iii); - - // Identifier - e = parser.parseExpression("iii++"); - assertEquals(42,helper.iii); - return_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(42,return_iii); - assertEquals(43,helper.iii); - - e = parser.parseExpression("--iii"); - assertEquals(43,helper.iii); - return_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(42,return_iii); - assertEquals(42,helper.iii); - - e = parser.parseExpression("iii=99"); - assertEquals(42,helper.iii); - return_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(99,return_iii); - assertEquals(99,helper.iii); - - // CompoundExpression - // foo.iii == 99 - e = parser.parseExpression("foo.iii++"); - assertEquals(99,helper.foo.iii); - int return_foo_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(99,return_foo_iii); - assertEquals(100,helper.foo.iii); - - e = parser.parseExpression("--foo.iii"); - assertEquals(100,helper.foo.iii); - return_foo_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(99,return_foo_iii); - assertEquals(99,helper.foo.iii); - - e = parser.parseExpression("foo.iii=999"); - assertEquals(99,helper.foo.iii); - return_foo_iii = e.getValue(ctx,Integer.TYPE); - assertEquals(999,return_foo_iii); - assertEquals(999,helper.foo.iii); - - // ConstructorReference - expectFailNotAssignable(parser, ctx, "(new String('abc'))++"); - expectFailNotAssignable(parser, ctx, "--(new String('abc'))"); - expectFailSetValueNotSupported(parser, ctx, "(new String('abc'))=(new String('abc'))"); - - // MethodReference - expectFailNotIncrementable(parser, ctx, "m()++"); - expectFailNotDecrementable(parser, ctx, "--m()"); - expectFailSetValueNotSupported(parser, ctx, "m()=m()"); - - // OperatorMatches - expectFailNotAssignable(parser, ctx, "('abc' matches '^a..')++"); - expectFailNotAssignable(parser, ctx, "--('abc' matches '^a..')"); - expectFailSetValueNotSupported(parser, ctx, "('abc' matches '^a..')=('abc' matches '^a..')"); - - // Selection - ctx.registerFunction("isEven", Spr9751.class.getDeclaredMethod("isEven", Integer.TYPE)); - - expectFailNotIncrementable(parser, ctx, "({1,2,3}.?[#isEven(#this)])++"); - expectFailNotDecrementable(parser, ctx, "--({1,2,3}.?[#isEven(#this)])"); - expectFailNotAssignable(parser, ctx, "({1,2,3}.?[#isEven(#this)])=({1,2,3}.?[#isEven(#this)])"); - - // slightly diff here because return value isn't a list, it is a single entity - expectFailNotAssignable(parser, ctx, "({1,2,3}.^[#isEven(#this)])++"); - expectFailNotAssignable(parser, ctx, "--({1,2,3}.^[#isEven(#this)])"); - expectFailNotAssignable(parser, ctx, "({1,2,3}.^[#isEven(#this)])=({1,2,3}.^[#isEven(#this)])"); - - expectFailNotAssignable(parser, ctx, "({1,2,3}.$[#isEven(#this)])++"); - expectFailNotAssignable(parser, ctx, "--({1,2,3}.$[#isEven(#this)])"); - expectFailNotAssignable(parser, ctx, "({1,2,3}.$[#isEven(#this)])=({1,2,3}.$[#isEven(#this)])"); - - // FunctionReference - expectFailNotAssignable(parser, ctx, "#isEven(3)++"); - expectFailNotAssignable(parser, ctx, "--#isEven(4)"); - expectFailSetValueNotSupported(parser, ctx, "#isEven(3)=#isEven(5)"); - - // VariableReference - ctx.setVariable("wibble", "hello world"); - expectFailNotIncrementable(parser, ctx, "#wibble++"); - expectFailNotDecrementable(parser, ctx, "--#wibble"); - e = parser.parseExpression("#wibble=#wibble+#wibble"); - String s = e.getValue(ctx,String.class); - assertEquals("hello worldhello world",s); - assertEquals("hello worldhello world",(String)ctx.lookupVariable("wibble")); - - ctx.setVariable("wobble", 3); - e = parser.parseExpression("#wobble++"); - assertEquals(3,((Integer)ctx.lookupVariable("wobble")).intValue()); - int r = e.getValue(ctx,Integer.TYPE); - assertEquals(3,r); - assertEquals(4,((Integer)ctx.lookupVariable("wobble")).intValue()); - - e = parser.parseExpression("--#wobble"); - assertEquals(4,((Integer)ctx.lookupVariable("wobble")).intValue()); - r = e.getValue(ctx,Integer.TYPE); - assertEquals(3,r); - assertEquals(3,((Integer)ctx.lookupVariable("wobble")).intValue()); - - e = parser.parseExpression("#wobble=34"); - assertEquals(3,((Integer)ctx.lookupVariable("wobble")).intValue()); - r = e.getValue(ctx,Integer.TYPE); - assertEquals(34,r); - assertEquals(34,((Integer)ctx.lookupVariable("wobble")).intValue()); - - // Projection - expectFailNotIncrementable(parser, ctx, "({1,2,3}.![#isEven(#this)])++"); // projection would be {false,true,false} - expectFailNotDecrementable(parser, ctx, "--({1,2,3}.![#isEven(#this)])"); // projection would be {false,true,false} - expectFailNotAssignable(parser, ctx, "({1,2,3}.![#isEven(#this)])=({1,2,3}.![#isEven(#this)])"); - - // InlineList - expectFailNotAssignable(parser, ctx, "({1,2,3})++"); - expectFailNotAssignable(parser, ctx, "--({1,2,3})"); - expectFailSetValueNotSupported(parser, ctx, "({1,2,3})=({1,2,3})"); - - // BeanReference - ctx.setBeanResolver(new MyBeanResolver()); - expectFailNotAssignable(parser, ctx, "@foo++"); - expectFailNotAssignable(parser, ctx, "--@foo"); - expectFailSetValueNotSupported(parser, ctx, "@foo=@bar"); - - // PropertyOrFieldReference - helper.iii = 42; - e = parser.parseExpression("iii++"); - assertEquals(42,helper.iii); - r = e.getValue(ctx,Integer.TYPE); - assertEquals(42,r); - assertEquals(43,helper.iii); - - e = parser.parseExpression("--iii"); - assertEquals(43,helper.iii); - r = e.getValue(ctx,Integer.TYPE); - assertEquals(42,r); - assertEquals(42,helper.iii); - - e = parser.parseExpression("iii=100"); - assertEquals(42,helper.iii); - r = e.getValue(ctx,Integer.TYPE); - assertEquals(100,r); - assertEquals(100,helper.iii); - - } - - static class MyBeanResolver implements BeanResolver { - - public Object resolve(EvaluationContext context, String beanName) - throws AccessException { - if (beanName.equals("foo") || beanName.equals("bar")) { - return new Spr9751_2(); - } - throw new AccessException("not heard of "+beanName); - } - - } - - } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java index ed7d79f5dde7..b225aa66df2b 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java @@ -56,7 +56,7 @@ *
    • Adding an advanced (better performing) property resolver *
    • Adding your own type converter to support conversion between any types you like * - * + * * @author Andy Clement */ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { @@ -75,7 +75,7 @@ public void testScenario_UsingStandardInfrastructure() { Object value = expr.getValue(); // They are reusable value = expr.getValue(); - + Assert.assertEquals("hello world", value); Assert.assertEquals(String.class, value.getClass()); } catch (EvaluationException ee) { @@ -100,7 +100,7 @@ public void testScenario_DefiningVariablesThatWillBeAccessibleInExpressions() th List primes = new ArrayList(); primes.addAll(Arrays.asList(2,3,5,7,11,13,17)); ctx.setVariable("primes",primes); - + Expression expr = parser.parseRaw("#favouriteColour"); Object value = expr.getValue(ctx); Assert.assertEquals("blue", value); @@ -112,17 +112,17 @@ public void testScenario_DefiningVariablesThatWillBeAccessibleInExpressions() th // all prime numbers > 10 from the list (using selection ?{...}) expr = parser.parseRaw("#primes.?[#this>10]"); value = expr.getValue(ctx); - Assert.assertEquals("[11, 13, 17]", value.toString()); + Assert.assertEquals("[11, 13, 17]", value.toString()); } - + static class TestClass { public String str; private int property; public int getProperty() { return property; } public void setProperty(int i) { property = i; } } - + /** * Scenario: using your own root context object */ @@ -137,11 +137,11 @@ public void testScenario_UsingADifferentRootContextObject() throws Exception { tc.setProperty(42); tc.str = "wibble"; ctx.setRootObject(tc); - + // read it, set it, read it again Expression expr = parser.parseRaw("str"); Object value = expr.getValue(ctx); - Assert.assertEquals("wibble", value); + Assert.assertEquals("wibble", value); expr = parser.parseRaw("str"); expr.setValue(ctx, "wobble"); expr = parser.parseRaw("str"); @@ -153,7 +153,7 @@ public void testScenario_UsingADifferentRootContextObject() throws Exception { expr = parser.parseRaw("str"); value = expr.getValue(ctx); Assert.assertEquals("wabble", value); - + // private property will be accessed through getter() expr = parser.parseRaw("property"); value = expr.getValue(ctx); @@ -166,7 +166,7 @@ public void testScenario_UsingADifferentRootContextObject() throws Exception { value = expr.getValue(ctx); Assert.assertEquals(4,value); } - + public static String repeat(String s) { return s+s; } /** @@ -180,7 +180,7 @@ public void testScenario_RegisteringJavaMethodsAsFunctionsAndCallingThem() throw // Use the standard evaluation context StandardEvaluationContext ctx = new StandardEvaluationContext(); ctx.registerFunction("repeat",ExpressionLanguageScenarioTests.class.getDeclaredMethod("repeat",String.class)); - + Expression expr = parser.parseRaw("#repeat('hello')"); Object value = expr.getValue(ctx); Assert.assertEquals("hellohello", value); @@ -193,7 +193,7 @@ public void testScenario_RegisteringJavaMethodsAsFunctionsAndCallingThem() throw Assert.fail("Unexpected Exception: " + pe.getMessage()); } } - + /** * Scenario: add a property resolver that will get called in the resolver chain, this one only supports reading. */ @@ -313,6 +313,6 @@ public boolean canWrite(EvaluationContext context, Object target, String name) t public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { } - + } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java index f984c9854017..a7a1856777eb 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java @@ -33,13 +33,13 @@ /** * Tests for the expression state object - some features are not yet exploited in the language (eg nested scopes) - * + * * @author Andy Clement */ public class ExpressionStateTests extends ExpressionTestCase { @Test - public void testConstruction() { + public void testConstruction() { EvaluationContext context = TestScenarioCreator.getTestEvaluationContext(); ExpressionState state = new ExpressionState(context); Assert.assertEquals(context,state.getEvaluationContext()); @@ -47,14 +47,14 @@ public void testConstruction() { // Local variables are in variable scopes which come and go during evaluation. Normal variables are // accessible through the evaluation context - + @Test public void testLocalVariables() { ExpressionState state = getState(); - + Object value = state.lookupLocalVariable("foo"); Assert.assertNull(value); - + state.setLocalVariable("foo",34); value = state.lookupLocalVariable("foo"); Assert.assertEquals(34,value); @@ -80,13 +80,13 @@ public void testVariables() { Assert.assertEquals("abc",typedValue.getValue()); Assert.assertEquals(String.class,typedValue.getTypeDescriptor().getType()); } - + @Test public void testNoVariableInteference() { ExpressionState state = getState(); TypedValue typedValue = state.lookupVariable("foo"); Assert.assertEquals(TypedValue.NULL,typedValue); - + state.setLocalVariable("foo",34); typedValue = state.lookupVariable("foo"); Assert.assertEquals(TypedValue.NULL,typedValue); @@ -94,25 +94,25 @@ public void testNoVariableInteference() { state.setVariable("goo","hello"); Assert.assertNull(state.lookupLocalVariable("goo")); } - + @Test public void testLocalVariableNestedScopes() { ExpressionState state = getState(); Assert.assertEquals(null,state.lookupLocalVariable("foo")); - + state.setLocalVariable("foo",12); Assert.assertEquals(12,state.lookupLocalVariable("foo")); - + state.enterScope(null); Assert.assertEquals(12,state.lookupLocalVariable("foo")); // found in upper scope state.setLocalVariable("foo","abc"); Assert.assertEquals("abc",state.lookupLocalVariable("foo")); // found in nested scope - + state.exitScope(); Assert.assertEquals(12,state.lookupLocalVariable("foo")); // found in nested scope } - + @Test public void testRootContextObject() { ExpressionState state = getState(); @@ -122,62 +122,62 @@ public void testRootContextObject() { ((StandardEvaluationContext) state.getEvaluationContext()).setRootObject(null); Assert.assertEquals(Inventor.class,state.getRootContextObject().getValue().getClass()); // Assert.assertEquals(null, state.getRootContextObject().getValue()); - + state = new ExpressionState(new StandardEvaluationContext()); Assert.assertEquals(TypedValue.NULL,state.getRootContextObject()); - + ((StandardEvaluationContext)state.getEvaluationContext()).setRootObject(null); Assert.assertEquals(null,state.getRootContextObject().getValue()); } - + @Test public void testActiveContextObject() { ExpressionState state = getState(); Assert.assertEquals(state.getRootContextObject().getValue(),state.getActiveContextObject().getValue()); - + try { state.popActiveContextObject(); Assert.fail("stack should be empty..."); } catch (EmptyStackException ese) { // success } - + state.pushActiveContextObject(new TypedValue(34)); Assert.assertEquals(34,state.getActiveContextObject().getValue()); - + state.pushActiveContextObject(new TypedValue("hello")); Assert.assertEquals("hello",state.getActiveContextObject().getValue()); - + state.popActiveContextObject(); Assert.assertEquals(34,state.getActiveContextObject().getValue()); - + state.popActiveContextObject(); Assert.assertEquals(state.getRootContextObject().getValue(),state.getActiveContextObject().getValue()); - + state = new ExpressionState(new StandardEvaluationContext()); Assert.assertEquals(TypedValue.NULL,state.getActiveContextObject()); } - + @Test public void testPopulatedNestedScopes() { ExpressionState state = getState(); Assert.assertNull(state.lookupLocalVariable("foo")); - + state.enterScope("foo",34); Assert.assertEquals(34,state.lookupLocalVariable("foo")); - + state.enterScope(null); state.setLocalVariable("foo",12); Assert.assertEquals(12,state.lookupLocalVariable("foo")); state.exitScope(); Assert.assertEquals(34,state.lookupLocalVariable("foo")); - + state.exitScope(); Assert.assertNull(state.lookupLocalVariable("goo")); } - + @Test public void testRootObjectConstructor() { EvaluationContext ctx = getContext(); @@ -188,21 +188,21 @@ public void testRootObjectConstructor() { Assert.assertEquals(String.class,stateRoot.getTypeDescriptor().getType()); Assert.assertEquals("i am a string",stateRoot.getValue()); } - + @Test public void testPopulatedNestedScopesMap() { ExpressionState state = getState(); Assert.assertNull(state.lookupLocalVariable("foo")); Assert.assertNull(state.lookupLocalVariable("goo")); - + Map m = new HashMap(); m.put("foo",34); m.put("goo","abc"); - + state.enterScope(m); Assert.assertEquals(34,state.lookupLocalVariable("foo")); Assert.assertEquals("abc",state.lookupLocalVariable("goo")); - + state.enterScope(null); state.setLocalVariable("foo",12); Assert.assertEquals(12,state.lookupLocalVariable("foo")); @@ -213,7 +213,7 @@ public void testPopulatedNestedScopesMap() { Assert.assertNull(state.lookupLocalVariable("foo")); Assert.assertNull(state.lookupLocalVariable("goo")); } - + @Test public void testOperators() throws Exception { ExpressionState state = getState(); @@ -233,13 +233,13 @@ public void testOperators() throws Exception { Assert.assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode()); } } - + @Test public void testComparator() { ExpressionState state = getState(); Assert.assertEquals(state.getEvaluationContext().getTypeComparator(),state.getTypeComparator()); } - + @Test public void testTypeLocator() throws EvaluationException { ExpressionState state = getState(); @@ -253,7 +253,7 @@ public void testTypeLocator() throws EvaluationException { Assert.assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode()); } } - + @Test public void testTypeConversion() throws EvaluationException { ExpressionState state = getState(); @@ -269,7 +269,7 @@ public void testPropertyAccessors() { ExpressionState state = getState(); Assert.assertEquals(state.getEvaluationContext().getPropertyAccessors(),state.getPropertyAccessors()); } - + /** * @return a new ExpressionState */ @@ -278,7 +278,7 @@ private ExpressionState getState() { ExpressionState state = new ExpressionState(context); return state; } - + private EvaluationContext getContext() { return TestScenarioCreator.getTestEvaluationContext(); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java index af7e57e6e148..73041d3a5f91 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas private static TypeDescriptor typeDescriptorForListOfString = null; private static List listOfInteger = new ArrayList(); private static TypeDescriptor typeDescriptorForListOfInteger = null; - + static { listOfString.add("1"); listOfString.add("2"); @@ -58,35 +58,35 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas listOfInteger.add(5); listOfInteger.add(6); } - + @Before public void setUp() throws Exception { ExpressionTestsUsingCoreConversionService.typeDescriptorForListOfString = new TypeDescriptor(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfString")); ExpressionTestsUsingCoreConversionService.typeDescriptorForListOfInteger = new TypeDescriptor(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfInteger")); } - - + + /** * Test the service can convert what we are about to use in the expression evaluation tests. */ @Test public void testConversionsAvailable() throws Exception { TypeConvertorUsingConversionService tcs = new TypeConvertorUsingConversionService(); - + // ArrayList containing List to List Class clazz = typeDescriptorForListOfString.getElementTypeDescriptor().getType(); assertEquals(String.class,clazz); - List l = (List) tcs.convertValue(listOfInteger, TypeDescriptor.forObject(listOfInteger), typeDescriptorForListOfString); + List l = (List) tcs.convertValue(listOfInteger, TypeDescriptor.forObject(listOfInteger), typeDescriptorForListOfString); assertNotNull(l); // ArrayList containing List to List clazz = typeDescriptorForListOfInteger.getElementTypeDescriptor().getType(); assertEquals(Integer.class,clazz); - - l = (List) tcs.convertValue(listOfString, TypeDescriptor.forObject(listOfString), typeDescriptorForListOfString); + + l = (List) tcs.convertValue(listOfString, TypeDescriptor.forObject(listOfString), typeDescriptorForListOfString); assertNotNull(l); } - + @Test public void testSetParameterizedList() throws Exception { StandardEvaluationContext context = TestScenarioCreator.getTestEvaluationContext(); @@ -96,7 +96,7 @@ public void testSetParameterizedList() throws Exception { // Assign a List to the List field - the component elements should be converted parser.parseExpression("listOfInteger").setValue(context,listOfString); assertEquals(3,e.getValue(context,Integer.class).intValue()); // size now 3 - Class clazz = parser.parseExpression("listOfInteger[1].getClass()").getValue(context,Class.class); // element type correctly Integer + Class clazz = parser.parseExpression("listOfInteger[1].getClass()").getValue(context,Class.class); // element type correctly Integer assertEquals(Integer.class,clazz); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java index 3e6ae17ff43d..d6745cacaa23 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java @@ -154,4 +154,133 @@ public void testSetConstruction01() { evaluate("new java.util.HashSet().addAll({'a','b','c'})", "true", Boolean.class); } + // + // public void testConstructorInvocation02() { + // evaluate("new String[3]", "java.lang.String[3]{null,null,null}", String[].class); + // } + // + // public void testConstructorInvocation03() { + // evaluateAndCheckError("new String[]", SpelMessages.NO_SIZE_OR_INITIALIZER_FOR_ARRAY_CONSTRUCTION, 4); + // } + // + // public void testConstructorInvocation04() { + // evaluateAndCheckError("new String[3]{'abc',3,'def'}", SpelMessages.INCORRECT_ELEMENT_TYPE_FOR_ARRAY, 4); + // } + // array construction + // @Test + // public void testArrayConstruction01() { + // evaluate("new int[] {1, 2, 3, 4, 5}", "int[5]{1,2,3,4,5}", int[].class); + // } + // public void testArrayConstruction02() { + // evaluate("new String[] {'abc', 'xyz'}", "java.lang.String[2]{abc,xyz}", String[].class); + // } + // + // collection processors + // from spring.net: count,sum,max,min,average,sort,orderBy,distinct,nonNull + // public void testProcessorsCount01() { + // evaluate("new String[] {'abc','def','xyz'}.count()", "3", Integer.class); + // } + // + // public void testProcessorsCount02() { + // evaluate("new int[] {1,2,3}.count()", "3", Integer.class); + // } + // + // public void testProcessorsMax01() { + // evaluate("new int[] {1,2,3}.max()", "3", Integer.class); + // } + // + // public void testProcessorsMin01() { + // evaluate("new int[] {1,2,3}.min()", "1", Integer.class); + // } + // + // public void testProcessorsKeys01() { + // evaluate("#{1:'January', 2:'February', 3:'March'}.keySet().sort()", "[1, 2, 3]", ArrayList.class); + // } + // + // public void testProcessorsValues01() { + // evaluate("#{1:'January', 2:'February', 3:'March'}.values().sort()", "[February, January, March]", + // ArrayList.class); + // } + // + // public void testProcessorsAverage01() { + // evaluate("new int[] {1,2,3}.average()", "2", Integer.class); + // } + // + // public void testProcessorsSort01() { + // evaluate("new int[] {3,2,1}.sort()", "int[3]{1,2,3}", int[].class); + // } + // + // public void testCollectionProcessorsNonNull01() { + // evaluate("{'a','b',null,'d',null}.nonnull()", "[a, b, d]", ArrayList.class); + // } + // + // public void testCollectionProcessorsDistinct01() { + // evaluate("{'a','b','a','d','e'}.distinct()", "[a, b, d, e]", ArrayList.class); + // } + // + // public void testProjection03() { + // evaluate("{1,2,3,4,5,6,7,8,9,10}.!{#this>5}", + // "[false, false, false, false, false, true, true, true, true, true]", ArrayList.class); + // } + // + // public void testProjection04() { + // evaluate("{1,2,3,4,5,6,7,8,9,10}.!{$index>5?'y':'n'}", "[n, n, n, n, n, n, y, y, y, y]", ArrayList.class); + // } + // Bean references + // public void testReferences01() { + // evaluate("@(apple).name", "Apple", String.class, true); + // } + // + // public void testReferences02() { + // evaluate("@(fruits:banana).name", "Banana", String.class, true); + // } + // + // public void testReferences03() { + // evaluate("@(a.b.c)", null, null); + // } // null - no context, a.b.c treated as name + // + // public void testReferences05() { + // evaluate("@(a/b/c:orange).name", "Orange", String.class, true); + // } + // + // public void testReferences06() { + // evaluate("@(apple).color.getRGB() == T(java.awt.Color).green.getRGB()", "true", Boolean.class); + // } + // + // public void testReferences07() { + // evaluate("@(apple).color.getRGB().equals(T(java.awt.Color).green.getRGB())", "true", Boolean.class); + // } + // + // value is not public, it is accessed through getRGB() + // public void testStaticRef01() { + // evaluate("T(Color).green.value!=0", "true", Boolean.class); + // } + // Indexer + // public void testCutProcessor01() { + // evaluate("{1,2,3,4,5}.cut(1,3)", "[2, 3, 4]", ArrayList.class); + // } + // + // public void testCutProcessor02() { + // evaluate("{1,2,3,4,5}.cut(3,1)", "[4, 3, 2]", ArrayList.class); + // } + // Ternary operator + // public void testTernaryOperator01() { + // evaluate("{1}.#isEven(#this[0]) == 'y'?'it is even':'it is odd'", "it is odd", String.class); + // } + // + // public void testTernaryOperator02() { + // evaluate("{2}.#isEven(#this[0]) == 'y'?'it is even':'it is odd'", "it is even", String.class); + // } + // public void testSelectionUsingIndex() { + // evaluate("{1,2,3,4,5,6,7,8,9,10}.?{$index > 5 }", "[7, 8, 9, 10]", ArrayList.class); + // } + // public void testSelection01() { + // inline list creation not supported: + // evaluate("{1,2,3,4,5,6,7,8,9,10}.?{#isEven(#this) == 'y'}", "[2, 4, 6, 8, 10]", ArrayList.class); + // } + // + // public void testSelectionUsingIndex() { + // evaluate("listOfNumbersUpToTen.?[#index > 5 ]", "[7, 8, 9, 10]", ArrayList.class); + // } + } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java index 617d69fa66a6..6e83ea3cc5af 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java @@ -38,7 +38,7 @@ public void indexIntoGenericPropertyContainingMap() { expression = parser.parseExpression("property['foo']"); assertEquals("bar", expression.getValue(this)); } - + @FieldAnnotation public Object property; @@ -59,15 +59,15 @@ public void indexIntoGenericPropertyContainingMapObject() { expression = parser.parseExpression("property['foo']"); assertEquals("bar", expression.getValue(context)); } - + public static class MapAccessor implements PropertyAccessor { public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { - return (((Map) target).containsKey(name)); + return (((Map) target).containsKey(name)); } public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { - return new TypedValue(((Map) target).get(name)); + return new TypedValue(((Map) target).get(name)); } public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { @@ -77,15 +77,15 @@ public boolean canWrite(EvaluationContext context, Object target, String name) t @SuppressWarnings("unchecked") public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { - ((Map) target).put(name, newValue); + ((Map) target).put(name, newValue); } public Class[] getSpecificTargetClasses() { return new Class[] { Map.class }; } - + } - + @Test public void setGenericPropertyContainingMap() { Map property = new HashMap(); @@ -97,7 +97,7 @@ public void setGenericPropertyContainingMap() { assertEquals(property, expression.getValue(this)); expression = parser.parseExpression("property['foo']"); assertEquals("bar", expression.getValue(this)); - expression.setValue(this, "baz"); + expression.setValue(this, "baz"); assertEquals("baz", expression.getValue(this)); } @@ -112,7 +112,7 @@ public void setPropertyContainingMap() { assertEquals(property, expression.getValue(this)); expression = parser.parseExpression("parameterizedMap['9']"); assertEquals(3, expression.getValue(this)); - expression.setValue(this, "37"); + expression.setValue(this, "37"); assertEquals(37, expression.getValue(this)); } @@ -126,10 +126,10 @@ public void setPropertyContainingMapAutoGrow() { assertEquals(property, expression.getValue(this)); expression = parser.parseExpression("parameterizedMap['9']"); assertEquals(null, expression.getValue(this)); - expression.setValue(this, "37"); + expression.setValue(this, "37"); assertEquals(37, expression.getValue(this)); } - + @Test public void indexIntoGenericPropertyContainingList() { List property = new ArrayList(); @@ -142,7 +142,7 @@ public void indexIntoGenericPropertyContainingList() { expression = parser.parseExpression("property[0]"); assertEquals("bar", expression.getValue(this)); } - + @Test public void setGenericPropertyContainingList() { List property = new ArrayList(); @@ -170,10 +170,10 @@ public void setGenericPropertyContainingListAutogrow() { try { expression.setValue(this, "4"); } catch (EvaluationException e) { - assertTrue(e.getMessage().startsWith("EL1053E")); + assertTrue(e.getMessage().startsWith("EL1053E")); } } - + @Test public void indexIntoPropertyContainingList() { List property = new ArrayList(); @@ -186,7 +186,7 @@ public void indexIntoPropertyContainingList() { expression = parser.parseExpression("parameterizedList[0]"); assertEquals(3, expression.getValue(this)); } - + public List parameterizedList; @Test @@ -201,9 +201,9 @@ public void indexIntoPropertyContainingListOfList() { expression = parser.parseExpression("parameterizedListOfList[0][0]"); assertEquals(3, expression.getValue(this)); } - + public List> parameterizedListOfList; - + @Test public void setPropertyContainingList() { List property = new ArrayList(); @@ -218,7 +218,7 @@ public void setPropertyContainingList() { expression.setValue(this, "4"); assertEquals(4, expression.getValue(this)); } - + @Test public void indexIntoGenericPropertyContainingNullList() { SpelParserConfiguration configuration = new SpelParserConfiguration(true, true); @@ -230,7 +230,7 @@ public void indexIntoGenericPropertyContainingNullList() { try { assertEquals("bar", expression.getValue(this)); } catch (EvaluationException e) { - assertTrue(e.getMessage().startsWith("EL1027E")); + assertTrue(e.getMessage().startsWith("EL1027E")); } } @@ -267,7 +267,8 @@ public void indexIntoGenericPropertyContainingGrowingList2() { assertTrue(e.getMessage().startsWith("EL1053E")); } } - + + @SuppressWarnings("rawtypes") public List property2; @Test @@ -281,7 +282,8 @@ public void indexIntoGenericPropertyContainingArray() { expression = parser.parseExpression("property[0]"); assertEquals("bar", expression.getValue(this)); } - + + @SuppressWarnings("rawtypes") @Test public void emptyList() { listOfScalarNotGeneric = new ArrayList(); @@ -291,6 +293,7 @@ public void emptyList() { assertEquals("", expression.getValue(this, String.class)); } + @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void resolveCollectionElementType() { listNotGeneric = new ArrayList(); @@ -309,15 +312,17 @@ public void resolveCollectionElementTypeNull() { assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.List", expression.getValueTypeDescriptor(this).toString()); } + @SuppressWarnings("rawtypes") @FieldAnnotation public List listNotGeneric; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface FieldAnnotation { - + } + @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void resolveMapKeyValueTypes() { mapNotGeneric = new HashMap(); @@ -327,10 +332,12 @@ public void resolveMapKeyValueTypes() { Expression expression = parser.parseExpression("mapNotGeneric"); assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.HashMap", expression.getValueTypeDescriptor(this).toString()); } - + + @SuppressWarnings("rawtypes") @FieldAnnotation public Map mapNotGeneric; + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testListOfScalar() { listOfScalarNotGeneric = new ArrayList(); @@ -339,10 +346,12 @@ public void testListOfScalar() { Expression expression = parser.parseExpression("listOfScalarNotGeneric[0]"); assertEquals(new Integer(5), expression.getValue(this, Integer.class)); } - + + @SuppressWarnings("rawtypes") public List listOfScalarNotGeneric; - + + @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testListsOfMap() { listOfMapsNotGeneric = new ArrayList(); @@ -353,7 +362,8 @@ public void testListsOfMap() { Expression expression = parser.parseExpression("listOfMapsNotGeneric[0]['fruit']"); assertEquals("apple", expression.getValue(this, String.class)); } - + + @SuppressWarnings("rawtypes") public List listOfMapsNotGeneric; - + } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ListTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ListTests.java index 6fd8925ae018..71055857f816 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ListTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ListTests.java @@ -26,7 +26,7 @@ /** * Test usage of inline lists. - * + * * @author Andy Clement * @since 3.0.4 */ diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java index 7aff1e1ba2f9..16d490bc2cc3 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java @@ -46,7 +46,7 @@ public void testGetValue() throws Exception { Assert.assertFalse(lEx.isWritable(new Rooty())); Assert.assertFalse(lEx.isWritable(new StandardEvaluationContext(), new Rooty())); } - + static class Rooty {} @Test diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java index b3330d7b9d4d..6eda3493255c 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java @@ -23,7 +23,7 @@ /** * Tests the evaluation of basic literals: boolean, integer, hex integer, long, real, null, date - * + * * @author Andy Clement */ public class LiteralTests extends ExpressionTestCase { @@ -159,7 +159,7 @@ public void testConversions() { evaluate("new Integer(37).byteValue()", (byte) 37, Byte.class); // calling byteValue() on Integer.class evaluateAndAskForReturnType("new Integer(37)", (byte) 37, Byte.class); // relying on registered type converters } - + @Test public void testNotWritable() throws Exception { SpelExpression expr = (SpelExpression)parser.parseExpression("37"); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java index adae5e71975d..c7de7567bec0 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ /** * Testing variations on map access. - * + * * @author Andy Clement */ public class MapAccessTests extends ExpressionTestCase { @@ -73,7 +73,7 @@ public void testVariableMapAccess() throws Exception { @Test public void testGetValue(){ - Map props1= new HashMap(); + HashMap props1= new HashMap(); props1.put("key1", "value1"); props1.put("key2", "value2"); props1.put("key3", "value3"); @@ -83,10 +83,11 @@ public void testGetValue(){ ExpressionParser parser = new SpelExpressionParser(); Expression exp = parser.parseExpression("testBean.properties['key2']"); - String key= (String)exp.getValue(bean); + exp.getValue(bean); } + @SuppressWarnings("rawtypes") public static class TestBean { private String name; @@ -150,11 +151,11 @@ public void setProperties(Map properties) { public static class MapAccessor implements PropertyAccessor { public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { - return (((Map) target).containsKey(name)); + return (((Map) target).containsKey(name)); } public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { - return new TypedValue(((Map) target).get(name)); + return new TypedValue(((Map) target).get(name)); } public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { @@ -164,13 +165,13 @@ public boolean canWrite(EvaluationContext context, Object target, String name) t @SuppressWarnings("unchecked") public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { - ((Map) target).put(name, newValue); + ((Map) target).put(name, newValue); } public Class[] getSpecificTargetClasses() { return new Class[] { Map.class }; } - + } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java index e19da9b9a809..d022a880c33e 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ /** * Test providing operator support - * + * * @author Andy Clement */ public class OperatorOverloaderTests extends ExpressionTestCase { @@ -48,11 +48,11 @@ public boolean overridesOperation(Operation operation, Object leftOperand, Objec return true; } return false; - + } - + } - + @Test public void testSimpleOperations() throws Exception { // no built in support for this: @@ -66,7 +66,7 @@ public void testSimpleOperations() throws Exception { expr = (SpelExpression)parser.parseExpression("'abc'-true"); Assert.assertEquals("abc",expr.getValue(eContext)); - + expr = (SpelExpression)parser.parseExpression("'abc'+null"); Assert.assertEquals("abcnull",expr.getValue(eContext)); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java index 2c62030d6f01..0b47ad9fb8fc 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java @@ -23,7 +23,7 @@ /** * Tests the evaluation of expressions using relational operators. - * + * * @author Andy Clement */ public class OperatorTests extends ExpressionTestCase { @@ -124,7 +124,7 @@ public void testNotEqual() { public void testGreaterThanOrEqual() { evaluate("3 >= 5", false, Boolean.class); evaluate("5 >= 3", true, Boolean.class); - evaluate("6 >= 6", true, Boolean.class); + evaluate("6 >= 6", true, Boolean.class); evaluate("3L >= 5L", false, Boolean.class); evaluate("5L >= 3L", true, Boolean.class); evaluate("5L >= 5L", true, Boolean.class); @@ -137,14 +137,14 @@ public void testGreaterThanOrEqual() { evaluate("3 GE 5", false, Boolean.class); evaluate("5 gE 3", true, Boolean.class); - evaluate("6 Ge 6", true, Boolean.class); + evaluate("6 Ge 6", true, Boolean.class); evaluate("3L ge 5L", false, Boolean.class); } @Test public void testGreaterThan() { evaluate("3 > 5", false, Boolean.class); - evaluate("5 > 3", true, Boolean.class); + evaluate("5 > 3", true, Boolean.class); evaluate("3L > 5L", false, Boolean.class); evaluate("5L > 3L", true, Boolean.class); evaluate("3.0d > 5.0d", false, Boolean.class); @@ -172,7 +172,7 @@ public void testMultiplyDoubleDoubleGivesDouble() { public void testMathOperatorAdd02() { evaluate("'hello' + ' ' + 'world'", "hello world", String.class); } - + @Test public void testMathOperatorsInChains() { evaluate("1+2+3",6,Integer.class); @@ -194,7 +194,7 @@ public void testIntegerArithmetic() { evaluate("3 Mod 2", 1, Integer.class); evaluate("3 MOD 2", 1, Integer.class); } - + @Test public void testPlus() throws Exception { evaluate("7 + 2", "9", Integer.class); @@ -205,26 +205,26 @@ public void testPlus() throws Exception { evaluate("2 + 'a'", "2a", String.class); evaluate("'ab' + null", "abnull", String.class); evaluate("null + 'ab'", "nullab", String.class); - + // AST: SpelExpression expr = (SpelExpression)parser.parseExpression("+3"); Assert.assertEquals("+3",expr.toStringAST()); expr = (SpelExpression)parser.parseExpression("2+3"); Assert.assertEquals("(2 + 3)",expr.toStringAST()); - + // use as a unary operator evaluate("+5d",5d,Double.class); evaluate("+5L",5L,Long.class); evaluate("+5",5,Integer.class); evaluateAndCheckError("+'abc'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); - + // string concatenation evaluate("'abc'+'def'","abcdef",String.class); - - // + + // evaluate("5 + new Integer('37')",42,Integer.class); } - + @Test public void testMinus() throws Exception { evaluate("'c' - 2", "a", String.class); @@ -235,13 +235,13 @@ public void testMinus() throws Exception { Assert.assertEquals("-3",expr.toStringAST()); expr = (SpelExpression)parser.parseExpression("2-3"); Assert.assertEquals("(2 - 3)",expr.toStringAST()); - + evaluate("-5d",-5d,Double.class); evaluate("-5L",-5L,Long.class); evaluate("-5",-5,Integer.class); evaluateAndCheckError("-'abc'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); } - + @Test public void testModulus() { evaluate("3%2",1,Integer.class); @@ -259,7 +259,7 @@ public void testDivide() { evaluate("4L DIV 2L",2L,Long.class); evaluateAndCheckError("'abc'/'def'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); } - + @Test public void testMathOperatorDivide_ConvertToDouble() { evaluateAndAskForReturnType("8/4", new Double(2.0), Double.class); @@ -282,7 +282,7 @@ public void testDoubles() { evaluate("3.0d / 5.0d", 0.6d, Double.class); evaluate("6.0d % 3.5d", 2.5d, Double.class); } - + @Test public void testOperatorNames() throws Exception { Operator node = getOperatorNode((SpelExpression)parser.parseExpression("1==3")); @@ -290,13 +290,13 @@ public void testOperatorNames() throws Exception { node = getOperatorNode((SpelExpression)parser.parseExpression("1!=3")); Assert.assertEquals("!=",node.getOperatorName()); - + node = getOperatorNode((SpelExpression)parser.parseExpression("3/3")); Assert.assertEquals("/",node.getOperatorName()); - + node = getOperatorNode((SpelExpression)parser.parseExpression("3+3")); Assert.assertEquals("+",node.getOperatorName()); - + node = getOperatorNode((SpelExpression)parser.parseExpression("3-3")); Assert.assertEquals("-",node.getOperatorName()); @@ -305,29 +305,29 @@ public void testOperatorNames() throws Exception { node = getOperatorNode((SpelExpression)parser.parseExpression("3<=4")); Assert.assertEquals("<=",node.getOperatorName()); - + node = getOperatorNode((SpelExpression)parser.parseExpression("3*4")); Assert.assertEquals("*",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3%4")); Assert.assertEquals("%",node.getOperatorName()); - + node = getOperatorNode((SpelExpression)parser.parseExpression("3>=4")); Assert.assertEquals(">=",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3 between 4")); Assert.assertEquals("between",node.getOperatorName()); - + node = getOperatorNode((SpelExpression)parser.parseExpression("3 ^ 4")); Assert.assertEquals("^",node.getOperatorName()); } - + @Test public void testOperatorOverloading() { evaluateAndCheckError("'a' * '2'", SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); evaluateAndCheckError("'a' ^ '2'", SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); } - + @Test public void testPower() { evaluate("3^2",9,Integer.class); @@ -335,27 +335,27 @@ public void testPower() { evaluate("3L^2L",9L,Long.class); evaluate("(2^32)^2",9223372036854775807L,Long.class); } - + @Test public void testMixedOperands_FloatsAndDoubles() { evaluate("3.0d + 5.0f", 8.0d, Double.class); evaluate("3.0D - 5.0f", -2.0d, Double.class); evaluate("3.0f * 5.0d", 15.0d, Double.class); evaluate("3.0f / 5.0D", 0.6d, Double.class); - evaluate("5.0D % 3f", 2.0d, Double.class); + evaluate("5.0D % 3f", 2.0d, Double.class); } - + @Test public void testMixedOperands_DoublesAndInts() { evaluate("3.0d + 5", 8.0d, Double.class); evaluate("3.0D - 5", -2.0d, Double.class); - evaluate("3.0f * 5", 15.0f, Float.class); - evaluate("6.0f / 2", 3.0f, Float.class); - evaluate("6.0f / 4", 1.5f, Float.class); - evaluate("5.0D % 3", 2.0d, Double.class); - evaluate("5.5D % 3", 2.5, Double.class); + evaluate("3.0f * 5", 15.0d, Double.class); + evaluate("6.0f / 2", 3.0, Double.class); + evaluate("6.0f / 4", 1.5d, Double.class); + evaluate("5.0D % 3", 2.0d, Double.class); + evaluate("5.5D % 3", 2.5, Double.class); } - + @Test public void testStrings() { evaluate("'abc' == 'abc'",true,Boolean.class); @@ -363,7 +363,7 @@ public void testStrings() { evaluate("'abc' != 'abc'",false,Boolean.class); evaluate("'abc' != 'def'",true,Boolean.class); } - + @Test public void testLongs() { evaluate("3L == 4L", false, Boolean.class); @@ -374,14 +374,14 @@ public void testLongs() { evaluate("3L + 50L", 53L, Long.class); evaluate("3L - 50L", -47L, Long.class); } - + // --- - + private Operator getOperatorNode(SpelExpression e) { SpelNode node = e.getAST(); return (Operator)findNode(node,Operator.class); } - + private SpelNode findNode(SpelNode node, Class clazz) { if (clazz.isAssignableFrom(node.getClass())) { return node; @@ -395,5 +395,5 @@ private SpelNode findNode(SpelNode node, Class clazz) { } return null; } - + } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java index 5e714ac66112..d2d6b954fec1 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * Parse some expressions and check we get the AST we expect. Rather than inspecting each node in the AST, we ask it to * write itself to a string form and check that is as expected. - * + * * @author Andy Clement */ public class ParsingTests { @@ -160,7 +160,7 @@ public void testRelOperatorsGE02() { public void testElvis() { parseCheck("3?:1", "3 ?: 1"); } - + // public void testRelOperatorsIn01() { // parseCheck("3 in {1,2,3,4,5}", "(3 in {1,2,3,4,5})"); // } @@ -399,14 +399,14 @@ public void testAssignmentToVariables01() { parseCheck("#var1='value1'"); } - + // ternary operator - + @Test public void testTernaryOperator01() { parseCheck("1>2?3:4","(1 > 2) ? 3 : 4"); } - + // public void testTernaryOperator01() { // parseCheck("{1}.#isEven(#this) == 'y'?'it is even':'it is odd'", // "({1}.#isEven(#this) == 'y') ? 'it is even' : 'it is odd'"); @@ -432,16 +432,16 @@ public void testTypeReferences01() { public void testTypeReferences02() { parseCheck("T(String)"); } - + @Test public void testInlineList1() { parseCheck("{1,2,3,4}"); } - + /** * Parse the supplied expression and then create a string representation of the resultant AST, it should be the same * as the original expression. - * + * * @param expression the expression to parse *and* the expected value of the string form of the resultant AST */ public void parseCheck(String expression) { @@ -451,13 +451,13 @@ public void parseCheck(String expression) { /** * Parse the supplied expression and then create a string representation of the resultant AST, it should be the * expected value. - * + * * @param expression the expression to parse * @param expectedStringFormOfAST the expected string form of the AST */ public void parseCheck(String expression, String expectedStringFormOfAST) { try { - SpelExpression e = (SpelExpression) parser.parseRaw(expression); + SpelExpression e = parser.parseRaw(expression); if (e != null && !e.toStringAST().equals(expectedStringFormOfAST)) { SpelUtilities.printAbstractSyntaxTree(System.err, e); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java index 126cb718ce88..80bf1c32b543 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Tests the evaluation of real expressions in a real context. - * + * * @author Andy Clement */ public class PerformanceTests { @@ -40,7 +40,7 @@ public class PerformanceTests { private static EvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext(); private static final boolean DEBUG = false; - + @Test public void testPerformanceOfPropertyAccess() throws Exception { long starttime = 0; @@ -54,7 +54,7 @@ public void testPerformanceOfPropertyAccess() throws Exception { } expr.getValue(eContext); } - + starttime = System.currentTimeMillis(); for (int i = 0; i < ITERATIONS; i++) { Expression expr = parser.parseExpression("placeOfBirth.city"); @@ -92,7 +92,7 @@ public void testPerformanceOfPropertyAccess() throws Exception { public void testPerformanceOfMethodAccess() throws Exception { long starttime = 0; long endtime = 0; - + // warmup for (int i = 0; i < ITERATIONS; i++) { Expression expr = parser.parseExpression("getPlaceOfBirth().getCity()"); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java b/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java index fa05420e4511..5bc84c9d3805 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java @@ -40,7 +40,7 @@ ///CLOVER:OFF /** * Spring Security scenarios from https://wiki.springsource.com/display/SECURITY/Spring+Security+Expression-based+Authorization - * + * * @author Andy Clement */ public class ScenariosForSpringSecurity extends ExpressionTestCase { @@ -55,7 +55,7 @@ public void testScenario01_Roles() throws Exception { ctx.setRootObject(new Person("Ben")); Boolean value = expr.getValue(ctx,Boolean.class); Assert.assertFalse(value); - + ctx.setRootObject(new Manager("Luke")); value = expr.getValue(ctx,Boolean.class); Assert.assertTrue(value); @@ -72,7 +72,7 @@ public void testScenario02_ComparingNames() throws Exception { StandardEvaluationContext ctx = new StandardEvaluationContext(); ctx.addPropertyAccessor(new SecurityPrincipalAccessor()); - + // Multiple options for supporting this expression: "p.name == principal.name" // (1) If the right person is the root context object then "name==principal.name" is good enough Expression expr = parser.parseRaw("name == principal.name"); @@ -80,22 +80,22 @@ public void testScenario02_ComparingNames() throws Exception { ctx.setRootObject(new Person("Andy")); Boolean value = expr.getValue(ctx,Boolean.class); Assert.assertTrue(value); - + ctx.setRootObject(new Person("Christian")); value = expr.getValue(ctx,Boolean.class); Assert.assertFalse(value); // (2) Or register an accessor that can understand 'p' and return the right person expr = parser.parseRaw("p.name == principal.name"); - + PersonAccessor pAccessor = new PersonAccessor(); ctx.addPropertyAccessor(pAccessor); ctx.setRootObject(null); - + pAccessor.setPerson(new Person("Andy")); value = expr.getValue(ctx,Boolean.class); Assert.assertTrue(value); - + pAccessor.setPerson(new Person("Christian")); value = expr.getValue(ctx,Boolean.class); Assert.assertFalse(value); @@ -105,18 +105,18 @@ public void testScenario02_ComparingNames() throws Exception { public void testScenario03_Arithmetic() throws Exception { SpelExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext ctx = new StandardEvaluationContext(); - + // Might be better with a as a variable although it would work as a property too... // Variable references using a '#' Expression expr = parser.parseRaw("(hasRole('SUPERVISOR') or (#a < 1.042)) and hasIpAddress('10.10.0.0/16')"); Boolean value = null; - + ctx.setVariable("a",1.0d); // referenced as #a in the expression ctx.setRootObject(new Supervisor("Ben")); // so non-qualified references 'hasRole()' 'hasIpAddress()' are invoked against it value = expr.getValue(ctx,Boolean.class); Assert.assertTrue(value); - + ctx.setRootObject(new Manager("Luke")); ctx.setVariable("a",1.043d); value = expr.getValue(ctx,Boolean.class); @@ -128,7 +128,7 @@ public void testScenario03_Arithmetic() throws Exception { public void testScenario04_ControllingWhichMethodsRun() throws Exception { SpelExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext ctx = new StandardEvaluationContext(); - + ctx.setRootObject(new Supervisor("Ben")); // so non-qualified references 'hasRole()' 'hasIpAddress()' are invoked against it); ctx.addMethodResolver(new MyMethodResolver()); // NEEDS TO OVERRIDE THE REFLECTION ONE - SHOW REORDERING MECHANISM @@ -138,17 +138,17 @@ public void testScenario04_ControllingWhichMethodsRun() throws Exception { Expression expr = parser.parseRaw("(hasRole(3) or (#a < 1.042)) and hasIpAddress('10.10.0.0/16')"); Boolean value = null; - + ctx.setVariable("a",1.0d); // referenced as #a in the expression value = expr.getValue(ctx,Boolean.class); Assert.assertTrue(value); - + // ctx.setRootObject(new Manager("Luke")); // ctx.setVariable("a",1.043d); // value = (Boolean)expr.getValue(ctx,Boolean.class); // assertFalse(value); } - + static class Person { @@ -236,7 +236,7 @@ public void write(EvaluationContext context, Object target, String name, Object public Class[] getSpecificTargetClasses() { return null; } - + } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java index 30f68a4053b7..5c218a67844f 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public void selectionWithList() throws Exception { EvaluationContext context = new StandardEvaluationContext(new ListTestBean()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(5, list.size()); assertEquals(0, list.get(0)); assertEquals(1, list.get(1)); @@ -79,7 +79,7 @@ public void selectionWithSet() throws Exception { EvaluationContext context = new StandardEvaluationContext(new SetTestBean()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(5, list.size()); assertEquals(0, list.get(0)); assertEquals(1, list.get(1)); @@ -221,7 +221,7 @@ public void projectionWithList() throws Exception { context.setVariable("testList", IntegerTestBean.createList()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(3, list.size()); assertEquals(5, list.get(0)); assertEquals(6, list.get(1)); @@ -235,7 +235,7 @@ public void projectionWithSet() throws Exception { context.setVariable("testList", IntegerTestBean.createSet()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(3, list.size()); assertEquals(5, list.get(0)); assertEquals(6, list.get(1)); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java index 45ddcf23946c..30158dca0a8f 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ /** * Tests set value expressions. - * + * * @author Keith Donald * @author Andy Clement */ @@ -43,7 +43,7 @@ public class SetValueTests extends ExpressionTestCase { public void testSetProperty() { setValue("wonNobelPrize", true); } - + @Test public void testSetNestedProperty() { setValue("placeOfBirth.city", "Wien"); @@ -89,17 +89,17 @@ public void testSetArrayElementValueAllPrimitiveTypesErrors() { setValueExpectError("arrayContainer.bytes[1]", "NaB"); setValueExpectError("arrayContainer.chars[1]", "NaC"); } - + @Test public void testSetArrayElementNestedValue() { setValue("placesLived[0].city", "Wien"); } - + @Test public void testSetListElementValue() { setValue("placesLivedList[0]", new PlaceOfBirth("Wien")); } - + @Test public void testSetGenericListElementValueTypeCoersion() { // TODO currently failing since setValue does a getValue and "Wien" string != PlaceOfBirth - check with andy @@ -110,7 +110,7 @@ public void testSetGenericListElementValueTypeCoersion() { public void testSetGenericListElementValueTypeCoersionOK() { setValue("booleanList[0]", "true", Boolean.TRUE); } - + @Test public void testSetListElementNestedValue() { setValue("placesLived[0].city", "Wien"); @@ -121,17 +121,17 @@ public void testSetArrayElementInvalidIndex() { setValueExpectError("placesLived[23]", "Wien"); setValueExpectError("placesLivedList[23]", "Wien"); } - + @Test public void testSetMapElements() { setValue("testMap['montag']","lundi"); } - + @Test public void testIndexingIntoUnsupportedType() { setValueExpectError("'hello'[3]", 'p'); } - + @Test public void testSetPropertyTypeCoersion() { setValue("publicBoolean", "true", Boolean.TRUE); @@ -141,9 +141,9 @@ public void testSetPropertyTypeCoersion() { public void testSetPropertyTypeCoersionThroughSetter() { setValue("SomeProperty", "true", Boolean.TRUE); } - + @Test - public void testAssign() throws Exception { + public void testAssign() throws Exception { StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext(); Expression e = parse("publicName='Andy'"); Assert.assertFalse(e.isWritable(eContext)); @@ -158,32 +158,32 @@ public void testSetGenericMapElementRequiresCoercion() throws Exception { StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext(); Expression e = parse("mapOfStringToBoolean[42]"); Assert.assertNull(e.getValue(eContext)); - + // Key should be coerced to string representation of 42 e.setValue(eContext, "true"); - + // All keys should be strings - Set ks = parse("mapOfStringToBoolean.keySet()").getValue(eContext,Set.class); + Set ks = parse("mapOfStringToBoolean.keySet()").getValue(eContext,Set.class); for (Object o: ks) { Assert.assertEquals(String.class,o.getClass()); } - + // All values should be booleans - Collection vs = parse("mapOfStringToBoolean.values()").getValue(eContext,Collection.class); + Collection vs = parse("mapOfStringToBoolean.values()").getValue(eContext,Collection.class); for (Object o: vs) { Assert.assertEquals(Boolean.class,o.getClass()); } - + // One final test check coercion on the key for a map lookup Object o = e.getValue(eContext); Assert.assertEquals(Boolean.TRUE,o); } - + private Expression parse(String expressionString) throws Exception { return parser.parseExpression(expressionString); } - + /** * Call setValue() but expect it to fail. */ diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java index 1dad2431208d..b4d5f4be7ad2 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,9 @@ package org.springframework.expression.spel; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; + import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -38,17 +41,17 @@ /** * Test the examples specified in the documentation. - * + * * NOTE: any outgoing changes from this file upon synchronizing with the repo may indicate that * you need to update the documentation too ! - * + * * @author Andy Clement */ public class SpelDocumentationTests extends ExpressionTestCase { static Inventor tesla ; static Inventor pupin ; - + static { GregorianCalendar c = new GregorianCalendar(); c.set(1856, 7, 9); @@ -60,18 +63,20 @@ public class SpelDocumentationTests extends ExpressionTestCase { pupin = new Inventor("Pupin", c.getTime(), "Idvor"); pupin.setPlaceOfBirth(new PlaceOfBirth("Idvor")); - + } + + @SuppressWarnings("rawtypes") static class IEEE { private String name; - - + + public Inventor[] Members = new Inventor[1]; public List Members2 = new ArrayList(); public Map officers = new HashMap(); - + public List> reverse = new ArrayList>(); - + @SuppressWarnings("unchecked") IEEE() { officers.put("president",pupin); @@ -80,28 +85,28 @@ static class IEEE { officers.put("advisors",linv); Members2.add(tesla); Members2.add(pupin); - + reverse.add(officers); } - + public boolean isMember(String name) { return true; } - + public String getName() { return name; } public void setName(String n) { this.name = n; } } - + @Test public void testMethodInvocation() { evaluate("'Hello World'.concat('!')","Hello World!",String.class); } - + @Test public void testBeanPropertyAccess() { evaluate("new String('Hello World'.bytes)","Hello World",String.class); } - + @Test public void testArrayLengthAccess() { evaluate("'Hello World'.bytes.length",11,Integer.class); @@ -123,12 +128,12 @@ public void testRootObject() throws Exception { String name = (String) exp.getValue(context); Assert.assertEquals("Nikola Tesla",name); - } - + } + @Test public void testEqualityCheck() throws Exception { ExpressionParser parser = new SpelExpressionParser(); - + StandardEvaluationContext context = new StandardEvaluationContext(); context.setRootObject(tesla); @@ -136,14 +141,14 @@ public void testEqualityCheck() throws Exception { boolean isEqual = exp.getValue(context, Boolean.class); // evaluates to true Assert.assertTrue(isEqual); } - + // Section 7.4.1 - + @Test public void testXMLBasedConfig() { evaluate("(T(java.lang.Math).random() * 100.0 )>0",true,Boolean.class); } - + // Section 7.5 @Test public void testLiterals() throws Exception { @@ -151,16 +156,16 @@ public void testLiterals() throws Exception { String helloWorld = (String) parser.parseExpression("'Hello World'").getValue(); // evals to "Hello World" Assert.assertEquals("Hello World",helloWorld); - - double avogadrosNumber = (Double) parser.parseExpression("6.0221415E+23").getValue(); + + double avogadrosNumber = (Double) parser.parseExpression("6.0221415E+23").getValue(); Assert.assertEquals(6.0221415E+23,avogadrosNumber); - + int maxValue = (Integer) parser.parseExpression("0x7FFFFFFF").getValue(); // evals to 2147483647 Assert.assertEquals(Integer.MAX_VALUE,maxValue); - + boolean trueValue = (Boolean) parser.parseExpression("true").getValue(); Assert.assertTrue(trueValue); - + Object nullValue = parser.parseExpression("null").getValue(); Assert.assertNull(nullValue); } @@ -170,11 +175,11 @@ public void testPropertyAccess() throws Exception { EvaluationContext context = TestScenarioCreator.getTestEvaluationContext(); int year = (Integer) parser.parseExpression("Birthdate.Year + 1900").getValue(context); // 1856 Assert.assertEquals(1856,year); - + String city = (String) parser.parseExpression("placeOfBirth.City").getValue(context); Assert.assertEquals("SmilJan",city); } - + @Test public void testPropertyNavigation() throws Exception { ExpressionParser parser = new SpelExpressionParser(); @@ -184,7 +189,7 @@ public void testPropertyNavigation() throws Exception { // teslaContext.setRootObject(tesla); // evaluates to "Induction motor" - String invention = parser.parseExpression("inventions[3]").getValue(teslaContext, String.class); + String invention = parser.parseExpression("inventions[3]").getValue(teslaContext, String.class); Assert.assertEquals("Induction motor",invention); // Members List @@ -196,35 +201,37 @@ public void testPropertyNavigation() throws Exception { // evaluates to "Nikola Tesla" String name = parser.parseExpression("Members[0].Name").getValue(societyContext, String.class); Assert.assertEquals("Nikola Tesla",name); - + // List and Array navigation // evaluates to "Wireless communication" invention = parser.parseExpression("Members[0].Inventions[6]").getValue(societyContext, String.class); Assert.assertEquals("Wireless communication",invention); } - - + + @Test public void testDictionaryAccess() throws Exception { StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); // Officer's Dictionary Inventor pupin = parser.parseExpression("officers['president']").getValue(societyContext, Inventor.class); + assertThat(pupin.getName(), is("Pupin")); // evaluates to "Idvor" String city = parser.parseExpression("officers['president'].PlaceOfBirth.city").getValue(societyContext, String.class); + assertThat(city, is("Idvor")); // setting values Inventor i = parser.parseExpression("officers['advisors'][0]").getValue(societyContext,Inventor.class); Assert.assertEquals("Nikola Tesla",i.getName()); - + parser.parseExpression("officers['advisors'][0].PlaceOfBirth.Country").setValue(societyContext, "Croatia"); Inventor i2 = parser.parseExpression("reverse[0]['advisors'][0]").getValue(societyContext,Inventor.class); Assert.assertEquals("Nikola Tesla",i2.getName()); } - + // 7.5.3 @Test @@ -232,16 +239,16 @@ public void testMethodInvocation2() throws Exception { // string literal, evaluates to "bc" String c = parser.parseExpression("'abc'.substring(1, 3)").getValue(String.class); Assert.assertEquals("bc",c); - + StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); // evaluates to true boolean isMember = parser.parseExpression("isMember('Mihajlo Pupin')").getValue(societyContext, Boolean.class); Assert.assertTrue(isMember); } - + // 7.5.4.1 - + @Test public void testRelationalOperators() throws Exception { boolean result = parser.parseExpression("2 == 2").getValue(Boolean.class); @@ -249,18 +256,18 @@ public void testRelationalOperators() throws Exception { // evaluates to false result = parser.parseExpression("2 < -5.0").getValue(Boolean.class); Assert.assertFalse(result); - + // evaluates to true result = parser.parseExpression("'black' < 'block'").getValue(Boolean.class); Assert.assertTrue(result); } - + @Test public void testOtherOperators() throws Exception { // evaluates to false boolean falseValue = parser.parseExpression("'xyz' instanceof T(int)").getValue(Boolean.class); Assert.assertFalse(falseValue); - + // evaluates to true boolean trueValue = parser.parseExpression("'5.00' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class); Assert.assertTrue(trueValue); @@ -269,15 +276,15 @@ public void testOtherOperators() throws Exception { falseValue = parser.parseExpression("'5.0067' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class); Assert.assertFalse(falseValue); } - + // 7.5.4.2 - + @Test public void testLogicalOperators() throws Exception { StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); - + // -- AND -- // evaluates to false @@ -292,12 +299,12 @@ public void testLogicalOperators() throws Exception { // evaluates to true trueValue = parser.parseExpression("true or false").getValue(Boolean.class); Assert.assertTrue(trueValue); - + // evaluates to true expression = "isMember('Nikola Tesla') or isMember('Albert Einstien')"; trueValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class); Assert.assertTrue(trueValue); - + // -- NOT -- // evaluates to false @@ -310,56 +317,56 @@ public void testLogicalOperators() throws Exception { falseValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class); Assert.assertFalse(falseValue); } - + // 7.5.4.3 - + @Test public void testNumericalOperators() throws Exception { // Addition int two = parser.parseExpression("1 + 1").getValue(Integer.class); // 2 Assert.assertEquals(2,two); - + String testString = parser.parseExpression("'test' + ' ' + 'string'").getValue(String.class); // 'test string' Assert.assertEquals("test string",testString); - + // Subtraction int four = parser.parseExpression("1 - -3").getValue(Integer.class); // 4 Assert.assertEquals(4,four); - + double d = parser.parseExpression("1000.00 - 1e4").getValue(Double.class); // -9000 Assert.assertEquals(-9000.0d,d); - + // Multiplication int six = parser.parseExpression("-2 * -3").getValue(Integer.class); // 6 Assert.assertEquals(6,six); - + double twentyFour = parser.parseExpression("2.0 * 3e0 * 4").getValue(Double.class); // 24.0 Assert.assertEquals(24.0d,twentyFour); - + // Division int minusTwo = parser.parseExpression("6 / -3").getValue(Integer.class); // -2 Assert.assertEquals(-2,minusTwo); - + double one = parser.parseExpression("8.0 / 4e0 / 2").getValue(Double.class); // 1.0 Assert.assertEquals(1.0d,one); // Modulus int three = parser.parseExpression("7 % 4").getValue(Integer.class); // 3 Assert.assertEquals(3,three); - + int oneInt = parser.parseExpression("8 / 5 % 2").getValue(Integer.class); // 1 Assert.assertEquals(1,oneInt); - + // Operator precedence int minusTwentyOne = parser.parseExpression("1+2-3*8").getValue(Integer.class); // -21 Assert.assertEquals(-21,minusTwentyOne); } // 7.5.5 - + @Test public void testAssignment() throws Exception { - Inventor inventor = new Inventor(); + Inventor inventor = new Inventor(); StandardEvaluationContext inventorContext = new StandardEvaluationContext(); inventorContext.setRootObject(inventor); @@ -372,32 +379,32 @@ public void testAssignment() throws Exception { Assert.assertEquals("Alexandar Seovic",parser.parseExpression("foo").getValue(inventorContext,String.class)); Assert.assertEquals("Alexandar Seovic",aleks); } - + // 7.5.6 - + @Test public void testTypes() throws Exception { - Class dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class.class); + Class dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class.class); Assert.assertEquals(Date.class,dateClass); boolean trueValue = parser.parseExpression("T(java.math.RoundingMode).CEILING < T(java.math.RoundingMode).FLOOR").getValue(Boolean.class); Assert.assertTrue(trueValue); } - + // 7.5.7 - + @Test public void testConstructors() throws Exception { StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); - Inventor einstein = + Inventor einstein = parser.parseExpression("new org.springframework.expression.spel.testresources.Inventor('Albert Einstein',new java.util.Date(), 'German')").getValue(Inventor.class); Assert.assertEquals("Albert Einstein", einstein.getName()); //create new inventor instance within add method of List parser.parseExpression("Members2.add(new org.springframework.expression.spel.testresources.Inventor('Albert Einstein', 'German'))").getValue(societyContext); } - + // 7.5.8 - + @Test public void testVariables() throws Exception { Inventor tesla = new Inventor("Nikola Tesla", "Serbian"); @@ -410,7 +417,7 @@ public void testVariables() throws Exception { Assert.assertEquals("Mike Tesla",tesla.getFoo()); } - + @SuppressWarnings("unchecked") @Test public void testSpecialVariables() throws Exception { @@ -427,45 +434,45 @@ public void testSpecialVariables() throws Exception { List primesGreaterThanTen = (List) parser.parseExpression("#primes.?[#this>10]").getValue(context); Assert.assertEquals("[11, 13, 17]",primesGreaterThanTen.toString()); } - + // 7.5.9 - + @Test public void testFunctions() throws Exception { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(); - context.registerFunction("reverseString", + context.registerFunction("reverseString", StringUtils.class.getDeclaredMethod("reverseString", new Class[] { String.class })); String helloWorldReversed = parser.parseExpression("#reverseString('hello world')").getValue(context, String.class); Assert.assertEquals("dlrow olleh",helloWorldReversed); } - + // 7.5.10 - + @Test public void testTernary() throws Exception { String falseString = parser.parseExpression("false ? 'trueExp' : 'falseExp'").getValue(String.class); Assert.assertEquals("falseExp",falseString); - + StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); - + parser.parseExpression("Name").setValue(societyContext, "IEEE"); societyContext.setVariable("queryName", "Nikola Tesla"); - String expression = "isMember(#queryName)? #queryName + ' is a member of the ' " + + String expression = "isMember(#queryName)? #queryName + ' is a member of the ' " + "+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'"; String queryResultString = parser.parseExpression(expression).getValue(societyContext, String.class); Assert.assertEquals("Nikola Tesla is a member of the IEEE Society",queryResultString); // queryResultString = "Nikola Tesla is a member of the IEEE Society" } - + // 7.5.11 - + @SuppressWarnings("unchecked") @Test public void testSelection() throws Exception { @@ -475,16 +482,16 @@ public void testSelection() throws Exception { Assert.assertEquals(1,list.size()); Assert.assertEquals("Nikola Tesla",list.get(0).getName()); } - + // 7.5.12 - + @Test public void testTemplating() throws Exception { - String randomPhrase = + String randomPhrase = parser.parseExpression("random number is ${T(java.lang.Math).random()}", new TemplatedParserContext()).getValue(String.class); Assert.assertTrue(randomPhrase.startsWith("random number")); } - + static class TemplatedParserContext implements ParserContext { public String getExpressionPrefix() { @@ -494,12 +501,12 @@ public String getExpressionPrefix() { public String getExpressionSuffix() { return "}"; } - + public boolean isTemplate() { return true; } } - + static class StringUtils { public static String reverseString(String input) { @@ -510,6 +517,6 @@ public static String reverseString(String input) { return backwards.toString(); } } - + } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelUtilities.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelUtilities.java index 1833cc983a0c..8c3f134774df 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelUtilities.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelUtilities.java @@ -23,7 +23,7 @@ /** * Utilities for working with Spring Expressions. - * + * * @author Andy Clement */ public class SpelUtilities { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java index 16dae3796c41..bdc112a4ef73 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java @@ -25,7 +25,7 @@ /** * Unit tests for type comparison - * + * * @author Andy Clement */ public class StandardTypeLocatorTests { @@ -35,7 +35,7 @@ public void testImports() throws EvaluationException { StandardTypeLocator locator = new StandardTypeLocator(); Assert.assertEquals(Integer.class,locator.findType("java.lang.Integer")); Assert.assertEquals(String.class,locator.findType("java.lang.String")); - + List prefixes = locator.getImportPrefixes(); Assert.assertEquals(1,prefixes.size()); Assert.assertTrue(prefixes.contains("java.lang")); @@ -44,7 +44,7 @@ public void testImports() throws EvaluationException { Assert.assertEquals(Boolean.class,locator.findType("Boolean")); // currently does not know about java.util by default // assertEquals(java.util.List.class,locator.findType("List")); - + try { locator.findType("URL"); Assert.fail("Should have failed"); @@ -54,7 +54,7 @@ public void testImports() throws EvaluationException { } locator.registerImport("java.net"); Assert.assertEquals(java.net.URL.class,locator.findType("URL")); - + } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java index 0ce7fc583780..201944098d2e 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java @@ -91,7 +91,7 @@ public void testParsingSimpleTemplateExpression04() throws Exception { Expression expr = parser.parseExpression("${'hello'} world", DEFAULT_TEMPLATE_PARSER_CONTEXT); Object o = expr.getValue(); Assert.assertEquals("hello world", o.toString()); - + expr = parser.parseExpression("", DEFAULT_TEMPLATE_PARSER_CONTEXT); o = expr.getValue(); Assert.assertEquals("", o.toString()); @@ -135,7 +135,7 @@ public void testCompositeStringExpression() throws Exception { Assert.assertEquals(String.class,ex.getValueType(ctx, new Rooty())); Assert.assertEquals(String.class,ex.getValueTypeDescriptor(new Rooty()).getType()); Assert.assertEquals(String.class,ex.getValueTypeDescriptor(ctx, new Rooty()).getType()); - + try { ex.setValue(ctx, null); Assert.fail(); @@ -155,9 +155,9 @@ public void testCompositeStringExpression() throws Exception { // success } } - + static class Rooty {} - + @Test public void testNestedExpressions() throws Exception { SpelExpressionParser parser = new SpelExpressionParser(); @@ -179,22 +179,22 @@ public void testNestedExpressions() throws Exception { ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#this<5]} ${listOfNumbersUpToTen.$[#this>5]} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); Assert.assertEquals("hello 4 10 world",s); - + try { ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#this<5]} ${listOfNumbersUpToTen.$[#this>5] world",DEFAULT_TEMPLATE_PARSER_CONTEXT); Assert.fail("Should have failed"); } catch (ParseException pe) { Assert.assertEquals("No ending suffix '}' for expression starting at character 41: ${listOfNumbersUpToTen.$[#this>5] world",pe.getMessage()); - } - + } + try { ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#root.listOfNumbersUpToTen.$[#this%2==1==3]} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); Assert.fail("Should have failed"); } catch (ParseException pe) { Assert.assertEquals("Found closing '}' at position 74 but most recent opening is '[' at position 30",pe.getMessage()); - } + } } - + @Test public void testClashingWithSuffixes() throws Exception { @@ -211,7 +211,7 @@ public void testClashingWithSuffixes() throws Exception { s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); Assert.assertEquals("hello 7 wo}rld",s); } - + @Test public void testParsingNormalExpressionThroughTemplateParser() throws Exception { Expression expr = parser.parseExpression("1+2+3"); @@ -219,7 +219,7 @@ public void testParsingNormalExpressionThroughTemplateParser() throws Exception expr = parser.parseExpression("1+2+3",null); Assert.assertEquals(6,expr.getValue()); } - + @Test public void testErrorCases() throws Exception { try { @@ -240,29 +240,29 @@ public void testErrorCases() throws Exception { Assert.fail("Should have failed"); } catch (ParseException pe) { Assert.assertEquals("No expression defined within delimiter '${}' at character 6",pe.getMessage()); - } + } } @Test public void testTemplateParserContext() { TemplateParserContext tpc = new TemplateParserContext("abc","def"); Assert.assertEquals("abc", tpc.getExpressionPrefix()); - Assert.assertEquals("def", tpc.getExpressionSuffix()); + Assert.assertEquals("def", tpc.getExpressionSuffix()); Assert.assertTrue(tpc.isTemplate()); tpc = new TemplateParserContext(); Assert.assertEquals("#{", tpc.getExpressionPrefix()); - Assert.assertEquals("}", tpc.getExpressionSuffix()); + Assert.assertEquals("}", tpc.getExpressionSuffix()); Assert.assertTrue(tpc.isTemplate()); - + ParserContext pc = ParserContext.TEMPLATE_EXPRESSION; Assert.assertEquals("#{", pc.getExpressionPrefix()); - Assert.assertEquals("}", pc.getExpressionSuffix()); + Assert.assertEquals("}", pc.getExpressionSuffix()); Assert.assertTrue(pc.isTemplate()); } - + // --- - + private void checkString(String expectedString, Object value) { if (!(value instanceof String)) { Assert.fail("Result was not a string, it was of type " + value.getClass() + " (value=" + value + ")"); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java index f34ac8a1b643..d2cd8d949419 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java @@ -25,7 +25,7 @@ /** * Tests the evaluation of expressions that access variables and functions (lambda/java). - * + * * @author Andy Clement */ public class VariableAndFunctionTests extends ExpressionTestCase { @@ -35,7 +35,7 @@ public void testVariableAccess01() { evaluate("#answer", "42", Integer.class, SHOULD_BE_WRITABLE); evaluate("#answer / 2", 21, Integer.class, SHOULD_NOT_BE_WRITABLE); } - + @Test public void testVariableAccess_WellKnownVariables() { evaluate("#this.getName()","Nikola Tesla",String.class); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ast/FormatHelperTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ast/FormatHelperTests.java index b40ec92a984a..f9afe18d490a 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ast/FormatHelperTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ast/FormatHelperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,13 +28,13 @@ * @author Andy Wilkinson */ public class FormatHelperTests { - + @Test public void formatMethodWithSingleArgumentForMessage() { String message = FormatHelper.formatMethodForMessage("foo", Arrays.asList(TypeDescriptor.forObject("a string"))); assertEquals("foo(java.lang.String)", message); } - + @Test public void formatMethodWithMultipleArgumentsForMessage() { String message = FormatHelper.formatMethodForMessage("foo", Arrays.asList(TypeDescriptor.forObject("a string"), TypeDescriptor.forObject(Integer.valueOf(5)))); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/standard/PropertiesConversionSpelTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/standard/PropertiesConversionSpelTests.java index bf3435d55bd7..462d61995c78 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/standard/PropertiesConversionSpelTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/standard/PropertiesConversionSpelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/standard/SpelParserTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/standard/SpelParserTests.java index 568969d2ae7b..ac7f6e324e51 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/standard/SpelParserTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/standard/SpelParserTests.java @@ -52,7 +52,7 @@ public void valueType() throws Exception { SpelExpressionParser parser = new SpelExpressionParser(); EvaluationContext ctx = new StandardEvaluationContext(); Class c = parser.parseRaw("2").getValueType(); - assertEquals(Integer.class, c); + Assert.assertEquals(Integer.class,c); c = parser.parseRaw("12").getValueType(ctx); assertEquals(Integer.class, c); c = parser.parseRaw("null").getValueType(); @@ -67,7 +67,7 @@ public void valueType() throws Exception { public void whitespace() throws EvaluationException, ParseException { SpelExpressionParser parser = new SpelExpressionParser(); SpelExpression expr = parser.parseRaw("2 + 3"); - assertEquals(5, expr.getValue()); + Assert.assertEquals(5,expr.getValue()); expr = parser.parseRaw("2 + 3"); assertEquals(5, expr.getValue()); expr = parser.parseRaw("2\n+\t3"); @@ -250,34 +250,15 @@ public void booleanOperators_symbolic_spr9614() throws EvaluationException, Pars @Test public void stringLiterals() throws EvaluationException, ParseException { SpelExpression expr = new SpelExpressionParser().parseRaw("'howdy'"); - assertEquals("howdy", expr.getValue()); + Assert.assertEquals("howdy",expr.getValue()); expr = new SpelExpressionParser().parseRaw("'hello '' world'"); - assertEquals("hello ' world", expr.getValue()); + Assert.assertEquals("hello ' world",expr.getValue()); } @Test public void stringLiterals2() throws EvaluationException, ParseException { SpelExpression expr = new SpelExpressionParser().parseRaw("'howdy'.substring(0,2)"); - assertEquals("ho", expr.getValue()); - } - - @Test - public void testStringLiterals_DoubleQuotes_spr9620() throws Exception { - SpelExpression expr = new SpelExpressionParser().parseRaw("\"double quote: \"\".\""); - assertEquals("double quote: \".", expr.getValue()); - expr = new SpelExpressionParser().parseRaw("\"hello \"\" world\""); - assertEquals("hello \" world", expr.getValue()); - } - - @Test - public void testStringLiterals_DoubleQuotes_spr9620_2() throws Exception { - try { - new SpelExpressionParser().parseRaw("\"double quote: \\\"\\\".\""); - fail("Should have failed"); - } catch (SpelParseException spe) { - assertEquals(17, spe.getPosition()); - assertEquals(SpelMessage.UNEXPECTED_ESCAPE_CHAR, spe.getMessageCode()); - } + Assert.assertEquals("ho",expr.getValue()); } @Test @@ -289,8 +270,8 @@ public void positionalInformation() throws EvaluationException, ParseException { SpelNode rightOrOperand = operatorOr.getRightOperand(); // check position for final 'false' - assertEquals(17, rightOrOperand.getStartPosition()); - assertEquals(22, rightOrOperand.getEndPosition()); + Assert.assertEquals(17, rightOrOperand.getStartPosition()); + Assert.assertEquals(22, rightOrOperand.getEndPosition()); // check position for first 'true' assertEquals(0, operatorAnd.getLeftOperand().getStartPosition()); @@ -301,8 +282,8 @@ public void positionalInformation() throws EvaluationException, ParseException { assertEquals(13, operatorAnd.getRightOperand().getEndPosition()); // check position for OperatorAnd - assertEquals(5, operatorAnd.getStartPosition()); - assertEquals(8, operatorAnd.getEndPosition()); + Assert.assertEquals(5, operatorAnd.getStartPosition()); + Assert.assertEquals(8, operatorAnd.getEndPosition()); // check position for OperatorOr assertEquals(14, operatorOr.getStartPosition()); @@ -316,12 +297,12 @@ public void tokenKind() { assertEquals("NOT(!)", tk.toString()); tk = TokenKind.MINUS; - assertFalse(tk.hasPayload()); - assertEquals("MINUS(-)", tk.toString()); + Assert.assertFalse(tk.hasPayload()); + Assert.assertEquals("MINUS(-)",tk.toString()); tk = TokenKind.LITERAL_STRING; - assertEquals("LITERAL_STRING", tk.toString()); - assertTrue(tk.hasPayload()); + Assert.assertEquals("LITERAL_STRING",tk.toString()); + Assert.assertTrue(tk.hasPayload()); } @Test @@ -355,34 +336,29 @@ public void exceptions() { } @Test - public void parseMethodsOnNumbers() { - checkNumber("3.14.toString()", "3.14", String.class); - checkNumber("3.toString()", "3", String.class); - } - - @Test - public void numerics() { - checkNumber("2", 2, Integer.class); - checkNumber("22", 22, Integer.class); - checkNumber("+22", 22, Integer.class); - checkNumber("-22", -22, Integer.class); + public void testNumerics() { + checkNumber("2",2,Integer.class); + checkNumber("22",22,Integer.class); + checkNumber("+22",22,Integer.class); + checkNumber("-22",-22,Integer.class); - checkNumber("2L", 2L, Long.class); - checkNumber("22l", 22L, Long.class); + checkNumber("2L",2L,Long.class); + checkNumber("22l",22L,Long.class); - checkNumber("0x1", 1, Integer.class); - checkNumber("0x1L", 1L, Long.class); - checkNumber("0xa", 10, Integer.class); - checkNumber("0xAL", 10L, Long.class); + checkNumber("0x1",1,Integer.class); + checkNumber("0x1L",1L,Long.class); + checkNumber("0xa",10,Integer.class); + checkNumber("0xAL",10L,Long.class); - checkNumberError("0x", SpelMessage.NOT_AN_INTEGER); - checkNumberError("0xL", SpelMessage.NOT_A_LONG); + checkNumberError("0x",SpelMessage.NOT_AN_INTEGER); + checkNumberError("0xL",SpelMessage.NOT_A_LONG); - checkNumberError(".324", SpelMessage.UNEXPECTED_DATA_AFTER_DOT); + checkNumberError(".324",SpelMessage.UNEXPECTED_DATA_AFTER_DOT); - checkNumberError("3.4L", SpelMessage.REAL_CANNOT_BE_LONG); + checkNumberError("3.4L",SpelMessage.REAL_CANNOT_BE_LONG); - checkNumber("3.5f", 3.5f, Float.class); + // Number is parsed as a float, but immediately promoted to a double + checkNumber("3.5f",3.5d,Double.class); checkNumber("1.2e3", 1.2e3d, Double.class); checkNumber("1.2e+3", 1.2e3d, Double.class); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java index 2bc87f90fb3f..b3d35fcaae45 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ /** * Tests for any helper code. - * + * * @author Andy Clement */ public class ReflectionHelperTests extends ExpressionTestCase { @@ -53,7 +53,7 @@ public void testFormatHelperForClassName() { Assert.assertEquals("int[][]",FormatHelper.formatClassNameForMessage(new int[1][2].getClass())); Assert.assertEquals("null",FormatHelper.formatClassNameForMessage(null)); } - + /* @Test public void testFormatHelperForMethod() { @@ -62,7 +62,7 @@ public void testFormatHelperForMethod() { Assert.assertEquals("boo()",FormatHelper.formatMethodForMessage("boo")); } */ - + @Test public void testUtilities() throws ParseException { SpelExpression expr = (SpelExpression)parser.parseExpression("3+4+5+6+7-2"); @@ -93,52 +93,52 @@ public void testUtilities() throws ParseException { Assert.assertTrue(s.indexOf("===> Expression '3+4+5+6+7-2' - AST start")!=-1); Assert.assertTrue(s.indexOf(" OpPlus value:((((3 + 4) + 5) + 6) + 7) #children:2")!=-1); } - + @Test public void testTypedValue() { TypedValue tValue = new TypedValue("hello"); Assert.assertEquals(String.class,tValue.getTypeDescriptor().getType()); Assert.assertEquals("TypedValue: 'hello' of [java.lang.String]",tValue.toString()); } - + @Test public void testReflectionHelperCompareArguments_ExactMatching() { StandardTypeConverter typeConverter = new StandardTypeConverter(); - + // Calling foo(String) with (String) is exact match checkMatch(new Class[]{String.class},new Class[]{String.class},typeConverter,ArgsMatchKind.EXACT); - + // Calling foo(String,Integer) with (String,Integer) is exact match checkMatch(new Class[]{String.class,Integer.class},new Class[]{String.class,Integer.class},typeConverter,ArgsMatchKind.EXACT); } - + @Test public void testReflectionHelperCompareArguments_CloseMatching() { StandardTypeConverter typeConverter = new StandardTypeConverter(); - + // Calling foo(List) with (ArrayList) is close match (no conversion required) checkMatch(new Class[]{ArrayList.class},new Class[]{List.class},typeConverter,ArgsMatchKind.CLOSE); - + // Passing (Sub,String) on call to foo(Super,String) is close match checkMatch(new Class[]{Sub.class,String.class},new Class[]{Super.class,String.class},typeConverter,ArgsMatchKind.CLOSE); - + // Passing (String,Sub) on call to foo(String,Super) is close match checkMatch(new Class[]{String.class,Sub.class},new Class[]{String.class,Super.class},typeConverter,ArgsMatchKind.CLOSE); } - + @Test public void testReflectionHelperCompareArguments_RequiresConversionMatching() { StandardTypeConverter typeConverter = new StandardTypeConverter(); - + // Calling foo(String,int) with (String,Integer) requires boxing conversion of argument one checkMatch(new Class[]{String.class,Integer.TYPE},new Class[]{String.class,Integer.class},typeConverter,ArgsMatchKind.CLOSE,1); // Passing (int,String) on call to foo(Integer,String) requires boxing conversion of argument zero checkMatch(new Class[]{Integer.TYPE,String.class},new Class[]{Integer.class, String.class},typeConverter,ArgsMatchKind.CLOSE,0); - + // Passing (int,Sub) on call to foo(Integer,Super) requires boxing conversion of argument zero checkMatch(new Class[]{Integer.TYPE,Sub.class},new Class[]{Integer.class, Super.class},typeConverter,ArgsMatchKind.CLOSE,0); - + // Passing (int,Sub,boolean) on call to foo(Integer,Super,Boolean) requires boxing conversion of arguments zero and two // TODO checkMatch(new Class[]{Integer.TYPE,Sub.class,Boolean.TYPE},new Class[]{Integer.class, Super.class,Boolean.class},typeConverter,ArgsMatchKind.REQUIRES_CONVERSION,0,2); } @@ -146,7 +146,7 @@ public void testReflectionHelperCompareArguments_RequiresConversionMatching() { @Test public void testReflectionHelperCompareArguments_NotAMatch() { StandardTypeConverter typeConverter = new StandardTypeConverter(); - + // Passing (Super,String) on call to foo(Sub,String) is not a match checkMatch(new Class[]{Super.class,String.class},new Class[]{Sub.class,String.class},typeConverter,null); } @@ -156,16 +156,16 @@ public void testReflectionHelperCompareArguments_Varargs_ExactMatching() { StandardTypeConverter tc = new StandardTypeConverter(); Class stringArrayClass = new String[0].getClass(); Class integerArrayClass = new Integer[0].getClass(); - + // Passing (String[]) on call to (String[]) is exact match checkMatch2(new Class[]{stringArrayClass},new Class[]{stringArrayClass},tc,ArgsMatchKind.EXACT); - + // Passing (Integer, String[]) on call to (Integer, String[]) is exact match checkMatch2(new Class[]{Integer.class,stringArrayClass},new Class[]{Integer.class,stringArrayClass},tc,ArgsMatchKind.EXACT); // Passing (String, Integer, String[]) on call to (String, String, String[]) is exact match checkMatch2(new Class[]{String.class,Integer.class,stringArrayClass},new Class[]{String.class,Integer.class,stringArrayClass},tc,ArgsMatchKind.EXACT); - + // Passing (Sub, String[]) on call to (Super, String[]) is exact match checkMatch2(new Class[]{Sub.class,stringArrayClass},new Class[]{Super.class,stringArrayClass},tc,ArgsMatchKind.CLOSE); @@ -174,10 +174,10 @@ public void testReflectionHelperCompareArguments_Varargs_ExactMatching() { // Passing (Integer, Sub, String[]) on call to (String, Super, String[]) is exact match checkMatch2(new Class[]{Integer.class,Sub.class,String[].class},new Class[]{String.class,Super.class,String[].class},tc,ArgsMatchKind.REQUIRES_CONVERSION,0); - + // Passing (String) on call to (String[]) is exact match checkMatch2(new Class[]{String.class},new Class[]{stringArrayClass},tc,ArgsMatchKind.EXACT); - + // Passing (Integer,String) on call to (Integer,String[]) is exact match checkMatch2(new Class[]{Integer.class,String.class},new Class[]{Integer.class,stringArrayClass},tc,ArgsMatchKind.EXACT); @@ -186,7 +186,7 @@ public void testReflectionHelperCompareArguments_Varargs_ExactMatching() { // Passing (Sub) on call to (Super[]) is close match checkMatch2(new Class[]{Sub.class},new Class[]{new Super[0].getClass()},tc,ArgsMatchKind.CLOSE); - + // Passing (Super) on call to (Sub[]) is not a match checkMatch2(new Class[]{Super.class},new Class[]{new Sub[0].getClass()},tc,null); @@ -261,17 +261,17 @@ public void testConvertArguments2() throws Exception { catch (SpelEvaluationException se) { Assert.assertEquals(SpelMessage.TYPE_CONVERSION_ERROR,se.getMessageCode()); } - + // null value args = new Object[]{3,null,3.0f}; ReflectionHelper.convertAllArguments(tc, args, twoArg); checkArguments(args,"3",null,"3.0"); } - + @Test public void testSetupArguments() { Object[] newArray = ReflectionHelper.setupArgumentsForVarargsInvocation(new Class[]{new String[0].getClass()},"a","b","c"); - + Assert.assertEquals(1,newArray.length); Object firstParam = newArray[0]; Assert.assertEquals(String.class,firstParam.getClass().getComponentType()); @@ -281,7 +281,7 @@ public void testSetupArguments() { Assert.assertEquals("b",firstParamArray[1]); Assert.assertEquals("c",firstParamArray[2]); } - + @Test public void testReflectivePropertyResolver() throws Exception { ReflectivePropertyAccessor rpr = new ReflectivePropertyAccessor(); @@ -295,16 +295,16 @@ public void testReflectivePropertyResolver() throws Exception { Assert.assertTrue(rpr.canRead(ctx, t, "field")); Assert.assertEquals(3,rpr.read(ctx, t, "field").getValue()); Assert.assertEquals(3,rpr.read(ctx, t, "field").getValue()); // cached accessor used - + Assert.assertTrue(rpr.canWrite(ctx, t, "property")); rpr.write(ctx, t, "property","goodbye"); rpr.write(ctx, t, "property","goodbye"); // cached accessor used - + Assert.assertTrue(rpr.canWrite(ctx, t, "field")); rpr.write(ctx, t, "field",12); rpr.write(ctx, t, "field",12); - // Attempted write as first activity on this field and property to drive testing + // Attempted write as first activity on this field and property to drive testing // of populating type descriptor cache rpr.write(ctx,t,"field2",3); rpr.write(ctx, t, "property2","doodoo"); @@ -330,7 +330,7 @@ public void testReflectivePropertyResolver() throws Exception { Assert.assertEquals("id",rpr.read(ctx,t,"Id").getValue()); Assert.assertTrue(rpr.canRead(ctx,t,"Id")); } - + @Test public void testOptimalReflectivePropertyResolver() throws Exception { ReflectivePropertyAccessor rpr = new ReflectivePropertyAccessor(); @@ -340,7 +340,7 @@ public void testOptimalReflectivePropertyResolver() throws Exception { // Assert.assertTrue(rpr.canRead(ctx, t, "property")); // Assert.assertEquals("hello",rpr.read(ctx, t, "property").getValue()); // Assert.assertEquals("hello",rpr.read(ctx, t, "property").getValue()); // cached accessor used - + PropertyAccessor optA = rpr.createOptimalAccessor(ctx, t, "property"); Assert.assertTrue(optA.canRead(ctx, t, "property")); Assert.assertFalse(optA.canRead(ctx, t, "property2")); @@ -405,7 +405,7 @@ public void testOptimalReflectivePropertyResolver() throws Exception { } - + // test classes static class Tester { @@ -426,7 +426,7 @@ static class Tester { public void setProperty2(String value) { property2 = value; } public String getProperty3() { return property3; } - + public boolean isProperty4() { return property4; } public String getiD() { return iD; } @@ -435,21 +435,21 @@ static class Tester { public String getID() { return ID; } } - + static class Super { } - + static class Sub extends Super { } - + static class Unconvertable {} - + // --- - + /** * Used to validate the match returned from a compareArguments call. */ - private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter,ArgsMatchKind expectedMatchKind,int... argsForConversion) { + private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter,ArgsMatchKind expectedMatchKind,int... argsForConversion) { ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter); if (expectedMatchKind==null) { Assert.assertNull("Did not expect them to match in any way", matchInfo); @@ -459,10 +459,10 @@ private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeC if (expectedMatchKind==ArgsMatchKind.EXACT) { Assert.assertTrue(matchInfo.isExactMatch()); - Assert.assertNull(matchInfo.argsRequiringConversion); + Assert.assertNull(matchInfo.argsRequiringConversion); } else if (expectedMatchKind==ArgsMatchKind.CLOSE) { Assert.assertTrue(matchInfo.isCloseMatch()); - Assert.assertNull(matchInfo.argsRequiringConversion); + Assert.assertNull(matchInfo.argsRequiringConversion); } else if (expectedMatchKind==ArgsMatchKind.REQUIRES_CONVERSION) { Assert.assertTrue("expected to be a match requiring conversion, but was "+matchInfo,matchInfo.isMatchRequiringConversion()); if (argsForConversion==null) { @@ -478,7 +478,7 @@ private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeC /** * Used to validate the match returned from a compareArguments call. */ - private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter,ArgsMatchKind expectedMatchKind,int... argsForConversion) { + private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter,ArgsMatchKind expectedMatchKind,int... argsForConversion) { ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArgumentsVarargs(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter); if (expectedMatchKind==null) { Assert.assertNull("Did not expect them to match in any way: "+matchInfo, matchInfo); @@ -488,10 +488,10 @@ private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardType if (expectedMatchKind==ArgsMatchKind.EXACT) { Assert.assertTrue(matchInfo.isExactMatch()); - Assert.assertNull(matchInfo.argsRequiringConversion); + Assert.assertNull(matchInfo.argsRequiringConversion); } else if (expectedMatchKind==ArgsMatchKind.CLOSE) { Assert.assertTrue(matchInfo.isCloseMatch()); - Assert.assertNull(matchInfo.argsRequiringConversion); + Assert.assertNull(matchInfo.argsRequiringConversion); } else if (expectedMatchKind==ArgsMatchKind.REQUIRES_CONVERSION) { Assert.assertTrue("expected to be a match requiring conversion, but was "+matchInfo,matchInfo.isMatchRequiringConversion()); if (argsForConversion==null) { @@ -510,14 +510,14 @@ private void checkArguments(Object[] args, Object... expected) { checkArgument(expected[i],args[i]); } } - + private void checkArgument(Object expected, Object actual) { Assert.assertEquals(expected,actual); } - private List getTypeDescriptors(Class... types) { + private List getTypeDescriptors(Class... types) { List typeDescriptors = new ArrayList(types.length); - for (Class type : types) { + for (Class type : types) { typeDescriptors.add(TypeDescriptor.valueOf(type)); } return typeDescriptors; diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/support/StandardComponentsTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/support/StandardComponentsTests.java index 47c49ba0268f..ab23d3e15729 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/support/StandardComponentsTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/support/StandardComponentsTests.java @@ -43,19 +43,19 @@ public void testStandardEvaluationContext() { context.setTypeLocator(tl); Assert.assertEquals(tl,context.getTypeLocator()); } - + @Test public void testStandardOperatorOverloader() throws EvaluationException { OperatorOverloader oo = new StandardOperatorOverloader(); Assert.assertFalse(oo.overridesOperation(Operation.ADD, null, null)); - try { + try { oo.operate(Operation.ADD, 2, 3); Assert.fail("should have failed"); } catch (EvaluationException e) { // success } } - + @Test public void testStandardTypeLocator() { StandardTypeLocator tl = new StandardTypeLocator(); @@ -68,7 +68,7 @@ public void testStandardTypeLocator() { prefixes = tl.getImportPrefixes(); Assert.assertEquals(1,prefixes.size()); } - + @Test public void testStandardTypeConverter() throws EvaluationException { TypeConverter tc = new StandardTypeConverter(); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/ArrayContainer.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/ArrayContainer.java index fa6d62f444c5..50b08cef1efd 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/ArrayContainer.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/ArrayContainer.java @@ -17,7 +17,7 @@ /** * Hold the various kinds of primitive array for access through the test evaluation context. - * + * * @author Andy Clement */ public class ArrayContainer { @@ -29,7 +29,7 @@ public class ArrayContainer { public short[] shorts = new short[3]; public boolean[] booleans = new boolean[3]; public float[] floats = new float[3]; - + public ArrayContainer() { // setup some values ints[0] = 42; @@ -41,4 +41,4 @@ public ArrayContainer() { booleans[0] = true; floats[0] = 42.0f; } -} \ No newline at end of file +} diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Company.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Company.java index 54a8384ff094..d22526ee671f 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Company.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Company.java @@ -1,12 +1,12 @@ /** - * + * */ package org.springframework.expression.spel.testresources; ///CLOVER:OFF public class Company { String address; - + public Company(String string) { this.address = string; } @@ -14,4 +14,4 @@ public Company(String string) { public String getAddress() { return address; } -} \ No newline at end of file +} diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java index c8a2c7f27f99..cf13ea01cf71 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java @@ -1,5 +1,5 @@ /** - * + * */ package org.springframework.expression.spel.testresources; @@ -11,7 +11,7 @@ public class Fruit { public Color color; // accessible as property through getter/setter public String colorName; // accessible as property through getter/setter public int stringscount = -1; - + public Fruit(String name, Color color, String colorName) { this.name = name; this.color = color; @@ -21,15 +21,15 @@ public Fruit(String name, Color color, String colorName) { public Color getColor() { return color; } - + public Fruit(String... strings) { stringscount = strings.length; } - + public Fruit(int i, String... strings) { stringscount = i + strings.length; } - + public int stringscount() { return stringscount; } @@ -37,4 +37,4 @@ public int stringscount() { public String toString() { return "A" + (colorName != null && colorName.startsWith("o") ? "n " : " ") + colorName + " " + name; } -} \ No newline at end of file +} diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java index 051fe95ca3f5..2869a366bfff 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java @@ -37,7 +37,7 @@ public class Inventor { public String[] stringArrayOfThreeItems = new String[]{"1","2","3"}; private String foo; public int counter; - + public Inventor(String name, Date birthdate, String nationality) { this.name = name; this._name = name; @@ -88,7 +88,7 @@ public void setPlaceOfBirth(PlaceOfBirth placeOfBirth2) { public String[] getInventions() { return inventions; } - + public void setInventions(String[] inventions) { this.inventions = inventions; } @@ -96,7 +96,7 @@ public void setInventions(String[] inventions) { public PlaceOfBirth getPlaceOfBirth() { return placeOfBirth; } - + public int throwException(int valueIn) throws Exception { counter++; if (valueIn==1) { @@ -110,9 +110,9 @@ public int throwException(int valueIn) throws Exception { } return valueIn; } - + static class TestException extends Exception {} - + public String throwException(PlaceOfBirth pob) { return pob.getCity(); } @@ -120,7 +120,7 @@ public String throwException(PlaceOfBirth pob) { public String getName() { return name; } - + public boolean getWonNobelPrize() { return wonNobelPrize; } @@ -152,7 +152,7 @@ public String echo(Object o) { public String sayHelloTo(String person) { return "hello " + person; } - + public String printDouble(Double d) { return d.toString(); } @@ -187,7 +187,7 @@ public int aVarargsMethod2(int i, String... strings) { public Inventor(String... strings) { } - + public boolean getSomeProperty() { return accessedThroughGetSet; } @@ -195,7 +195,7 @@ public boolean getSomeProperty() { public void setSomeProperty(boolean b) { this.accessedThroughGetSet = b; } - + public Date getBirthdate() { return birthdate;} public String getFoo() { return foo; } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Person.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Person.java index 80a432d2566f..9487f87ce64a 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Person.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/Person.java @@ -8,16 +8,16 @@ public class Person { public Person(String name) { this.privateName = name; } - + public Person(String name, Company company) { this.privateName = name; this.company = company; } - + public String getName() { return privateName; } - + public void setName(String n) { this.privateName = n; } @@ -25,4 +25,4 @@ public void setName(String n) { public Company getCompany() { return company; } -} \ No newline at end of file +} diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java index 658855cd7c56..d177c51bad7b 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java @@ -3,9 +3,9 @@ ///CLOVER:OFF public class PlaceOfBirth { private String city; - + public String Country; - + /** * Keith now has a converter that supports String to X, if X has a ctor that takes a String. * In order for round tripping to work we need toString() for X to return what it was @@ -25,11 +25,11 @@ public void setCity(String s) { public PlaceOfBirth(String string) { this.city=string; } - + public int doubleIt(int i) { return i*2; } - + public boolean equals(Object o) { if (!(o instanceof PlaceOfBirth)) { return false; @@ -37,9 +37,9 @@ public boolean equals(Object o) { PlaceOfBirth oPOB = (PlaceOfBirth)o; return (city.equals(oPOB.city)); } - + public int hashCode() { return city.hashCode(); } - -} \ No newline at end of file + +} diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestAddress.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestAddress.java index 0f84c9e85ea5..251703fbc816 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestAddress.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestAddress.java @@ -5,7 +5,7 @@ public class TestAddress{ private String street; private List crossStreets; - + public String getStreet() { return street; } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestPerson.java b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestPerson.java index dca009da128d..78cb049e253e 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestPerson.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/testresources/TestPerson.java @@ -3,7 +3,7 @@ public class TestPerson { private String name; private TestAddress address; - + public String getName() { return name; } @@ -16,4 +16,4 @@ public TestAddress getAddress() { public void setAddress(TestAddress address) { this.address = address; } - } \ No newline at end of file + } diff --git a/spring-instrument-tomcat/src/main/java/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.java b/spring-instrument-tomcat/src/main/java/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.java index 47d2a4ba2935..88fa81d7e2b1 100644 --- a/spring-instrument-tomcat/src/main/java/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.java +++ b/spring-instrument-tomcat/src/main/java/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,8 @@ * Extension of Tomcat's default class loader which adds instrumentation * to loaded classes without the need to use a VM-wide agent. * - *

      To be registered using a - * Loader tag + *

      To be registered using a + * Loader tag * in Tomcat's Context * definition in the server.xml file, with the Spring-provided * "spring-tomcat-weaver.jar" file deployed into Tomcat's "server/lib" (for Tomcat 5.x) or "lib" (for Tomcat 6.x) directory. @@ -148,7 +148,7 @@ private static void shallowCopyFieldState(final Object src, final Object dest) t if (dest == null) { throw new IllegalArgumentException("Destination for field copy cannot be null"); } - Class targetClass = findCommonAncestor(src.getClass(), dest.getClass()); + Class targetClass = findCommonAncestor(src.getClass(), dest.getClass()); // Keep backing up the inheritance hierarchy. do { @@ -178,8 +178,8 @@ private static void shallowCopyFieldState(final Object src, final Object dest) t while (targetClass != null && targetClass != Object.class); } - private static Class findCommonAncestor(Class one, Class two) throws IllegalArgumentException { - Class ancestor = one; + private static Class findCommonAncestor(Class one, Class two) throws IllegalArgumentException { + Class ancestor = one; while (ancestor != Object.class || ancestor != null) { if (ancestor.isAssignableFrom(two)) { return ancestor; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java b/spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java index 4e3389298baa..e61aefdee7e6 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java @@ -32,7 +32,7 @@ * @see InvalidResultSetAccessException */ public class BadSqlGrammarException extends InvalidDataAccessResourceUsageException { - + private String sql; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/UncategorizedSQLException.java b/spring-jdbc/src/main/java/org/springframework/jdbc/UncategorizedSQLException.java index eccba39f5d23..658ec04b324b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/UncategorizedSQLException.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/UncategorizedSQLException.java @@ -21,7 +21,7 @@ import org.springframework.dao.UncategorizedDataAccessException; /** - * Exception thrown when we can't classify a SQLException into + * Exception thrown when we can't classify a SQLException into * one of our generic data access exceptions. * * @author Rod Johnson diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/config/EmbeddedDatabaseBeanDefinitionParser.java b/spring-jdbc/src/main/java/org/springframework/jdbc/config/EmbeddedDatabaseBeanDefinitionParser.java index 23ad7c54ea47..87a467b696c5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/config/EmbeddedDatabaseBeanDefinitionParser.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/config/EmbeddedDatabaseBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/config/InitializeDatabaseBeanDefinitionParser.java b/spring-jdbc/src/main/java/org/springframework/jdbc/config/InitializeDatabaseBeanDefinitionParser.java index 8f7c7fd82b67..718aed0ca67e 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/config/InitializeDatabaseBeanDefinitionParser.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/config/InitializeDatabaseBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/config/SortedResourcesFactoryBean.java b/spring-jdbc/src/main/java/org/springframework/jdbc/config/SortedResourcesFactoryBean.java index 9a54179854df..3f593940fb37 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/config/SortedResourcesFactoryBean.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/config/SortedResourcesFactoryBean.java @@ -42,7 +42,7 @@ * @since 3.0 */ public class SortedResourcesFactoryBean extends AbstractFactoryBean implements ResourceLoaderAware { - + private final List locations; private ResourcePatternResolver resourcePatternResolver; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgTypePreparedStatementSetter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgTypePreparedStatementSetter.java index 235ed6b0f525..0359d15e27e5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgTypePreparedStatementSetter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgTypePreparedStatementSetter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,8 +58,8 @@ public void setValues(PreparedStatement ps) throws SQLException { for (int i = 0; i < this.args.length; i++) { Object arg = this.args[i]; if (arg instanceof Collection && this.argTypes[i] != Types.ARRAY) { - Collection entries = (Collection) arg; - for (Iterator it = entries.iterator(); it.hasNext();) { + Collection entries = (Collection) arg; + for (Iterator it = entries.iterator(); it.hasNext();) { Object entry = it.next(); if (entry instanceof Object[]) { Object[] valueArray = ((Object[])entry); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchPreparedStatementSetter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchPreparedStatementSetter.java index 8a8e523a5b3c..4b95acde8549 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchPreparedStatementSetter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchPreparedStatementSetter.java @@ -38,7 +38,7 @@ */ public interface BatchPreparedStatementSetter { - /** + /** * Set parameter values on the given PreparedStatement. * @param ps the PreparedStatement to invoke setter methods on * @param i index of the statement we're issuing in the batch, starting from 0 @@ -47,7 +47,7 @@ public interface BatchPreparedStatementSetter { */ void setValues(PreparedStatement ps, int i) throws SQLException; - /** + /** * Return the size of the batch. * @return the number of statements in the batch */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchUpdateUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchUpdateUtils.java index 2785e6a1b7f2..b67f4ffdd144 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchUpdateUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/BatchUpdateUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java index 94bdd80c4594..3aba2234c3e8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreator.java index 8a42702394b7..552daf1bd3a8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreator.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,9 +42,9 @@ */ public interface CallableStatementCreator { - /** + /** * Create a callable statement in this connection. Allows implementations to use - * CallableStatements. + * CallableStatements. * @param con Connection to use to create statement * @return a callable statement * @throws SQLException there is no need to catch SQLExceptions diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreatorFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreatorFactory.java index 93f68dd099fc..f5f5d0eed572 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreatorFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/CallableStatementCreatorFactory.java @@ -37,7 +37,7 @@ * @author Thomas Risberg * @author Juergen Hoeller */ -public class CallableStatementCreatorFactory { +public class CallableStatementCreatorFactory { /** The SQL call string, which won't change when the parameters change. */ private final String callString; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java index 634b2c8b89e3..e199293cee43 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java @@ -407,7 +407,7 @@ T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor rse * @see PreparedStatementCreatorFactory */ void query(PreparedStatementCreator psc, RowCallbackHandler rch) throws DataAccessException; - + /** * Query given SQL to create a prepared statement from SQL and a * PreparedStatementSetter implementation that knows how to bind values @@ -423,7 +423,7 @@ T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor rse */ void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch) throws DataAccessException; - + /** * Query given SQL to create a prepared statement from SQL and a list of * arguments to bind to the query, reading the ResultSet on a per-row basis @@ -947,7 +947,7 @@ List queryForList(String sql, Object[] args, int[] argTypes, Class elem * @throws DataAccessException if there is any problem issuing the update */ int update(String sql, PreparedStatementSetter pss) throws DataAccessException; - + /** * Issue a single SQL update operation (such as an insert, update or delete statement) * via a prepared statement, binding the given arguments. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java index 707ffe1482a9..8e98464865f2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java @@ -134,8 +134,8 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { /** * If this variable is set to true then all results from a stored procedure call * that don't have a corresponding SqlOutParameter declaration will be bypassed. - * All other results processing will be take place unless the variable - * skipResultsProcessing is set to true. + * All other results processng will be take place unless the variable + * skipResultsProcessing is set to true */ private boolean skipUndeclaredResults = false; @@ -934,7 +934,7 @@ public int[] batchUpdate(String sql, List batchArgs, int[] argTypes) { /* * (non-Javadoc) * @see org.springframework.jdbc.core.JdbcOperations#batchUpdate(java.lang.String, java.util.Collection, int, org.springframework.jdbc.core.ParameterizedPreparedStatementSetter) - * + * * Contribution by Nicolas Fabre */ public int[][] batchUpdate(String sql, final Collection batchArgs, final int batchSize, final ParameterizedPreparedStatementSetter pss) { @@ -1045,16 +1045,16 @@ public T execute(String callString, CallableStatementCallback action) thr public Map call(CallableStatementCreator csc, List declaredParameters) throws DataAccessException { - final List updateCountParameters = new ArrayList(); - final List resultSetParameters = new ArrayList(); + final List updateCountParameters = new ArrayList(); + final List resultSetParameters = new ArrayList(); final List callParameters = new ArrayList(); for (SqlParameter parameter : declaredParameters) { if (parameter.isResultsParameter()) { if (parameter instanceof SqlReturnResultSet) { - resultSetParameters.add(parameter); + resultSetParameters.add((SqlReturnResultSet) parameter); } else { - updateCountParameters.add(parameter); + updateCountParameters.add((SqlReturnUpdateCount) parameter); } } else { @@ -1086,10 +1086,10 @@ public Map doInCallableStatement(CallableStatement cs) throws SQ * @param resultSetParameters Parameter list of declared resultSet parameters for the stored procedure * @return Map that contains returned results */ - @SuppressWarnings("rawtypes") - protected Map extractReturnedResults( - CallableStatement cs, List updateCountParameters, List resultSetParameters, int updateCount) - throws SQLException { + protected Map extractReturnedResults(CallableStatement cs, + List updateCountParameters, + List resultSetParameters, int updateCount) + throws SQLException { Map returnedResults = new HashMap(); int rsIndex = 0; @@ -1099,7 +1099,7 @@ protected Map extractReturnedResults( do { if (updateCount == -1) { if (resultSetParameters != null && resultSetParameters.size() > rsIndex) { - SqlReturnResultSet declaredRsParam = (SqlReturnResultSet)resultSetParameters.get(rsIndex); + SqlReturnResultSet declaredRsParam = resultSetParameters.get(rsIndex); returnedResults.putAll(processResultSet(cs.getResultSet(), declaredRsParam)); rsIndex++; } @@ -1115,7 +1115,7 @@ protected Map extractReturnedResults( } else { if (updateCountParameters != null && updateCountParameters.size() > updateIndex) { - SqlReturnUpdateCount ucParam = (SqlReturnUpdateCount)updateCountParameters.get(updateIndex); + SqlReturnUpdateCount ucParam = updateCountParameters.get(updateIndex); String declaredUcName = ucParam.getName(); returnedResults.put(declaredUcName, updateCount); updateIndex++; @@ -1190,7 +1190,6 @@ protected Map extractOutputParameters(CallableStatement cs, List * @param param the corresponding stored procedure parameter * @return Map that contains returned results */ - @SuppressWarnings({ "unchecked", "rawtypes" }) protected Map processResultSet(ResultSet rs, ResultSetSupportingSqlParameter param) throws SQLException { if (rs == null) { return Collections.emptyMap(); @@ -1202,8 +1201,8 @@ protected Map processResultSet(ResultSet rs, ResultSetSupporting rsToUse = this.nativeJdbcExtractor.getNativeResultSet(rs); } if (param.getRowMapper() != null) { - RowMapper rowMapper = param.getRowMapper(); - Object result = (new RowMapperResultSetExtractor(rowMapper)).extractData(rsToUse); + RowMapper rowMapper = param.getRowMapper(); + Object result = (new RowMapperResultSetExtractor(rowMapper)).extractData(rsToUse); returnedResults.put(param.getName(), result); } else if (param.getRowCallbackHandler() != null) { @@ -1382,12 +1381,12 @@ else if (method.getName().equals("hashCode")) { return System.identityHashCode(proxy); } else if (method.getName().equals("unwrap")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return proxy; } } else if (method.getName().equals("isWrapperFor")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return true; } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterMapper.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterMapper.java index 46a78377c060..515163d7844b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterMapper.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterMapper.java @@ -20,7 +20,7 @@ import java.sql.SQLException; import java.util.Map; -/** +/** * Implement this interface when parameters need to be customized based * on the connection. We might need to do this to make use of proprietary * features, available only with a specific Connection type. @@ -43,5 +43,5 @@ public interface ParameterMapper { * @return Map of input parameters, keyed by name (never null) */ Map createMap(Connection con) throws SQLException; - + } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterizedPreparedStatementSetter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterizedPreparedStatementSetter.java index fd8f82787642..9845cec064d8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterizedPreparedStatementSetter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterizedPreparedStatementSetter.java @@ -46,5 +46,5 @@ public interface ParameterizedPreparedStatementSetter { * @throws SQLException if a SQLException is encountered (i.e. there is no need to catch SQLException) */ void setValues(PreparedStatement ps, T argument) throws SQLException; - + } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreator.java index dc922156187a..2cb5a1f6483c 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreator.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,7 +42,7 @@ */ public interface PreparedStatementCreator { - /** + /** * Create a statement in this connection. Allows implementations to use * PreparedStatements. The JdbcTemplate will close the created statement. * @param con Connection to use to create statement diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java index 192a9a267bd2..c59c6e235da4 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,7 +146,7 @@ public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor) { * Return a new PreparedStatementSetter for the given parameters. * @param params list of parameters (may be null) */ - public PreparedStatementSetter newPreparedStatementSetter(List params) { + public PreparedStatementSetter newPreparedStatementSetter(List params) { return new PreparedStatementCreatorImpl(params != null ? params : Collections.emptyList()); } @@ -194,13 +194,13 @@ private class PreparedStatementCreatorImpl private final String actualSql; - private final List parameters; + private final List parameters; public PreparedStatementCreatorImpl(List parameters) { this(sql, parameters); } - public PreparedStatementCreatorImpl(String actualSql, List parameters) { + public PreparedStatementCreatorImpl(String actualSql, List parameters) { this.actualSql = actualSql; Assert.notNull(parameters, "Parameters List must not be null"); this.parameters = parameters; @@ -281,7 +281,7 @@ public void setValues(PreparedStatement ps) throws SQLException { declaredParameter = declaredParameters.get(i); } if (in instanceof Collection && declaredParameter.getSqlType() != Types.ARRAY) { - Collection entries = (Collection) in; + Collection entries = (Collection) in; for (Object entry : entries) { if (entry instanceof Object[]) { Object[] valueArray = ((Object[])entry); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementSetter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementSetter.java index fb12a1b48dfc..d8a3ad4a552d 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementSetter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementSetter.java @@ -42,7 +42,7 @@ */ public interface PreparedStatementSetter { - /** + /** * Set parameter values on the given PreparedStatement. * @param ps the PreparedStatement to invoke setter methods on * @throws SQLException if a SQLException is encountered diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetExtractor.java index 76ddcd1b233f..1544655ea44b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetExtractor.java @@ -21,7 +21,7 @@ import org.springframework.dao.DataAccessException; -/** +/** * Callback interface used by {@link JdbcTemplate}'s query methods. * Implementations of this interface perform the actual work of extracting * results from a {@link java.sql.ResultSet}, but don't need to worry diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetSupportingSqlParameter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetSupportingSqlParameter.java index 5dc54b2dc1ef..d435b9204fa5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetSupportingSqlParameter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/ResultSetSupportingSqlParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ */ public class ResultSetSupportingSqlParameter extends SqlParameter { - private ResultSetExtractor resultSetExtractor; + private ResultSetExtractor resultSetExtractor; private RowCallbackHandler rowCallbackHandler; - private RowMapper rowMapper; + private RowMapper rowMapper; /** @@ -68,7 +68,7 @@ public ResultSetSupportingSqlParameter(String name, int sqlType, String typeName * @param sqlType SQL type of the parameter according to java.sql.Types * @param rse ResultSetExtractor to use for parsing the ResultSet */ - public ResultSetSupportingSqlParameter(String name, int sqlType, ResultSetExtractor rse) { + public ResultSetSupportingSqlParameter(String name, int sqlType, ResultSetExtractor rse) { super(name, sqlType); this.resultSetExtractor = rse; } @@ -90,7 +90,7 @@ public ResultSetSupportingSqlParameter(String name, int sqlType, RowCallbackHand * @param sqlType SQL type of the parameter according to java.sql.Types * @param rm RowMapper to use for parsing the ResultSet */ - public ResultSetSupportingSqlParameter(String name, int sqlType, RowMapper rm) { + public ResultSetSupportingSqlParameter(String name, int sqlType, RowMapper rm) { super(name, sqlType); this.rowMapper = rm; } @@ -107,7 +107,7 @@ public boolean isResultSetSupported() { /** * Return the ResultSetExtractor held by this parameter, if any. */ - public ResultSetExtractor getResultSetExtractor() { + public ResultSetExtractor getResultSetExtractor() { return this.resultSetExtractor; } @@ -121,7 +121,7 @@ public RowCallbackHandler getRowCallbackHandler() { /** * Return the RowMapper held by this parameter, if any. */ - public RowMapper getRowMapper() { + public RowMapper getRowMapper() { return this.rowMapper; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowCountCallbackHandler.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowCountCallbackHandler.java index 88efe072ec37..c04e7dd8e23f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowCountCallbackHandler.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowCountCallbackHandler.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2006 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ *

      A usage example with JdbcTemplate: * *

      JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);  // reusable object
      - * 
      + *
        * RowCountCallbackHandler countCallback = new RowCountCallbackHandler();  // not reusable
        * jdbcTemplate.query("select * from user", countCallback);
        * int rowCount = countCallback.getRowCount();
      @@ -55,7 +55,7 @@ public class RowCountCallbackHandler implements RowCallbackHandler { * as returned by ResultSetMetaData object. */ private int[] columnTypes; - + /** * Indexed from 0. Column name as returned by ResultSetMetaData object. */ @@ -84,7 +84,7 @@ public final void processRow(ResultSet rs) throws SQLException { processRow(rs, this.rowCount++); } - /** + /** * Subclasses may override this to perform custom extraction * or processing. This class's implementation does nothing. * @param rs ResultSet to extract data from. This method is @@ -104,8 +104,8 @@ protected void processRow(ResultSet rs, int rowNum) throws SQLException { public final int[] getColumnTypes() { return columnTypes; } - - /** + + /** * Return the names of the columns. * Valid after processRow is invoked the first time. * @return the names of the columns. @@ -115,7 +115,7 @@ public final String[] getColumnNames() { return columnNames; } - /** + /** * Return the row count of this ResultSet * Only valid after processing is complete * @return the number of rows in this ResultSet @@ -124,7 +124,7 @@ public final int getRowCount() { return rowCount; } - /** + /** * Return the number of columns in this result set. * Valid once we've seen the first row, * so subclasses can use it during processing diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapper.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapper.java index 680e904ed291..56bba1bb5580 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapper.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapper.java @@ -47,7 +47,7 @@ */ public interface RowMapper { - /** + /** * Implementations must implement this method to map each row of data * in the ResultSet. This method should not call next() on * the ResultSet; it is only supposed to map values of the current row. @@ -57,7 +57,6 @@ public interface RowMapper { * @throws SQLException if a SQLException is encountered getting * column values (that is, there's no need to catch SQLException) */ - T mapRow(ResultSet rs, int rowNum) throws SQLException; + T mapRow(ResultSet rs, int rowNum) throws SQLException; } - \ No newline at end of file diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java index 8e8b7f7e08b3..a3e9b33b4e03 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapperResultSetExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ */ public class RowMapperResultSetExtractor implements ResultSetExtractor> { - private final RowMapper rowMapper; + private final RowMapper rowMapper; private final int rowsExpected; @@ -68,7 +68,7 @@ public class RowMapperResultSetExtractor implements ResultSetExtractor rowMapper) { + public RowMapperResultSetExtractor(RowMapper rowMapper) { this(rowMapper, 0); } @@ -78,7 +78,7 @@ public RowMapperResultSetExtractor(RowMapper rowMapper) { * @param rowsExpected the number of expected rows * (just used for optimized collection handling) */ - public RowMapperResultSetExtractor(RowMapper rowMapper, int rowsExpected) { + public RowMapperResultSetExtractor(RowMapper rowMapper, int rowsExpected) { Assert.notNull(rowMapper, "RowMapper is required"); this.rowMapper = rowMapper; this.rowsExpected = rowsExpected; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java index 32311d42c9d8..be896909ed3f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SingleColumnRowMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,7 +120,7 @@ public T mapRow(ResultSet rs, int rowNum) throws SQLException { * @see org.springframework.jdbc.support.JdbcUtils#getResultSetValue(java.sql.ResultSet, int, Class) * @see #getColumnValue(java.sql.ResultSet, int) */ - protected Object getColumnValue(ResultSet rs, int index, Class requiredType) throws SQLException { + protected Object getColumnValue(ResultSet rs, int index, Class requiredType) throws SQLException { if (requiredType != null) { return JdbcUtils.getResultSetValue(rs, index, requiredType); } @@ -163,18 +163,18 @@ protected Object getColumnValue(ResultSet rs, int index) throws SQLException { * @see #getColumnValue(java.sql.ResultSet, int, Class) */ @SuppressWarnings("unchecked") - protected Object convertValueToRequiredType(Object value, Class requiredType) { + protected Object convertValueToRequiredType(Object value, Class requiredType) { if (String.class.equals(requiredType)) { return value.toString(); } else if (Number.class.isAssignableFrom(requiredType)) { if (value instanceof Number) { // Convert original Number to target Number class. - return NumberUtils.convertNumberToTargetClass(((Number) value), requiredType); + return NumberUtils.convertNumberToTargetClass(((Number) value), (Class) requiredType); } else { // Convert stringified value to target Number class. - return NumberUtils.parseNumber(value.toString(), requiredType); + return NumberUtils.parseNumber(value.toString(), (Class)requiredType); } } else { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlInOutParameter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlInOutParameter.java index 896bc880612f..6161034f6210 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlInOutParameter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlInOutParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ public SqlInOutParameter(String name, int sqlType, String typeName, SqlReturnTyp * @param sqlType SQL type of the parameter according to java.sql.Types * @param rse ResultSetExtractor to use for parsing the ResultSet */ - public SqlInOutParameter(String name, int sqlType, ResultSetExtractor rse) { + public SqlInOutParameter(String name, int sqlType, ResultSetExtractor rse) { super(name, sqlType, rse); } @@ -97,7 +97,7 @@ public SqlInOutParameter(String name, int sqlType, RowCallbackHandler rch) { * @param sqlType SQL type of the parameter according to java.sql.Types * @param rm RowMapper to use for parsing the ResultSet */ - public SqlInOutParameter(String name, int sqlType, RowMapper rm) { + public SqlInOutParameter(String name, int sqlType, RowMapper rm) { super(name, sqlType, rm); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlOutParameter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlOutParameter.java index 9454e2bdafb7..1bf5f12114c1 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlOutParameter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlOutParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ public SqlOutParameter(String name, int sqlType, String typeName, SqlReturnType * @param sqlType SQL type of the parameter according to java.sql.Types * @param rse ResultSetExtractor to use for parsing the ResultSet */ - public SqlOutParameter(String name, int sqlType, ResultSetExtractor rse) { + public SqlOutParameter(String name, int sqlType, ResultSetExtractor rse) { super(name, sqlType, rse); } @@ -103,7 +103,7 @@ public SqlOutParameter(String name, int sqlType, RowCallbackHandler rch) { * @param sqlType SQL type of the parameter according to java.sql.Types * @param rm RowMapper to use for parsing the ResultSet */ - public SqlOutParameter(String name, int sqlType, RowMapper rm) { + public SqlOutParameter(String name, int sqlType, RowMapper rm) { super(name, sqlType, rm); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlProvider.java index 5dc642be8640..755990221b78 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlProvider.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlReturnResultSet.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlReturnResultSet.java index 3a26964cdee7..2c4c8103e14a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlReturnResultSet.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlReturnResultSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ public class SqlReturnResultSet extends ResultSetSupportingSqlParameter { * @param name name of the parameter, as used in input and output maps * @param extractor ResultSetExtractor to use for parsing the {@link java.sql.ResultSet} */ - public SqlReturnResultSet(String name, ResultSetExtractor extractor) { + public SqlReturnResultSet(String name, ResultSetExtractor extractor) { super(name, 0, extractor); } @@ -53,7 +53,7 @@ public SqlReturnResultSet(String name, RowCallbackHandler handler) { * @param name name of the parameter, as used in input and output maps * @param mapper RowMapper to use for parsing the {@link java.sql.ResultSet} */ - public SqlReturnResultSet(String name, RowMapper mapper) { + public SqlReturnResultSet(String name, RowMapper mapper) { super(name, 0, mapper); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java index 4d11377486c3..18482289fbe2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java @@ -47,9 +47,12 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor= JdkVersion.JAVA_17) { - // using JDBC 4.1 RowSetProvider - cachedRowSetFactory = new StandardCachedRowSetFactory(); + ClassLoader cl = SqlRowSetResultSetExtractor.class.getClassLoader(); + try { + Class rowSetProviderClass = cl.loadClass("javax.sql.rowset.RowSetProvider"); + Method newFactory = rowSetProviderClass.getMethod("newFactory"); + rowSetFactory = ReflectionUtils.invokeMethod(newFactory, null); + createCachedRowSet = rowSetFactory.getClass().getMethod("createCachedRowSet"); } else { // JDBC 4.1 API not available - fall back to Sun CachedRowSetImpl diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java index 19b1b672437f..096f8eae435e 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public abstract class StatementCreatorUtils { private static final Log logger = LogFactory.getLog(StatementCreatorUtils.class); - private static Map javaTypeToSqlTypeMap = new HashMap(32); + private static Map, Integer> javaTypeToSqlTypeMap = new HashMap, Integer>(32); static { /* JDBC 3.0 only - not compatible with e.g. MySQL at present @@ -94,7 +94,7 @@ public abstract class StatementCreatorUtils { * @param javaType the Java type to translate * @return the corresponding SQL type, or null if none found */ - public static int javaTypeToSqlParameterType(Class javaType) { + public static int javaTypeToSqlParameterType(Class javaType) { Integer sqlType = javaTypeToSqlTypeMap.get(javaType); if (sqlType != null) { return sqlType; @@ -360,7 +360,7 @@ else if (inValue instanceof Calendar) { /** * Check whether the given value can be treated as a String value. */ - private static boolean isStringValue(Class inValueType) { + private static boolean isStringValue(Class inValueType) { // Consider any CharSequence (including StringBuffer and StringBuilder) as a String. return (CharSequence.class.isAssignableFrom(inValueType) || StringWriter.class.isAssignableFrom(inValueType)); @@ -370,7 +370,7 @@ private static boolean isStringValue(Class inValueType) { * Check whether the given value is a java.util.Date * (but not one of the JDBC-specific subclasses). */ - private static boolean isDateValue(Class inValueType) { + private static boolean isDateValue(Class inValueType) { return (java.util.Date.class.isAssignableFrom(inValueType) && !(java.sql.Date.class.isAssignableFrom(inValueType) || java.sql.Time.class.isAssignableFrom(inValueType) || @@ -397,7 +397,7 @@ public static void cleanupParameters(Object[] paramValues) { * @see DisposableSqlTypeValue#cleanup() * @see org.springframework.jdbc.core.support.SqlLobValue#cleanup() */ - public static void cleanupParameters(Collection paramValues) { + public static void cleanupParameters(Collection paramValues) { if (paramValues != null) { for (Object inValue : paramValues) { if (inValue instanceof DisposableSqlTypeValue) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java index dffae703619a..479b5d8aaf09 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -224,7 +224,7 @@ public boolean isAccessCallParameterMetaData() { * @param rowMapper a RowMapper implementation used to map the data returned in the result set * @return the appropriate SqlParameter */ - public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper rowMapper) { + public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper rowMapper) { if (this.metaDataProvider.isReturnResultSetSupported()) { return new SqlReturnResultSet(parameterName, rowMapper); } @@ -434,7 +434,7 @@ else if (meta.getParameterType() == DatabaseMetaData.procedureColumnInOut) { public Map matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource) { // For parameter source lookups we need to provide case-insensitive lookup support // since the database metadata is not necessarily providing case sensitive parameter names. - Map caseInsensitiveParameterNames = + Map caseInsensitiveParameterNames = SqlParameterSourceUtils.extractCaseInsensitiveParameterNames(parameterSource); Map callParameterNames = new HashMap(this.callParameters.size()); @@ -467,7 +467,7 @@ public Map matchInParameterValuesWithCallParameters(SqlParameter } else { if (caseInsensitiveParameterNames.containsKey(lowerCaseName)) { - String sourceName = (String) caseInsensitiveParameterNames.get(lowerCaseName); + String sourceName = caseInsensitiveParameterNames.get(lowerCaseName); matchedParameters.put(parameterName, SqlParameterSourceUtils.getTypedValue(parameterSource, sourceName)); } else { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java index 38d47301c3df..33087c446c34 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public class CallMetaDataProviderFactory { * Create a CallMetaDataProvider based on the database metedata * @param dataSource used to retrieve metedata * @param context the class that holds configuration and metedata - * @return instance of the CallMetaDataProvider implementation to be used + * @return instance of the CallMetaDataProvider implementation to be used */ static public CallMetaDataProvider createMetaDataProvider(DataSource dataSource, final CallMetaDataContext context) { try { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java index 4c1393640d2e..55e747b9cdcf 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java @@ -75,4 +75,4 @@ public String getTypeName() { public boolean isNullable() { return nullable; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyTableMetaDataProvider.java index dc3e2131286a..afabd9bcf984 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyTableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/DerbyTableMetaDataProvider.java @@ -53,4 +53,4 @@ public boolean isGetGeneratedKeysSupported() { } return derbysAnswer; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java index db7cd667faf3..af8281fc6d8f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -197,7 +197,7 @@ public SqlParameter createDefaultInOutParameter(String parameterName, CallParame } public SqlParameter createDefaultInParameter(String parameterName, CallParameterMetaData meta) { - return new SqlParameter(parameterName, meta.getSqlType()); + return new SqlParameter(parameterName, meta.getSqlType()); } public String getUserName() { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java index 1a4e28772fce..4869064edce0 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java @@ -389,8 +389,8 @@ private void processTableColumns(DatabaseMetaData databaseMetaData, TableMetaDat if (dataType == Types.DECIMAL) { String typeName = tableColumns.getString("TYPE_NAME"); int decimalDigits = tableColumns.getInt("DECIMAL_DIGITS"); - // override a DECIMAL data type for no-decimal numerics - // (this is for better Oracle support where there have been issues + // override a DECIMAL data type for no-decimal numerics + // (this is for better Oracle support where there have been issues // using DECIMAL for certain inserts (see SPR-6912)) if ("NUMBER".equals(typeName) && decimalDigits == 0) { dataType = Types.NUMERIC; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/HsqlTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/HsqlTableMetaDataProvider.java index b35ac67f6aa5..7ae4ecd91238 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/HsqlTableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/HsqlTableMetaDataProvider.java @@ -20,7 +20,7 @@ import java.sql.SQLException; /** - * The HSQL specific implementation of the {@link TableMetaDataProvider}. Suports a feature for + * The HSQL specific implementation of the {@link TableMetaDataProvider}. Suports a feature for * retreiving generated keys without the JDBC 3.0 getGeneratedKeys support. * * @author Thomas Risberg diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleCallMetaDataProvider.java index 6b31dcea9926..340f0fe2ea3f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleCallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleCallMetaDataProvider.java @@ -45,7 +45,7 @@ public OracleCallMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLE public boolean isReturnResultSetSupported() { return false; } - + @Override public boolean isRefCursorSupported() { return true; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleTableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleTableMetaDataProvider.java index 326428a4c8dd..3465522e11ef 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleTableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleTableMetaDataProvider.java @@ -34,7 +34,7 @@ * *

      Thanks to Mike Youngstrom and Bruce Campbell for submitting the original suggestion for the Oracle * current schema lookup implementation. - * + * * @author Thomas Risberg * @author Juergen Hoeller * @since 3.0 @@ -42,7 +42,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider { private final boolean includeSynonyms; - + private String defaultSchema; @@ -124,10 +124,10 @@ public void initializeWithTableColumnMetaData(DatabaseMetaData databaseMetaData, throw new InvalidDataAccessApiUsageException("Couldn't reset Oracle Connection", ex); } } - + /* * Oracle implementation for detecting current schema - * + * * @param databaseMetaData */ private void lookupDefaultSchema(DatabaseMetaData databaseMetaData) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/PostgresCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/PostgresCallMetaDataProvider.java index 62040f127c4e..f7a53d432b36 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/PostgresCallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/PostgresCallMetaDataProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java index 31f73add5fb7..fbfb6b22b37d 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -239,7 +239,7 @@ public List matchInParameterValuesWithInsertColumns(SqlParameterSource p List values = new ArrayList(); // for parameter source lookups we need to provide caseinsensitive lookup support since the // database metadata is not necessarily providing case sensitive column names - Map caseInsensitiveParameterNames = + Map caseInsensitiveParameterNames = SqlParameterSourceUtils.extractCaseInsensitiveParameterNames(parameterSource); for (String column : this.tableColumns) { if (parameterSource.hasValue(column)) { @@ -259,7 +259,7 @@ public List matchInParameterValuesWithInsertColumns(SqlParameterSource p if (caseInsensitiveParameterNames.containsKey(lowerCaseName)) { values.add( SqlParameterSourceUtils.getTypedValue(parameterSource, - (String) caseInsensitiveParameterNames.get(lowerCaseName))); + caseInsensitiveParameterNames.get(lowerCaseName))); } else { values.add(null); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProvider.java index d34c6fc11cea..25eaa98b5682 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProvider.java @@ -98,7 +98,7 @@ void initializeWithTableColumnMetaData(DatabaseMetaData databaseMetaData, String * Are we using the meta data for the table columns? */ boolean isTableColumnMetaDataUsed(); - + /** * Does this database support the JDBC 3.0 feature of retreiving generated keys * {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()} diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java index 15421a998a2f..cf56a04999a2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSource.java index 76062a8c6bf6..4fcf577c1b16 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,7 +97,7 @@ public int getSqlType(String paramName) { if (sqlType != TYPE_UNKNOWN) { return sqlType; } - Class propType = this.beanWrapper.getPropertyType(paramName); + Class propType = this.beanWrapper.getPropertyType(paramName); return StatementCreatorUtils.javaTypeToSqlParameterType(propType); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterBatchUpdateUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterBatchUpdateUtils.java index 8f43da6bb8a0..4438498a8832 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterBatchUpdateUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterBatchUpdateUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcDaoSupport.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcDaoSupport.java index 621cf6d9f395..9c049300e0d2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcDaoSupport.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcDaoSupport.java @@ -20,14 +20,14 @@ /** * Extension of JdbcDaoSupport that exposes a NamedParameterJdbcTemplate as well. - * + * * @author Thomas Risberg * @author Juergen Hoeller * @since 2.0 * @see NamedParameterJdbcTemplate */ public class NamedParameterJdbcDaoSupport extends JdbcDaoSupport { - + private NamedParameterJdbcTemplate namedParameterJdbcTemplate; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java index bca63c45117a..01c02c793ae8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java index ccc668502c53..fc2d17aadec5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java @@ -227,7 +227,7 @@ private static int skipCommentsAndQuotes(char[] statement, int position) { } return position; } - + /** * Parse the SQL statement and locate any placeholders or named parameters. * Named parameters are substituted for a JDBC placeholder and any select list @@ -248,10 +248,10 @@ private static int skipCommentsAndQuotes(char[] statement, int position) { public static String substituteNamedParameters(ParsedSql parsedSql, SqlParameterSource paramSource) { String originalSql = parsedSql.getOriginalSql(); StringBuilder actualSql = new StringBuilder(); - List paramNames = parsedSql.getParameterNames(); + List paramNames = parsedSql.getParameterNames(); int lastIndex = 0; for (int i = 0; i < paramNames.size(); i++) { - String paramName = (String) paramNames.get(i); + String paramName = paramNames.get(i); int[] indexes = parsedSql.getParameterIndexes(i); int startIndex = indexes[0]; int endIndex = indexes[1]; @@ -262,7 +262,7 @@ public static String substituteNamedParameters(ParsedSql parsedSql, SqlParameter value = ((SqlParameterValue) value).getValue(); } if (value instanceof Collection) { - Iterator entryIter = ((Collection) value).iterator(); + Iterator entryIter = ((Collection) value).iterator(); int k = 0; while (entryIter.hasNext()) { if (k > 0) { @@ -482,7 +482,7 @@ public String getParameterName() { public int getStartIndex() { return startIndex; } - + public int getEndIndex() { return endIndex; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java index 5af6dd9a7279..f9ae7bbcc520 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,10 @@ public class SqlParameterSourceUtils { * @param valueMaps array of Maps containing the values to be used * @return an array of SqlParameterSource */ - public static SqlParameterSource[] createBatch(Map[] valueMaps) { + public static SqlParameterSource[] createBatch(Map[] valueMaps) { MapSqlParameterSource[] batch = new MapSqlParameterSource[valueMaps.length]; for (int i = 0; i < valueMaps.length; i++) { - Map valueMap = valueMaps[i]; + Map valueMap = valueMaps[i]; batch[i] = new MapSqlParameterSource(valueMap); } return batch; @@ -85,8 +85,8 @@ public static Object getTypedValue(SqlParameterSource source, String parameterNa * @param parameterSource the source of paramer names * @return the Map that can be used for case insensitive matching of parameter names */ - public static Map extractCaseInsensitiveParameterNames(SqlParameterSource parameterSource) { - Map caseInsensitiveParameterNames = new HashMap(); + public static Map extractCaseInsensitiveParameterNames(SqlParameterSource parameterSource) { + Map caseInsensitiveParameterNames = new HashMap(); if (parameterSource instanceof BeanPropertySqlParameterSource) { String[] propertyNames = ((BeanPropertySqlParameterSource)parameterSource).getReadablePropertyNames(); for (int i = 0; i < propertyNames.length; i++) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/package-info.java index 78f4d6d2d42f..55414697b52d 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/package-info.java @@ -2,12 +2,12 @@ /** * * JdbcTemplate variant with named parameter support. - * + * *

      NamedParameterJdbcTemplate is a wrapper around JdbcTemplate that adds * support for named parameter parsing. It does not implement the JdbcOperations * interface or extend JdbcTemplate, but implements the dedicated * NamedParameterJdbcOperations interface. - * + * *

      If you need the full power of Spring JDBC for less common operations, use * the getJdbcOperations() method of NamedParameterJdbcTemplate and * work with the returned classic template, or use a JdbcTemplate instance directly. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java index c4a9db61aa99..3f998803485b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public abstract class AbstractJdbcCall { private final List declaredParameters = new ArrayList(); /** List of RefCursor/ResultSet RowMapper objects */ - private final Map declaredRowMappers = new LinkedHashMap(); + private final Map> declaredRowMappers = new LinkedHashMap>(); /** * Has this operation been compiled? Compilation means at @@ -220,7 +220,7 @@ public void addDeclaredParameter(SqlParameter parameter) { * @param parameterName name of parameter or column * @param rowMapper the RowMapper implementation to use */ - public void addDeclaredRowMapper(String parameterName, RowMapper rowMapper) { + public void addDeclaredRowMapper(String parameterName, RowMapper rowMapper) { this.declaredRowMappers.put(parameterName, rowMapper); if (logger.isDebugEnabled()) { logger.debug("Added row mapper for [" + getProcedureName() + "]: " + parameterName); @@ -232,8 +232,8 @@ public void addDeclaredRowMapper(String parameterName, RowMapper rowMapper) { * @deprecated in favor of {@link #addDeclaredRowMapper(String, org.springframework.jdbc.core.RowMapper)} */ @Deprecated - public void addDeclaredRowMapper(String parameterName, ParameterizedRowMapper rowMapper) { - addDeclaredRowMapper(parameterName, (RowMapper) rowMapper); + public void addDeclaredRowMapper(String parameterName, ParameterizedRowMapper rowMapper) { + addDeclaredRowMapper(parameterName, (RowMapper) rowMapper); } /** @@ -289,7 +289,7 @@ protected void compileInternal() { this.callMetaDataContext.initializeMetaData(getJdbcTemplate().getDataSource()); // iterate over the declared RowMappers and register the corresponding SqlParameter - for (Map.Entry entry : this.declaredRowMappers.entrySet()) { + for (Map.Entry> entry : this.declaredRowMappers.entrySet()) { SqlParameter resultSetParameter = this.callMetaDataContext.createReturnResultSetParameter(entry.getKey(), entry.getValue()); this.declaredParameters.add(resultSetParameter); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java index 018892ba3aea..0acb0fa67d49 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -477,12 +477,12 @@ public PreparedStatement createPreparedStatement(Connection con) throws SQLExcep Long key = jdbcTemplate.queryForLong( getInsertString() + " " + keyQuery, values.toArray(new Object[values.size()])); - HashMap keys = new HashMap(1); + HashMap keys = new HashMap(1); keys.put(getGeneratedKeyNames()[0], key); keyHolder.getKeyList().add(keys); } else { - jdbcTemplate.execute(new ConnectionCallback() { + jdbcTemplate.execute(new ConnectionCallback() { public Object doInConnection(Connection con) throws SQLException, DataAccessException { // Do the insert PreparedStatement ps = null; @@ -496,7 +496,7 @@ public Object doInConnection(Connection con) throws SQLException, DataAccessExce //Get the key Statement keyStmt = null; ResultSet rs = null; - HashMap keys = new HashMap(1); + HashMap keys = new HashMap(1); try { keyStmt = con.createStatement(); rs = keyStmt.executeQuery(keyQuery); @@ -554,7 +554,7 @@ private PreparedStatement prepareStatementForGeneratedKeys(Connection con) throw */ protected int[] doExecuteBatch(Map[] batch) { checkCompiled(); - List[] batchValues = new ArrayList[batch.length]; + List[] batchValues = createBatchValuesArray(batch.length); int i = 0; for (Map args : batch) { List values = matchInParameterValuesWithInsertColumns(args); @@ -571,7 +571,7 @@ protected int[] doExecuteBatch(Map[] batch) { */ protected int[] doExecuteBatch(SqlParameterSource[] batch) { checkCompiled(); - List[] batchValues = new ArrayList[batch.length]; + List[] batchValues = createBatchValuesArray(batch.length); int i = 0; for (SqlParameterSource parameterSource : batch) { List values = matchInParameterValuesWithInsertColumns(parameterSource); @@ -580,6 +580,11 @@ protected int[] doExecuteBatch(SqlParameterSource[] batch) { return executeBatchInternal(batchValues); } + @SuppressWarnings("unchecked") + private List[] createBatchValuesArray(int length) { + return new List[length]; + } + /** * Method to execute the batch insert */ @@ -622,7 +627,7 @@ private void setParameterValues(PreparedStatement preparedStatement, Listjava.util.Date, etc. * *

      The mapper can be configured to use the primitives default value when mapping null values - * by setting the {@link #setPrimitivesDefaultedForNullValue 'primitivesDefaultedForNullValue'} + * by setting the '{@link #setPrimitivesDefaultedForNullValue primitivesDefaultedForNullValue}' * flag to 'true'. * *

      To facilitate mapping between columns and fields that don't have matching names, diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java index 0311dc4cf38f..5287b6545fde 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ *

      The meta data processing is based on the DatabaseMetaData provided by * the JDBC driver. Since we rely on the JDBC driver this "auto-detection" * can only be used for databases that are known to provide accurate meta data. - * These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2, + * These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2, * Sybase and PostgreSQL. For any other databases you are required to declare all * parameters explicitly. You can of course declare all parameters explicitly even * if the database provides the necessary meta data. In that case your declared @@ -120,7 +120,7 @@ public SimpleJdbcCall useInParameterNames(String... inParameterNames) { return this; } - public SimpleJdbcCall returningResultSet(String parameterName, RowMapper rowMapper) { + public SimpleJdbcCall returningResultSet(String parameterName, RowMapper rowMapper) { addDeclaredRowMapper(parameterName, rowMapper); return this; } @@ -129,7 +129,7 @@ public SimpleJdbcCall returningResultSet(String parameterName, RowMapper rowMapp * @deprecated in favor of {@link #returningResultSet(String, org.springframework.jdbc.core.RowMapper)} */ @Deprecated - public SimpleJdbcCall returningResultSet(String parameterName, ParameterizedRowMapper rowMapper) { + public SimpleJdbcCall returningResultSet(String parameterName, ParameterizedRowMapper rowMapper) { addDeclaredRowMapper(parameterName, rowMapper); return this; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java index 6c2d52d659ec..a7d8952ee0ac 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ public interface SimpleJdbcCallOperations { * @param parameterName the name of the returned results and/or the name of the ref cursor parameter * @param rowMapper the RowMapper implementation that will map the data returned for each row * */ - SimpleJdbcCallOperations returningResultSet(String parameterName, RowMapper rowMapper); + SimpleJdbcCallOperations returningResultSet(String parameterName, RowMapper rowMapper); /** * Used to specify when a ResultSet is returned by the stored procedure and you want it mapped @@ -103,7 +103,7 @@ public interface SimpleJdbcCallOperations { * @deprecated in favor of {@link #returningResultSet(String, org.springframework.jdbc.core.RowMapper)} */ @Deprecated - SimpleJdbcCallOperations returningResultSet(String parameterName, ParameterizedRowMapper rowMapper); + SimpleJdbcCallOperations returningResultSet(String parameterName, ParameterizedRowMapper rowMapper); /** * Turn off any processing of parameter meta data information obtained via JDBC. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcDaoSupport.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcDaoSupport.java index d0ad45ce9715..16a842da184f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcDaoSupport.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcDaoSupport.java @@ -22,18 +22,18 @@ * Extension of {@link org.springframework.jdbc.core.support.JdbcDaoSupport} * that exposes a {@link #getSimpleJdbcTemplate() SimpleJdbcTemplate} as well. * Only usable on Java 5 and above. - * + * * @author Rod Johnson * @author Juergen Hoeller * @since 2.0 * @see SimpleJdbcTemplate * @deprecated since Spring 3.1 in favor of {@link org.springframework.jdbc.core.support.JdbcDaoSupport} and - * {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport}. The JdbcTemplate and + * {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport}. The JdbcTemplate and * NamedParameterJdbcTemplate now provide all the functionality of the SimpleJdbcTemplate. */ @Deprecated public class SimpleJdbcDaoSupport extends JdbcDaoSupport { - + private SimpleJdbcTemplate simpleJdbcTemplate; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java index a4351abadc4c..0033f3847acd 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java @@ -31,7 +31,7 @@ * @since 2.5 */ public interface SimpleJdbcInsertOperations { - + /** * Specify the table name to be used for the insert. * @param tableName the name of the stored table @@ -85,8 +85,8 @@ public interface SimpleJdbcInsertOperations { /** * Use a the provided NativeJdbcExtractor during the column meta data * lookups via JDBC. - * Note: this is only necessary to include when running with a connection pool - * that wraps the meta data connection and when using a database like Oracle + * Note: this is only necessary to include when running with a connection pool + * that wraps the meta data connection and when using a database like Oracle * where it is necessary to access the native connection to include synonyms. * @return the instance of this SimpleJdbcInsert */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcOperations.java index 2b68f35cb077..45e464481669 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcOperations.java @@ -38,7 +38,7 @@ * @see SimpleJdbcTemplate * @see org.springframework.jdbc.core.JdbcOperations * @deprecated since Spring 3.1 in favor of {@link org.springframework.jdbc.core.JdbcOperations} and - * {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations}. The JdbcTemplate and + * {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations}. The JdbcTemplate and * NamedParameterJdbcTemplate now provide all the functionality of the SimpleJdbcTemplate. */ @Deprecated diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplate.java index 2ca0132530dd..a4ec41fc0645 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ * any methods specifying SQL types, methods using less commonly used callbacks * such as RowCallbackHandler, updates with PreparedStatementSetters rather than * argument arrays, and stored procedures as well as batch operations. - * + * * @author Rod Johnson * @author Rob Harrop * @author Juergen Hoeller @@ -51,12 +51,12 @@ * @see SimpleJdbcDaoSupport * @see org.springframework.jdbc.core.JdbcTemplate * @deprecated since Spring 3.1 in favor of {@link org.springframework.jdbc.core.JdbcTemplate} and - * {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}. The JdbcTemplate and + * {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}. The JdbcTemplate and * NamedParameterJdbcTemplate now provide all the functionality of the SimpleJdbcTemplate. */ @Deprecated public class SimpleJdbcTemplate implements SimpleJdbcOperations { - + /** The NamedParameterJdbcTemplate that we are wrapping */ private final NamedParameterJdbcOperations namedParameterJdbcOperations; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/package-info.java index 44294d6e8b89..90f8f1c873f5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/package-info.java @@ -2,14 +2,14 @@ /** * * Simplification layer over JdbcTemplate for Java 5 and above. - * + * *

      SimpleJdbcInsert and SimpleJdbcCall are classes that takes advantage - * of database metadata provided by the JDBC driver to simplify the application code. Much of the + * of database metadata provided by the JDBC driver to simplify the application code. Much of the * parameter specification becomes unnecessary since it can be looked up in the metadata. - * - * Note: The SimpleJdbcOperations and SimpleJdbcTemplate, which provides a wrapper + * + * Note: The SimpleJdbcOperations and SimpleJdbcTemplate, which provides a wrapper * around JdbcTemplate to take advantage of Java 5 features like generics, varargs and autoboxing, is now deprecated - * since Spring 3.1. All functionality is now available in the JdbcOperations and + * since Spring 3.1. All functionality is now available in the JdbcOperations and * NamedParametersOperations respectively. * */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/AbstractLobStreamingResultSetExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/AbstractLobStreamingResultSetExtractor.java index df22236518f0..ecb562b36d64 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/AbstractLobStreamingResultSetExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/AbstractLobStreamingResultSetExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ * @see org.springframework.jdbc.support.lob.LobHandler * @see org.springframework.jdbc.LobRetrievalFailureException */ -public abstract class AbstractLobStreamingResultSetExtractor implements ResultSetExtractor { +public abstract class AbstractLobStreamingResultSetExtractor implements ResultSetExtractor { /** * Delegates to handleNoRowFound, handleMultipleRowsFound and streamData, diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java index 4921a84b6d88..517e8a052fb5 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java @@ -53,7 +53,7 @@ * }, * new int[] {Types.VARCHAR, Types.BLOB, Types.CLOB}); * - * + * * @author Thomas Risberg * @author Juergen Hoeller * @since 1.1 diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java index 5bf57f3e3691..b0e037ec297c 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DelegatingDataSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DelegatingDataSource.java index a4c162dde8d0..baf14d7035ee 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DelegatingDataSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DelegatingDataSource.java @@ -109,11 +109,7 @@ public void setLoginTimeout(int seconds) throws SQLException { // Implementation of JDBC 4.0's Wrapper interface //--------------------------------------------------------------------- - @SuppressWarnings("unchecked") - public T unwrap(Class iface) throws SQLException { - if (iface.isInstance(this)) { - return (T) this; - } + public T unwrap(Class iface) throws SQLException { return getTargetDataSource().unwrap(iface); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java index 57cd94160b09..e2b7f0a896af 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/JdbcTransactionObjectSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java index f6ddc15b349f..c2a3d593921c 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/LazyConnectionDataSourceProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -289,12 +289,12 @@ else if (method.getName().equals("hashCode")) { return System.identityHashCode(proxy); } else if (method.getName().equals("unwrap")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return proxy; } } else if (method.getName().equals("isWrapperFor")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return true; } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SingleConnectionDataSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SingleConnectionDataSource.java index 05edcab08bbe..6396dddf160e 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SingleConnectionDataSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SingleConnectionDataSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -326,12 +326,12 @@ else if (method.getName().equals("hashCode")) { return System.identityHashCode(proxy); } else if (method.getName().equals("unwrap")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return proxy; } } else if (method.getName().equals("isWrapperFor")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return true; } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SmartDataSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SmartDataSource.java index 3c0e1377b119..9885f48efeec 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SmartDataSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SmartDataSource.java @@ -36,8 +36,8 @@ * @see org.springframework.jdbc.core.JdbcTemplate */ public interface SmartDataSource extends DataSource { - - /** + + /** * Should we close this Connection, obtained from this DataSource? *

      Code that uses Connections from a SmartDataSource should always * perform a check via this method before invoking close(). diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java index 535ef53d10e2..989b853f5368 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -197,12 +197,12 @@ else if (method.getName().equals("toString")) { return sb.toString(); } else if (method.getName().equals("unwrap")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return proxy; } } else if (method.getName().equals("isWrapperFor")) { - if (((Class) args[0]).isInstance(proxy)) { + if (((Class) args[0]).isInstance(proxy)) { return true; } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/WebSphereDataSourceAdapter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/WebSphereDataSourceAdapter.java index af04d4f957f9..6fd21f4303a9 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/WebSphereDataSourceAdapter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/WebSphereDataSourceAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter protected final Log logger = LogFactory.getLog(getClass()); - private Class wsDataSourceClass; + private Class wsDataSourceClass; private Method newJdbcConnSpecMethod; @@ -91,8 +91,8 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter public WebSphereDataSourceAdapter() { try { this.wsDataSourceClass = getClass().getClassLoader().loadClass("com.ibm.websphere.rsadapter.WSDataSource"); - Class jdbcConnSpecClass = getClass().getClassLoader().loadClass("com.ibm.websphere.rsadapter.JDBCConnectionSpec"); - Class wsrraFactoryClass = getClass().getClassLoader().loadClass("com.ibm.websphere.rsadapter.WSRRAFactory"); + Class jdbcConnSpecClass = getClass().getClassLoader().loadClass("com.ibm.websphere.rsadapter.JDBCConnectionSpec"); + Class wsrraFactoryClass = getClass().getClassLoader().loadClass("com.ibm.websphere.rsadapter.WSRRAFactory"); this.newJdbcConnSpecMethod = wsrraFactoryClass.getMethod("createJDBCConnectionSpec", (Class[]) null); this.wsDataSourceGetConnectionMethod = this.wsDataSourceClass.getMethod("getConnection", new Class[] {jdbcConnSpecClass}); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java index 634eb57cdeb3..1af0e0e38e9e 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/AbstractEmbeddedDatabaseConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java index cf6737e1a5fc..05fad2712496 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigurer { private static final Log logger = LogFactory.getLog(DerbyEmbeddedDatabaseConfigurer.class); - + private static final String URL_TEMPLATE = "jdbc:derby:memory:%s;%s"; // Error code that indicates successful shutdown diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java index 6c1ea235dcc7..6555e2c55709 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java @@ -105,7 +105,7 @@ public EmbeddedDatabaseBuilder addDefaultScripts() { addScript("data.sql"); return this; } - + /** * Build the embedded database. * @return the embedded database diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurer.java index 210439042cb5..7e1ea19597c7 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurer.java @@ -26,7 +26,7 @@ * @since 3.0 */ public interface EmbeddedDatabaseConfigurer { - + /** * Configure the properties required to create and connect to the embedded database instance. * @param properties connection properties to configure @@ -40,5 +40,5 @@ public interface EmbeddedDatabaseConfigurer { * @param databaseName the name of the database being shutdown */ void shutdown(DataSource dataSource, String databaseName); - + } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java index bd5e3264ebdd..f40c8cc043bf 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType.java index d70884c32f98..d8ad816c588f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType.java @@ -26,10 +26,10 @@ public enum EmbeddedDatabaseType { /** The Hypersonic Embedded Java SQL Database (http://hsqldb.org) */ - HSQL, + HSQL, /** The H2 Embedded Java SQL Database Engine (http://h2database.com) */ - H2, + H2, /** The Apache Derby Embedded SQL Database (http://db.apache.org/derby) */ DERBY diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/HsqlEmbeddedDatabaseConfigurer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/HsqlEmbeddedDatabaseConfigurer.java index 298cf37db001..07670934c7fe 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/HsqlEmbeddedDatabaseConfigurer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/HsqlEmbeddedDatabaseConfigurer.java @@ -59,4 +59,4 @@ public void configureConnectionProperties(ConnectionProperties properties, Strin properties.setPassword(""); } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/SimpleDriverDataSourceFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/SimpleDriverDataSourceFactory.java index 4fdb38e8cdbf..6debd6f014da 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/SimpleDriverDataSourceFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/SimpleDriverDataSourceFactory.java @@ -32,21 +32,21 @@ final class SimpleDriverDataSourceFactory implements DataSourceFactory { private final SimpleDriverDataSource dataSource = new SimpleDriverDataSource(); - + public ConnectionProperties getConnectionProperties() { return new ConnectionProperties() { public void setDriverClass(Class driverClass) { dataSource.setDriverClass(driverClass); } - + public void setUrl(String url) { dataSource.setUrl(url); } - + public void setUsername(String username) { dataSource.setUsername(username); } - + public void setPassword(String password) { dataSource.setPassword(password); } @@ -56,5 +56,5 @@ public void setPassword(String password) { public DataSource getDataSource() { return this.dataSource; } - + } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulator.java index 7f4102cb64ca..a88cd6698bee 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/DatabasePopulator.java @@ -27,7 +27,7 @@ * @see ResourceDatabasePopulator */ public interface DatabasePopulator { - + /** * Populate the database using the JDBC connection provided. * @param connection the JDBC connection to use to populate the db; already configured and ready to use diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java index e2f6eafe368a..f6409198d6b7 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java @@ -119,7 +119,7 @@ public void setContinueOnError(boolean continueOnError) { } /** - * Flag to indicate that a failed SQL {@code DROP} statement can be ignored. + * Flag to indicate that a failed SQL DROP statement can be ignored. *

      This is useful for non-embedded databases whose SQL dialect does not support an * {@code IF EXISTS} clause in a {@code DROP}. The default is false so that if the * populator runs accidentally, it will fail fast when the script starts with a {@code DROP}. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java index 4401a64e6f8f..b38a998bfec8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java @@ -112,7 +112,7 @@ public void afterPropertiesSet() { throw new IllegalArgumentException("Property 'targetDataSources' is required"); } this.resolvedDataSources = new HashMap(this.targetDataSources.size()); - for (Map.Entry entry : this.targetDataSources.entrySet()) { + for (Map.Entry entry : this.targetDataSources.entrySet()) { Object lookupKey = resolveSpecifiedLookupKey(entry.getKey()); DataSource dataSource = resolveSpecifiedDataSource(entry.getValue()); this.resolvedDataSources.put(lookupKey, dataSource); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookup.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookup.java index 49919dc26e5c..55804387725c 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookup.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookup.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ /** * {@link DataSourceLookup} implementation based on a Spring {@link BeanFactory}. - * + * *

      Will lookup Spring managed beans identified by bean name, * expecting them to be of type javax.sql.DataSource. * @@ -53,7 +53,7 @@ public BeanFactoryDataSourceLookup() { * by a Spring IoC container, as the supplied {@link BeanFactory} will be * replaced by the {@link BeanFactory} that creates it (c.f. the * {@link BeanFactoryAware} contract). So only use this constructor if you - * are using this class outside the context of a Spring IoC container. + * are using this class outside the context of a Spring IoC container. * @param beanFactory the bean factory to be used to lookup {@link DataSource DataSources} */ public BeanFactoryDataSourceLookup(BeanFactory beanFactory) { @@ -70,7 +70,7 @@ public void setBeanFactory(BeanFactory beanFactory) { public DataSource getDataSource(String dataSourceName) throws DataSourceLookupFailureException { Assert.state(this.beanFactory != null, "BeanFactory is required"); try { - return (DataSource) this.beanFactory.getBean(dataSourceName, DataSource.class); + return this.beanFactory.getBean(dataSourceName, DataSource.class); } catch (BeansException ex) { throw new DataSourceLookupFailureException( diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookup.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookup.java index 3d9de9d0b367..3e4ebc76ed82 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookup.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookup.java @@ -26,7 +26,7 @@ * *

      For specific JNDI configuration, it is recommended to configure * the "jndiEnvironment"/"jndiTemplate" properties. - * + * * @author Costin Leau * @author Juergen Hoeller * @since 2.0 diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookup.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookup.java index d09dacf8fe05..907ad72c7360 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookup.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookup.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ public MapDataSourceLookup(String dataSourceName, DataSource dataSource) { * Set the {@link Map} of {@link DataSource DataSources}; the keys * are {@link String Strings}, the values are actual {@link DataSource} instances. *

      If the supplied {@link Map} is null, then this method - * call effectively has no effect. + * call effectively has no effect. * @param dataSources said {@link Map} of {@link DataSource DataSources} */ public void setDataSources(Map dataSources) { @@ -80,7 +80,7 @@ public void setDataSources(Map dataSources) { /** * Get the {@link Map} of {@link DataSource DataSources} maintained by this object. *

      The returned {@link Map} is {@link Collections#unmodifiableMap(java.util.Map) unmodifiable}. - * @return said {@link Map} of {@link DataSource DataSources} (never null) + * @return said {@link Map} of {@link DataSource DataSources} (never null) */ public Map getDataSources() { return Collections.unmodifiableMap(this.dataSources); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/BatchSqlUpdate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/BatchSqlUpdate.java index 61e0d09fe104..bab5b35c5c46 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/BatchSqlUpdate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/BatchSqlUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -180,7 +180,7 @@ public int[] flush() { if (this.parameterQueue.isEmpty()) { return new int[0]; } - + int[] rowsAffected = getJdbcTemplate().batchUpdate( getSql(), new BatchPreparedStatementSetter() { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericSqlQuery.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericSqlQuery.java index b2d09d28d252..1b4c380e08c3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericSqlQuery.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericSqlQuery.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2009 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,17 @@ import org.springframework.util.Assert; import org.springframework.dao.InvalidDataAccessResourceUsageException; -public class GenericSqlQuery extends SqlQuery { +public class GenericSqlQuery extends SqlQuery { - Class rowMapperClass; + Class rowMapperClass; - RowMapper rowMapper; + RowMapper rowMapper; - public void setRowMapperClass(Class rowMapperClass) + public void setRowMapperClass(Class rowMapperClass) throws IllegalAccessException, InstantiationException { this.rowMapperClass = rowMapperClass; if (!RowMapper.class.isAssignableFrom(rowMapperClass)) - throw new IllegalStateException("The specified class '" + + throw new IllegalStateException("The specified class '" + rowMapperClass.getName() + " is not a sub class of " + "'org.springframework.jdbc.core.RowMapper'"); } @@ -42,9 +42,10 @@ public void afterPropertiesSet() { Assert.notNull(rowMapperClass, "The 'rowMapperClass' property is required"); } - protected RowMapper newRowMapper(Object[] parameters, Map context) { + @SuppressWarnings("unchecked") + protected RowMapper newRowMapper(Object[] parameters, Map context) { try { - return (RowMapper) rowMapperClass.newInstance(); + return (RowMapper) rowMapperClass.newInstance(); } catch (InstantiationException e) { throw new InvalidDataAccessResourceUsageException("Unable to instantiate RowMapper", e); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericStoredProcedure.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericStoredProcedure.java index 1944c6a31ea5..13511bd2d489 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericStoredProcedure.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/GenericStoredProcedure.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQuery.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQuery.java index 1f3ec18701a3..7f746b20423b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQuery.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public MappingSqlQuery(DataSource ds, String sql) { * @see #mapRow(ResultSet, int) */ @Override - protected final T mapRow(ResultSet rs, int rowNum, Object[] parameters, Map context) + protected final T mapRow(ResultSet rs, int rowNum, Object[] parameters, Map context) throws SQLException { return mapRow(rs, rowNum); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQueryWithParameters.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQueryWithParameters.java index 4da7af058ee8..ab9787d8a415 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQueryWithParameters.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/MappingSqlQueryWithParameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,7 +70,7 @@ public MappingSqlQueryWithParameters(DataSource ds, String sql) { * implementation of the mapRow() method. */ @Override - protected RowMapper newRowMapper(Object[] parameters, Map context) { + protected RowMapper newRowMapper(Object[] parameters, Map context) { return new RowMapperImpl(parameters, context); } @@ -89,7 +89,7 @@ protected RowMapper newRowMapper(Object[] parameters, Map context) { * Subclasses can simply not catch SQLExceptions, relying on the * framework to clean up. */ - protected abstract T mapRow(ResultSet rs, int rowNum, Object[] parameters, Map context) + protected abstract T mapRow(ResultSet rs, int rowNum, Object[] parameters, Map context) throws SQLException; @@ -101,12 +101,12 @@ protected class RowMapperImpl implements RowMapper { private final Object[] params; - private final Map context; + private final Map context; /** * Use an array results. More efficient if we know how many results to expect. */ - public RowMapperImpl(Object[] parameters, Map context) { + public RowMapperImpl(Object[] parameters, Map context) { this.params = parameters; this.context = context; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java index 9884cd935d2c..92ecb6983f9f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ public abstract class RdbmsOperation implements InitializingBean { private boolean updatableResults = false; private boolean returnGeneratedKeys = false; - + private String[] generatedKeysColumnNames = null; private String sql; @@ -82,8 +82,8 @@ public abstract class RdbmsOperation implements InitializingBean { * but subclasses may also implement their own custom validation. */ private boolean compiled; - - + + /** * An alternative to the more commonly used setDataSource() when you want to * use the same JdbcTemplate in multiple RdbmsOperations. This is appropriate if the @@ -281,7 +281,7 @@ public void declareParameter(SqlParameter param) throws InvalidDataAccessApiUsag } /** - * Add one or more declared parameters. Used for configuring this operation + * Add one or more declared parameters. Used for configuring this operation * when used in a bean factory. Each parameter will specify SQL type and (optionally) * the parameter's name. * @param parameters Array containing the declared {@link SqlParameter} objects @@ -334,8 +334,8 @@ public final void compile() throws InvalidDataAccessApiUsageException { } catch (IllegalArgumentException ex) { throw new InvalidDataAccessApiUsageException(ex.getMessage()); - } - + } + compileInternal(); this.compiled = true; @@ -400,7 +400,7 @@ protected void validateParameters(Object[] parameters) throws InvalidDataAccessA */ protected void validateNamedParameters(Map parameters) throws InvalidDataAccessApiUsageException { checkCompiled(); - Map paramsToUse = (parameters != null ? parameters : Collections.emptyMap()); + Map paramsToUse = (parameters != null ? parameters : Collections.emptyMap()); int declaredInParameters = 0; for (SqlParameter param : this.declaredParameters) { if (param.isInputValueProvided()) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlCall.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlCall.java index 58c9b137b28b..6d225ffb97d3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlCall.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlCall.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java index 30965dbca1bb..ddcc18b33a9f 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import org.springframework.jdbc.core.SingleColumnRowMapper; /** - * SQL "function" wrapper for a query that returns a single row of results. - * The default behavior is to return an int, but that can be overridden by + * SQL "function" wrapper for a query that returns a single row of results. + * The default behavior is to return an int, but that can be overridden by * using the constructor with an extra return type parameter. * *

      Intended to use to call SQL functions that return a single result using a diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlOperation.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlOperation.java index df90e9de841e..ecbe54490a2d 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlOperation.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlOperation.java @@ -86,7 +86,7 @@ protected ParsedSql getParsedSql() { } } - + /** * Return a PreparedStatementSetter to perform an operation * with the given parameters. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java index 06a07432c131..30b01441dbb0 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ public int getRowsExpected() { * @return a List of objects, one per row of the ResultSet. Normally all these * will be of the same class, although it is possible to use different types. */ - public List execute(Object[] params, Map context) throws DataAccessException { + public List execute(Object[] params, Map context) throws DataAccessException { validateParameters(params); RowMapper rowMapper = newRowMapper(params, context); return getJdbcTemplate().query(newPreparedStatementCreator(params), rowMapper); @@ -126,7 +126,7 @@ public List execute(Object... params) throws DataAccessException { * Convenient method to execute without parameters. * @param context the contextual information for object creation */ - public List execute(Map context) throws DataAccessException { + public List execute(Map context) throws DataAccessException { return execute((Object[]) null, context); } @@ -142,7 +142,7 @@ public List execute() throws DataAccessException { * @param p1 single int parameter * @param context the contextual information for object creation */ - public List execute(int p1, Map context) throws DataAccessException { + public List execute(int p1, Map context) throws DataAccessException { return execute(new Object[] {p1}, context); } @@ -160,7 +160,7 @@ public List execute(int p1) throws DataAccessException { * @param p2 second int parameter * @param context the contextual information for object creation */ - public List execute(int p1, int p2, Map context) throws DataAccessException { + public List execute(int p1, int p2, Map context) throws DataAccessException { return execute(new Object[] {p1, p2}, context); } @@ -178,7 +178,7 @@ public List execute(int p1, int p2) throws DataAccessException { * @param p1 single long parameter * @param context the contextual information for object creation */ - public List execute(long p1, Map context) throws DataAccessException { + public List execute(long p1, Map context) throws DataAccessException { return execute(new Object[] {p1}, context); } @@ -195,7 +195,7 @@ public List execute(long p1) throws DataAccessException { * @param p1 single String parameter * @param context the contextual information for object creation */ - public List execute(String p1, Map context) throws DataAccessException { + public List execute(String p1, Map context) throws DataAccessException { return execute(new Object[] {p1}, context); } @@ -219,7 +219,7 @@ public List execute(String p1) throws DataAccessException { * @return a List of objects, one per row of the ResultSet. Normally all these * will be of the same class, although it is possible to use different types. */ - public List executeByNamedParam(Map paramMap, Map context) throws DataAccessException { + public List executeByNamedParam(Map paramMap, Map context) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); @@ -248,7 +248,7 @@ public List executeByNamedParam(Map paramMap) throws DataAccessExc * choose to treat this as an error and throw an exception. * @see org.springframework.dao.support.DataAccessUtils#singleResult */ - public T findObject(Object[] params, Map context) throws DataAccessException { + public T findObject(Object[] params, Map context) throws DataAccessException { List results = execute(params, context); return DataAccessUtils.singleResult(results); } @@ -264,7 +264,7 @@ public T findObject(Object... params) throws DataAccessException { * Convenient method to find a single object given a single int parameter * and a context. */ - public T findObject(int p1, Map context) throws DataAccessException { + public T findObject(int p1, Map context) throws DataAccessException { return findObject(new Object[] {p1}, context); } @@ -279,7 +279,7 @@ public T findObject(int p1) throws DataAccessException { * Convenient method to find a single object given two int parameters * and a context. */ - public T findObject(int p1, int p2, Map context) throws DataAccessException { + public T findObject(int p1, int p2, Map context) throws DataAccessException { return findObject(new Object[] {p1, p2}, context); } @@ -294,7 +294,7 @@ public T findObject(int p1, int p2) throws DataAccessException { * Convenient method to find a single object given a single long parameter * and a context. */ - public T findObject(long p1, Map context) throws DataAccessException { + public T findObject(long p1, Map context) throws DataAccessException { return findObject(new Object[] {p1}, context); } @@ -309,7 +309,7 @@ public T findObject(long p1) throws DataAccessException { * Convenient method to find a single object given a single String parameter * and a context. */ - public T findObject(String p1, Map context) throws DataAccessException { + public T findObject(String p1, Map context) throws DataAccessException { return findObject(new Object[] {p1}, context); } @@ -331,7 +331,7 @@ public T findObject(String p1) throws DataAccessException { * @return a List of objects, one per row of the ResultSet. Normally all these * will be of the same class, although it is possible to use different types. */ - public T findObjectByNamedParam(Map paramMap, Map context) throws DataAccessException { + public T findObjectByNamedParam(Map paramMap, Map context) throws DataAccessException { List results = executeByNamedParam(paramMap, context); return DataAccessUtils.singleResult(results); } @@ -358,6 +358,6 @@ public T findObjectByNamedParam(Map paramMap) throws DataAccessExcept * but it can be useful for creating the objects of the result list. * @see #execute */ - protected abstract RowMapper newRowMapper(Object[] parameters, Map context); + protected abstract RowMapper newRowMapper(Object[] parameters, Map context); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlUpdate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlUpdate.java index 27a108b043f3..d631ca628574 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlUpdate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -171,7 +171,7 @@ public int update(Object... params) throws DataAccessException { } /** - * Method to execute the update given arguments and + * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param params array of parameter objects * @param generatedKeyHolder KeyHolder that will hold the generated keys diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java index c284edf3b3f1..198b829c9f68 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ protected StoredProcedure(DataSource ds, String name) { setDataSource(ds); setSql(name); } - + /** * Create a new object wrapper for a stored procedure. * @param jdbcTemplate JdbcTemplate which wraps DataSource @@ -147,9 +147,9 @@ public Map execute(Map inParams) throws DataAccessExc /** * Execute the stored procedure. Subclasses should define a strongly typed * execute method (with a meaningful name) that invokes this method, passing in - * a ParameterMapper that will populate the input map. This allows mapping database + * a ParameterMapper that will populate the input map. This allows mapping database * specific features since the ParameterMapper has access to the Connection object. - * The execute method is also responsible for extracting typed values from the output map. + * The execute method is also responsible for extracting typed values from the output map. * Subclass execute methods will often take domain objects as arguments and return values. * Alternatively, they can return void. * @param inParamMapper map of input parameters, keyed by name as in parameter diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/UpdatableSqlQuery.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/UpdatableSqlQuery.java index 8a4c1d772849..a4ba75dc7f25 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/UpdatableSqlQuery.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/UpdatableSqlQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * Reusable RDBMS query in which concrete subclasses must implement - * the abstract updateRow(ResultSet, int, context) method to update each + * the abstract updateRow(ResultSet, int, context) method to update each * row of the JDBC ResultSet and optionally map contents into an object. * *

      Subclasses can be constructed providing SQL, parameter types @@ -60,26 +60,26 @@ public UpdatableSqlQuery(DataSource ds, String sql) { * implementation of the updateRow() method. */ @Override - protected RowMapper newRowMapper(Object[] parameters, Map context) { + protected RowMapper newRowMapper(Object[] parameters, Map context) { return new RowMapperImpl(context); } /** - * Subclasses must implement this method to update each row of the + * Subclasses must implement this method to update each row of the * ResultSet and optionally create object of the result type. * @param rs ResultSet we're working through * @param rowNum row number (from 0) we're up to * @param context passed to the execute() method. * It can be null if no contextual information is need. If you - * need to pass in data for each row, you can pass in a HashMap with + * need to pass in data for each row, you can pass in a HashMap with * the primary key of the row being the key for the HashMap. That way - * it is easy to locate the updates for each row + * it is easy to locate the updates for each row * @return an object of the result type * @throws SQLException if there's an error updateing data. * Subclasses can simply not catch SQLExceptions, relying on the * framework to clean up. */ - protected abstract T updateRow(ResultSet rs, int rowNum, Map context) throws SQLException; + protected abstract T updateRow(ResultSet rs, int rowNum, Map context) throws SQLException; /** @@ -88,9 +88,9 @@ protected RowMapper newRowMapper(Object[] parameters, Map context) { */ protected class RowMapperImpl implements RowMapper { - private final Map context; + private final Map context; - public RowMapperImpl(Map context) { + public RowMapperImpl(Map context) { this.context = context; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/package-info.java index a3805eeb7529..f8ec12f7d911 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/package-info.java @@ -5,13 +5,13 @@ * and stored procedures as threadsafe, reusable objects. This approach * is modelled by JDO, although of course objects returned by queries * are "disconnected" from the database. - * + * *

      This higher level of JDBC abstraction depends on the lower-level * abstraction in the org.springframework.jdbc.core package. * Exceptions thrown are as in the org.springframework.dao package, * meaning that code using this package does not need to implement JDBC or * RDBMS-specific error handling. - * + * *

      This package and related packages are discussed in Chapter 9 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/package-info.java index 1d14b31fd9e9..a58744a9fabf 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/package-info.java @@ -14,7 +14,7 @@ * to target different RDBMSes without introducing proprietary * dependencies into application code. * - * + * *

      This package and related packages are discussed in Chapter 9 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java index bea2aa7461b7..7d693beb3b09 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java index 82954fd435b6..b7f636ebba70 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class CustomSQLErrorCodesTranslation { private String[] errorCodes = new String[0]; - private Class exceptionClass; + private Class exceptionClass; /** @@ -52,7 +52,7 @@ public String[] getErrorCodes() { /** * Set the exception class for the specified error codes. */ - public void setExceptionClass(Class exceptionClass) { + public void setExceptionClass(Class exceptionClass) { if (!DataAccessException.class.isAssignableFrom(exceptionClass)) { throw new IllegalArgumentException("Invalid exception class [" + exceptionClass + "]: needs to be a subclass of [org.springframework.dao.DataAccessException]"); @@ -63,7 +63,7 @@ public void setExceptionClass(Class exceptionClass) { /** * Return the exception class for the specified error codes. */ - public Class getExceptionClass() { + public Class getExceptionClass() { return this.exceptionClass; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseMetaDataCallback.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseMetaDataCallback.java index ebaf984a2d79..fa0d270d7719 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseMetaDataCallback.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseMetaDataCallback.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,7 +19,7 @@ import java.sql.DatabaseMetaData; import java.sql.SQLException; -/** +/** * A callback interface used by the JdbcUtils class. Implementations of this * interface perform the actual work of extracting database meta data, but * don't need to worry about exception handling. SQLExceptions will be caught @@ -29,8 +29,8 @@ * @see JdbcUtils#extractDatabaseMetaData */ public interface DatabaseMetaDataCallback { - - /** + + /** * Implementations must implement this method to process the meta data * passed in. Exactly what the implementation chooses to do is up to it. * @param dbmd the DatabaseMetaData to process diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseStartupValidator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseStartupValidator.java index acc95ccac722..f1858ac576a2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseStartupValidator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/DatabaseStartupValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcAccessor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcAccessor.java index a81b36db81ac..fd27793c6915 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcAccessor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java index f07ba9ae1931..2cb1f7a46fde 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,7 @@ public static void closeResultSet(ResultSet rs) { * @return the value object * @throws SQLException if thrown by the JDBC API */ - public static Object getResultSetValue(ResultSet rs, int index, Class requiredType) throws SQLException { + public static Object getResultSetValue(ResultSet rs, int index, Class requiredType) throws SQLException { if (requiredType == null) { return getResultSetValue(rs, index); } @@ -387,8 +387,8 @@ public static String commonDatabaseName(String source) { name = "DB2"; } else if ("Sybase SQL Server".equals(source) || - "Adaptive Server Enterprise".equals(source) || - "ASE".equals(source) || + "Adaptive Server Enterprise".equals(source) || + "ASE".equals(source) || "sql server".equalsIgnoreCase(source) ) { name = "Sybase"; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java index 481623c43213..5be6970438b9 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/KeyHolder.java @@ -21,7 +21,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException; -/** +/** * Interface for retrieving keys, typically used for auto-generated keys * as potentially returned by JDBC insert statements. * @@ -41,8 +41,8 @@ * @see org.springframework.jdbc.object.SqlUpdate */ public interface KeyHolder { - - /** + + /** * Retrieve the first item from the first map, assuming that there is just * one item and just one map, and that the item is a number. * This is the typical case: a single, numeric generated key. @@ -54,9 +54,9 @@ public interface KeyHolder { * @return the generated key * @throws InvalidDataAccessApiUsageException if multiple keys are encountered. */ - Number getKey() throws InvalidDataAccessApiUsageException; + Number getKey() throws InvalidDataAccessApiUsageException; - /** + /** * Retrieve the first map of keys. If there are multiple entries in the list * (meaning that multiple rows had keys returned), then an * InvalidDataAccessApiUsageException is thrown. @@ -65,7 +65,7 @@ public interface KeyHolder { */ Map getKeys() throws InvalidDataAccessApiUsageException; - /** + /** * Return a reference to the List that contains the keys. * Can be used for extracting keys for multiple rows (an unusual case), * and also for adding new maps of keys. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java index 5545511b2094..40fe0ea44cc3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -315,14 +315,14 @@ protected DataAccessException customTranslate(String task, String sql, SQLExcept * @see CustomSQLErrorCodesTranslation#setExceptionClass */ protected DataAccessException createCustomException( - String task, String sql, SQLException sqlEx, Class exceptionClass) { + String task, String sql, SQLException sqlEx, Class exceptionClass) { // find appropriate constructor try { int constructorType = 0; - Constructor[] constructors = exceptionClass.getConstructors(); + Constructor[] constructors = exceptionClass.getConstructors(); for (int i = 0; i < constructors.length; i++) { - Class[] parameterTypes = constructors[i].getParameterTypes(); + Class[] parameterTypes = constructors[i].getParameterTypes(); if (parameterTypes.length == 1 && parameterTypes[0].equals(String.class)) { if (constructorType < MESSAGE_ONLY_CONSTRUCTOR) constructorType = MESSAGE_ONLY_CONSTRUCTOR; @@ -350,30 +350,30 @@ protected DataAccessException createCustomException( } // invoke constructor - Constructor exceptionConstructor = null; + Constructor exceptionConstructor = null; switch (constructorType) { case MESSAGE_SQL_SQLEX_CONSTRUCTOR: - Class[] messageAndSqlAndSqlExArgsClass = new Class[] {String.class, String.class, SQLException.class}; + Class[] messageAndSqlAndSqlExArgsClass = new Class[] {String.class, String.class, SQLException.class}; Object[] messageAndSqlAndSqlExArgs = new Object[] {task, sql, sqlEx}; exceptionConstructor = exceptionClass.getConstructor(messageAndSqlAndSqlExArgsClass); return (DataAccessException) exceptionConstructor.newInstance(messageAndSqlAndSqlExArgs); case MESSAGE_SQL_THROWABLE_CONSTRUCTOR: - Class[] messageAndSqlAndThrowableArgsClass = new Class[] {String.class, String.class, Throwable.class}; + Class[] messageAndSqlAndThrowableArgsClass = new Class[] {String.class, String.class, Throwable.class}; Object[] messageAndSqlAndThrowableArgs = new Object[] {task, sql, sqlEx}; exceptionConstructor = exceptionClass.getConstructor(messageAndSqlAndThrowableArgsClass); return (DataAccessException) exceptionConstructor.newInstance(messageAndSqlAndThrowableArgs); case MESSAGE_SQLEX_CONSTRUCTOR: - Class[] messageAndSqlExArgsClass = new Class[] {String.class, SQLException.class}; + Class[] messageAndSqlExArgsClass = new Class[] {String.class, SQLException.class}; Object[] messageAndSqlExArgs = new Object[] {task + ": " + sqlEx.getMessage(), sqlEx}; exceptionConstructor = exceptionClass.getConstructor(messageAndSqlExArgsClass); return (DataAccessException) exceptionConstructor.newInstance(messageAndSqlExArgs); case MESSAGE_THROWABLE_CONSTRUCTOR: - Class[] messageAndThrowableArgsClass = new Class[] {String.class, Throwable.class}; + Class[] messageAndThrowableArgsClass = new Class[] {String.class, Throwable.class}; Object[] messageAndThrowableArgs = new Object[] {task + ": " + sqlEx.getMessage(), sqlEx}; exceptionConstructor = exceptionClass.getConstructor(messageAndThrowableArgsClass); return (DataAccessException)exceptionConstructor.newInstance(messageAndThrowableArgs); case MESSAGE_ONLY_CONSTRUCTOR: - Class[] messageOnlyArgsClass = new Class[] {String.class}; + Class[] messageOnlyArgsClass = new Class[] {String.class}; Object[] messageOnlyArgs = new Object[] {task + ": " + sqlEx.getMessage()}; exceptionConstructor = exceptionClass.getConstructor(messageOnlyArgsClass); return (DataAccessException) exceptionConstructor.newInstance(messageOnlyArgs); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodes.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodes.java index c82bbad5bf55..298343bf3692 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodes.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodes.java @@ -174,7 +174,7 @@ public String[] getDeadlockLoserCodes() { public void setCannotSerializeTransactionCodes(String[] cannotSerializeTransactionCodes) { this.cannotSerializeTransactionCodes = StringUtils.sortStringArray(cannotSerializeTransactionCodes); } - + public String[] getCannotSerializeTransactionCodes() { return this.cannotSerializeTransactionCodes; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodesFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodesFactory.java index a127e829376b..445ecf5b1a59 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodesFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodesFactory.java @@ -130,10 +130,10 @@ protected SQLErrorCodesFactory() { logger.warn("Error loading SQL error codes from config file", ex); errorCodes = Collections.emptyMap(); } - + this.errorCodesMap = errorCodes; } - + /** * Load the given resource from the class path. *

      Not to be overridden by application developers, who should obtain @@ -159,7 +159,7 @@ protected Resource loadResource(String path) { */ public SQLErrorCodes getErrorCodes(String dbName) { Assert.notNull(dbName, "Database product name must not be null"); - + SQLErrorCodes sec = this.errorCodesMap.get(dbName); if (sec == null) { for (SQLErrorCodes candidate : this.errorCodesMap.values()) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SqlServerMaxValueIncrementer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SqlServerMaxValueIncrementer.java index 99d41cc0cd3c..fea25531ca7a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SqlServerMaxValueIncrementer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SqlServerMaxValueIncrementer.java @@ -26,7 +26,7 @@ *

       create table tab (id int not null primary key, text varchar(100))
        * create table tab_sequence (id bigint identity)
        * insert into tab_sequence default values
      - * + * * If "cacheSize" is set, the intermediate values are served without querying the * database. If the server or your application is stopped or crashes or a transaction * is rolled back, the unused values will never be served. The maximum hole size in diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseAnywhereMaxValueIncrementer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseAnywhereMaxValueIncrementer.java index 679ff4a1cee3..8b3a04a99956 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseAnywhereMaxValueIncrementer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseAnywhereMaxValueIncrementer.java @@ -19,7 +19,7 @@ import javax.sql.DataSource; /** - * {@link org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer} that increments + * {@link org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer} that increments * the maximum value of a given Sybase SQL Anywhere table * with the equivalent of an auto-increment column. Note: If you use this class, your table key * column should NOT be defined as an IDENTITY column, as the sequence table does the job. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseMaxValueIncrementer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseMaxValueIncrementer.java index d8a30adfa5b9..22320128891a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseMaxValueIncrementer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/SybaseMaxValueIncrementer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import java.sql.SQLException; /** - * {@link org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer} that increments + * {@link org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer} that increments * the maximum value of a given Sybase SQL Server table * with the equivalent of an auto-increment column. Note: If you use this class, your table key * column should NOT be defined as an IDENTITY column, as the sequence table does the job. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/package-info.java index 6ccd32543249..c6251e9b5b42 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/package-info.java @@ -3,7 +3,7 @@ * * Provides a support framework for incrementing database table values * via sequences, with implementations for various databases. - * + * *

      Can be used independently, for example in custom JDBC access code. * */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/LobCreatorUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/LobCreatorUtils.java index 77afaba1d15d..d5396428af70 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/LobCreatorUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/LobCreatorUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/OracleLobHandler.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/OracleLobHandler.java index e55342b36f2f..c3599da9b5bf 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/OracleLobHandler.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/OracleLobHandler.java @@ -95,15 +95,15 @@ public class OracleLobHandler extends AbstractLobHandler { private Boolean releaseResourcesAfterRead = Boolean.FALSE; - private Class blobClass; + private Class blobClass; - private Class clobClass; + private Class clobClass; - private final Map durationSessionConstants = new HashMap(2); + private final Map, Integer> durationSessionConstants = new HashMap, Integer>(2); - private final Map modeReadWriteConstants = new HashMap(2); + private final Map, Integer> modeReadWriteConstants = new HashMap, Integer>(2); - private final Map modeReadOnlyConstants = new HashMap(2); + private final Map, Integer> modeReadOnlyConstants = new HashMap, Integer>(2); /** @@ -366,7 +366,7 @@ protected void releaseResourcesAfterRead(Connection con, Object lob) { */ protected class OracleLobCreator implements LobCreator { - private final List createdLobs = new LinkedList(); + private final List createdLobs = new LinkedList(); public void setBlobAsBytes(PreparedStatement ps, int paramIndex, final byte[] content) throws SQLException { @@ -537,7 +537,7 @@ protected Connection getOracleConnection(PreparedStatement ps) /** * Create and open an oracle.sql.BLOB/CLOB instance via reflection. */ - protected Object prepareLob(Connection con, Class lobClass) throws Exception { + protected Object prepareLob(Connection con, Class lobClass) throws Exception { /* BLOB blob = BLOB.createTemporary(con, false, BLOB.DURATION_SESSION); blob.open(BLOB.MODE_READWRITE); @@ -556,7 +556,7 @@ protected Object prepareLob(Connection con, Class lobClass) throws Exception { */ public void close() { try { - for (Iterator it = this.createdLobs.iterator(); it.hasNext();) { + for (Iterator it = this.createdLobs.iterator(); it.hasNext();) { /* BLOB blob = (BLOB) it.next(); blob.freeTemporary(); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java index 08d63d6ec583..2991509bf7ac 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java @@ -3,7 +3,7 @@ * * Provides a stategy interface for Large OBject handling, * with implementations for various databases. - * + * *

      Can be used independently from jdbc.core and jdbc.object, * for example in custom JDBC access code. * diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/C3P0NativeJdbcExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/C3P0NativeJdbcExtractor.java index 9830899c9d3c..6399d72ae3c6 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/C3P0NativeJdbcExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/C3P0NativeJdbcExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/CommonsDbcpNativeJdbcExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/CommonsDbcpNativeJdbcExtractor.java index 9332ca52f5fe..7c36cde86b06 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/CommonsDbcpNativeJdbcExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/CommonsDbcpNativeJdbcExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ private static Object getInnermostDelegate(Object obj) throws SQLException { return null; } try { - Class classToAnalyze = obj.getClass(); + Class classToAnalyze = obj.getClass(); while (!Modifier.isPublic(classToAnalyze.getModifiers())) { classToAnalyze = classToAnalyze.getSuperclass(); if (classToAnalyze == null) { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/JBossNativeJdbcExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/JBossNativeJdbcExtractor.java index d5f24aaee1d2..0885b7f4289a 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/JBossNativeJdbcExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/JBossNativeJdbcExtractor.java @@ -55,11 +55,11 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter { private static final String JBOSS_RESOURCE_PREFIX = "org.jboss.resource.adapter.jdbc."; - private Class wrappedConnectionClass; + private Class wrappedConnectionClass; - private Class wrappedStatementClass; + private Class wrappedStatementClass; - private Class wrappedResultSetClass; + private Class wrappedResultSetClass; private Method getUnderlyingConnectionMethod; @@ -155,5 +155,5 @@ public ResultSet getNativeResultSet(ResultSet rs) throws SQLException { } return rs; } - + } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebLogicNativeJdbcExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebLogicNativeJdbcExtractor.java index b683195fcb6f..469a30427d9e 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebLogicNativeJdbcExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebLogicNativeJdbcExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class WebLogicNativeJdbcExtractor extends NativeJdbcExtractorAdapter { private static final String JDBC_EXTENSION_NAME = "weblogic.jdbc.extensions.WLConnection"; - private final Class jdbcExtensionClass; + private final Class jdbcExtensionClass; private final Method getVendorConnectionMethod; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebSphereNativeJdbcExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebSphereNativeJdbcExtractor.java index 6a97587013da..04070b9247f7 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebSphereNativeJdbcExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/WebSphereNativeJdbcExtractor.java @@ -45,7 +45,7 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter { private static final String JDBC_ADAPTER_UTIL_NAME_5 = "com.ibm.ws.rsadapter.jdbc.WSJdbcUtil"; - private Class webSphere5ConnectionClass; + private Class webSphere5ConnectionClass; private Method webSphere5NativeConnectionMethod; @@ -57,7 +57,7 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter { public WebSphereNativeJdbcExtractor() { try { this.webSphere5ConnectionClass = getClass().getClassLoader().loadClass(JDBC_ADAPTER_CONNECTION_NAME_5); - Class jdbcAdapterUtilClass = getClass().getClassLoader().loadClass(JDBC_ADAPTER_UTIL_NAME_5); + Class jdbcAdapterUtilClass = getClass().getClassLoader().loadClass(JDBC_ADAPTER_UTIL_NAME_5); this.webSphere5NativeConnectionMethod = jdbcAdapterUtilClass.getMethod("getNativeConnection", new Class[] {this.webSphere5ConnectionClass}); } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/package-info.java index e8fe8591b4b0..1397cab074da 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/nativejdbc/package-info.java @@ -3,7 +3,7 @@ * * Provides a mechanism for extracting native implementations of JDBC * interfaces from wrapper objects that got returned from connection pools. - * + * *

      Can be used independently, for example in custom JDBC access code. * */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/package-info.java index 84132343285b..13f9784fb598 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/package-info.java @@ -4,7 +4,7 @@ * Support classes for the JDBC framework, used by the classes in the * jdbc.core and jdbc.object packages. Provides a translator from * SQLExceptions Spring's generic DataAccessExceptions. - * + * *

      Can be used independently, for example in custom JDBC access code, * or in JDBC-based O/R mapping layers. * diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java index 23327ee7a2a5..1256563e9dde 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java @@ -71,7 +71,7 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { private final ResultSet resultSet; private final SqlRowSetMetaData rowSetMetaData; - + private final Map columnLabelMap; @@ -109,7 +109,7 @@ public ResultSetWrappingSqlRowSet(ResultSet resultSet) throws InvalidResultSetAc catch (SQLException se) { throw new InvalidResultSetAccessException(se); } - + } @@ -128,7 +128,7 @@ public final ResultSet getResultSet() { public final SqlRowSetMetaData getMetaData() { return this.rowSetMetaData; } - + /** * @see java.sql.ResultSet#findColumn(String) */ @@ -161,7 +161,7 @@ public BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessEx throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getBigDecimal(String) */ @@ -187,7 +187,7 @@ public boolean getBoolean(int columnIndex) throws InvalidResultSetAccessExceptio public boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException { return getBoolean(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getByte(int) */ @@ -199,14 +199,14 @@ public byte getByte(int columnIndex) throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getByte(String) */ public byte getByte(String columnLabel) throws InvalidResultSetAccessException { return getByte(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getDate(int, java.util.Calendar) */ @@ -218,7 +218,7 @@ public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccess throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getDate(int) */ @@ -236,14 +236,14 @@ public Date getDate(int columnIndex) throws InvalidResultSetAccessException { public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException { return getDate(findColumn(columnLabel), cal); } - + /** * @see java.sql.ResultSet#getDate(String) */ public Date getDate(String columnLabel) throws InvalidResultSetAccessException { return getDate(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getDouble(int) */ @@ -255,14 +255,14 @@ public double getDouble(int columnIndex) throws InvalidResultSetAccessException throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getDouble(String) */ public double getDouble(String columnLabel) throws InvalidResultSetAccessException { return getDouble(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getFloat(int) */ @@ -299,7 +299,7 @@ public int getInt(int columnIndex) throws InvalidResultSetAccessException { public int getInt(String columnLabel) throws InvalidResultSetAccessException { return getInt(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getLong(int) */ @@ -311,14 +311,14 @@ public long getLong(int columnIndex) throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getLong(String) */ public long getLong(String columnLabel) throws InvalidResultSetAccessException { return getLong(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getObject(int, java.util.Map) */ @@ -330,7 +330,7 @@ public Object getObject(int i, Map> map) throws InvalidResultS throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getObject(int) */ @@ -342,21 +342,21 @@ public Object getObject(int columnIndex) throws InvalidResultSetAccessException throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getObject(String, java.util.Map) */ public Object getObject(String columnLabel, Map> map) throws InvalidResultSetAccessException { return getObject(findColumn(columnLabel), map); } - + /** * @see java.sql.ResultSet#getObject(String) */ public Object getObject(String columnLabel) throws InvalidResultSetAccessException { return getObject(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getShort(int) */ @@ -368,14 +368,14 @@ public short getShort(int columnIndex) throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getShort(String) */ public short getShort(String columnLabel) throws InvalidResultSetAccessException { return getShort(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getString(int) */ @@ -387,14 +387,14 @@ public String getString(int columnIndex) throws InvalidResultSetAccessException throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getString(String) */ public String getString(String columnLabel) throws InvalidResultSetAccessException { return getString(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getTime(int, java.util.Calendar) */ @@ -406,7 +406,7 @@ public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccess throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getTime(int) */ @@ -425,14 +425,14 @@ public Time getTime(int columnIndex) throws InvalidResultSetAccessException { public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException { return getTime(findColumn(columnLabel), cal); } - + /** * @see java.sql.ResultSet#getTime(String) */ public Time getTime(String columnLabel) throws InvalidResultSetAccessException { return getTime(findColumn(columnLabel)); } - + /** * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar) */ @@ -444,7 +444,7 @@ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResul throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#getTimestamp(int) */ @@ -473,7 +473,7 @@ public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessE // RowSet navigation methods - + /** * @see java.sql.ResultSet#absolute(int) */ @@ -497,7 +497,7 @@ public void afterLast() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#beforeFirst() */ @@ -509,7 +509,7 @@ public void beforeFirst() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#first() */ @@ -557,7 +557,7 @@ public boolean isBeforeFirst() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#isFirst() */ @@ -569,7 +569,7 @@ public boolean isFirst() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#isLast() */ @@ -581,7 +581,7 @@ public boolean isLast() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#last() */ @@ -593,7 +593,7 @@ public boolean last() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#next() */ @@ -605,7 +605,7 @@ public boolean next() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#previous() */ @@ -617,7 +617,7 @@ public boolean previous() throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#relative(int) */ @@ -629,7 +629,7 @@ public boolean relative(int rows) throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + /** * @see java.sql.ResultSet#wasNull() */ diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java index 483ef36cc57b..985a199af33b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java @@ -63,7 +63,7 @@ public String getCatalogName(int column) throws InvalidResultSetAccessException throw new InvalidResultSetAccessException(se); } } - + public String getColumnClassName(int column) throws InvalidResultSetAccessException { try { return this.resultSetMetaData.getColumnClassName(column); @@ -199,5 +199,5 @@ public boolean isSigned(int column) throws InvalidResultSetAccessException { throw new InvalidResultSetAccessException(se); } } - + } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java index b6846b71eef1..a907c93697a0 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLXML; + +import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; @@ -75,13 +77,13 @@ public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLE } @SuppressWarnings("unchecked") - public Source getXmlAsSource(ResultSet rs, String columnName, Class sourceClass) throws SQLException { - return rs.getSQLXML(columnName).getSource(sourceClass != null ? sourceClass : DOMSource.class); + public Source getXmlAsSource(ResultSet rs, String columnName, Class sourceClass) throws SQLException { + return rs.getSQLXML(columnName).getSource((Class) (sourceClass != null ? sourceClass : DOMSource.class)); } @SuppressWarnings("unchecked") - public Source getXmlAsSource(ResultSet rs, int columnIndex, Class sourceClass) throws SQLException { - return rs.getSQLXML(columnIndex).getSource(sourceClass != null ? sourceClass : DOMSource.class); + public Source getXmlAsSource(ResultSet rs, int columnIndex, Class sourceClass) throws SQLException { + return rs.getSQLXML(columnIndex).getSource((Class) (sourceClass != null ? sourceClass : DOMSource.class)); } @@ -116,12 +118,12 @@ protected void provideXml(SQLXML xmlObject) throws SQLException, IOException { }; } - public SqlXmlValue newSqlXmlValue(final Class resultClass, final XmlResultProvider provider) { + public SqlXmlValue newSqlXmlValue(final Class resultClass, final XmlResultProvider provider) { return new AbstractJdbc4SqlXmlValue() { @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked" }) protected void provideXml(SQLXML xmlObject) throws SQLException, IOException { - provider.provideXml(xmlObject.setResult(resultClass)); + provider.provideXml(xmlObject.setResult((Class)resultClass)); } }; } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/SqlXmlHandler.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/SqlXmlHandler.java index b34071201de1..ddd95b74392b 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/SqlXmlHandler.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/SqlXmlHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,7 +146,7 @@ public interface SqlXmlHandler { * @see java.sql.ResultSet#getSQLXML * @see java.sql.SQLXML#getSource */ - Source getXmlAsSource(ResultSet rs, String columnName, Class sourceClass) throws SQLException; + Source getXmlAsSource(ResultSet rs, String columnName, Class sourceClass) throws SQLException; /** * Retrieve the given column as Source implemented using the specified source class @@ -161,7 +161,7 @@ public interface SqlXmlHandler { * @see java.sql.ResultSet#getSQLXML * @see java.sql.SQLXML#getSource */ - Source getXmlAsSource(ResultSet rs, int columnIndex, Class sourceClass) throws SQLException; + Source getXmlAsSource(ResultSet rs, int columnIndex, Class sourceClass) throws SQLException; //------------------------------------------------------------------------- @@ -207,7 +207,7 @@ public interface SqlXmlHandler { * @see SqlXmlValue * @see java.sql.SQLXML#setResult(Class) */ - SqlXmlValue newSqlXmlValue(Class resultClass, XmlResultProvider provider); + SqlXmlValue newSqlXmlValue(Class resultClass, XmlResultProvider provider); /** * Create a SqlXmlValue instance for the given XML data, diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlBinaryStreamProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlBinaryStreamProvider.java index 5ede88882b3e..96bf9e918cd8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlBinaryStreamProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlBinaryStreamProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlCharacterStreamProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlCharacterStreamProvider.java index 02ffbffa364d..df541c576a09 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlCharacterStreamProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlCharacterStreamProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlResultProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlResultProvider.java index 5b8db54ffe74..9142ecd0b812 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlResultProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/xml/XmlResultProvider.java @@ -32,7 +32,7 @@ public interface XmlResultProvider { * Implementations must implement this method to provide the XML content * for the Result. Implementations will vary depending on * the Result implementation used. - * @param result the Result object being used to provide the XML input + * @param result the Result object being used to provide the XML input */ void provideXml(Result result); diff --git a/spring-jdbc/src/test/java/org/springframework/beans/Colour.java b/spring-jdbc/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..8ee70cc536c4 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/Colour.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/Colour.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ /** * @author Rob Harrop */ +@SuppressWarnings("deprecation") public class Colour extends ShortCodedLabeledEnum { public static final Colour RED = new Colour(0, "RED"); @@ -32,4 +33,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-jdbc/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/beans/IOther.java b/spring-jdbc/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/IOther.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/beans/ITestBean.java b/spring-jdbc/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-jdbc/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..d56d72ef58b8 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ * @author Juergen Hoeller * @since 11.11.2003 */ +@SuppressWarnings("rawtypes") public class IndexedTestBean { private TestBean[] array; @@ -57,6 +58,7 @@ public IndexedTestBean(boolean populate) { } } + @SuppressWarnings("unchecked") public void populate() { TestBean tb0 = new TestBean("name0", 0); TestBean tb1 = new TestBean("name1", 0); @@ -142,4 +144,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-jdbc/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/beans/TestBean.java b/spring-jdbc/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..38bc8a9d8578 100644 --- a/spring-jdbc/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-jdbc/src/test/java/org/springframework/beans/TestBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ * @author Juergen Hoeller * @since 15 April 2001 */ -public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { +public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { private String beanName; @@ -70,13 +70,13 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Float myFloat = new Float(0.0); - private Collection friends = new LinkedList(); + private Collection friends = new LinkedList(); - private Set someSet = new HashSet(); + private Set someSet = new HashSet(); - private Map someMap = new HashMap(); + private Map someMap = new HashMap(); - private List someList = new ArrayList(); + private List someList = new ArrayList(); private Properties someProperties = new Properties(); @@ -94,9 +94,9 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt private Boolean someBoolean; - private List otherColours; + private List otherColours; - private List pets; + private List pets; public TestBean() { @@ -120,15 +120,15 @@ public TestBean(ITestBean spouse, Properties someProperties) { this.someProperties = someProperties; } - public TestBean(List someList) { + public TestBean(List someList) { this.someList = someList; } - public TestBean(Set someSet) { + public TestBean(Set someSet) { this.someSet = someSet; } - public TestBean(Map someMap) { + public TestBean(Map someMap) { this.someMap = someMap; } @@ -262,35 +262,35 @@ public void setMyFloat(Float myFloat) { this.myFloat = myFloat; } - public Collection getFriends() { + public Collection getFriends() { return friends; } - public void setFriends(Collection friends) { + public void setFriends(Collection friends) { this.friends = friends; } - public Set getSomeSet() { + public Set getSomeSet() { return someSet; } - public void setSomeSet(Set someSet) { + public void setSomeSet(Set someSet) { this.someSet = someSet; } - public Map getSomeMap() { + public Map getSomeMap() { return someMap; } - public void setSomeMap(Map someMap) { + public void setSomeMap(Map someMap) { this.someMap = someMap; } - public List getSomeList() { + public List getSomeList() { return someList; } - public void setSomeList(List someList) { + public void setSomeList(List someList) { this.someList = someList; } @@ -350,19 +350,19 @@ public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) { this.nestedIndexedBean = nestedIndexedBean; } - public List getOtherColours() { + public List getOtherColours() { return otherColours; } - public void setOtherColours(List otherColours) { + public void setOtherColours(List otherColours) { this.otherColours = otherColours; } - public List getPets() { + public List getPets() { return pets; } - public void setPets(List pets) { + public void setPets(List pets) { this.pets = pets; } @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/AbstractJdbcTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/AbstractJdbcTests.java index c8fecfdf969d..00cc111235df 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/AbstractJdbcTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/AbstractJdbcTests.java @@ -4,14 +4,14 @@ * Copyright (C) 2002 by Interprise Software. All rights reserved. */ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ public abstract class AbstractJdbcTests extends TestCase { protected DataSource mockDataSource; protected MockControl ctrlConnection; protected Connection mockConnection; - + /** * Set to true if the user wants verification, indicated * by a call to replay(). We need to make this optional, diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/config/InitializeDatabaseIntegrationTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/config/InitializeDatabaseIntegrationTests.java index af62a7c6bf3b..27c1ba3cf845 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/config/InitializeDatabaseIntegrationTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/config/InitializeDatabaseIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,16 +110,16 @@ private void assertCorrectSetup(DataSource dataSource) { JdbcTemplate t = new JdbcTemplate(dataSource); assertEquals(1, t.queryForInt("select count(*) from T_TEST")); } - + public static class CacheData implements InitializingBean { private JdbcTemplate jdbcTemplate; private List> cache; - + public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } - + public List> getCachedData() { return cache; } @@ -127,7 +127,7 @@ public List> getCachedData() { public void afterPropertiesSet() throws Exception { cache = jdbcTemplate.queryForList("SELECT * FROM T_TEST"); } - + } } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java index 3419ccd417b1..33180e95756c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.io.ClassPathResource; @@ -123,7 +123,8 @@ public void testCreateAndDestroyNested() throws Exception { @Test public void testMultipleDataSourcesHaveDifferentDatabaseNames() throws Exception { - DefaultListableBeanFactory factory = new XmlBeanFactory(new ClassPathResource( + DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(factory).loadBeanDefinitions(new ClassPathResource( "org/springframework/jdbc/config/jdbc-config-multiple-datasources.xml")); assertBeanPropertyValueOf("databaseName", "firstDataSource", factory); assertBeanPropertyValueOf("databaseName", "secondDataSource", factory); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java index 6f672cf1ea4f..c5881d44ccec 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/AbstractRowMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/BeanPropertyRowMapperTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/BeanPropertyRowMapperTests.java index 006666d1ce8d..7242eb05c36b 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/BeanPropertyRowMapperTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/BeanPropertyRowMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ */ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests { + @SuppressWarnings({ "rawtypes", "unchecked" }) public void testOverridingClassDefinedForMapping() { BeanPropertyRowMapper mapper = new BeanPropertyRowMapper(Person.class); try { @@ -49,41 +50,41 @@ public void testOverridingClassDefinedForMapping() { } public void testStaticQueryWithRowMapper() throws SQLException { - List result = jdbcTemplate.query("select name, age, birth_date, balance from people", - new BeanPropertyRowMapper(Person.class)); + List result = jdbcTemplate.query("select name, age, birth_date, balance from people", + new BeanPropertyRowMapper(Person.class)); assertEquals(1, result.size()); - Person bean = (Person) result.get(0); + Person bean = result.get(0); verifyPerson(bean); } public void testMappingWithInheritance() throws SQLException { - List result = jdbcTemplate.query("select name, age, birth_date, balance from people", - new BeanPropertyRowMapper(ConcretePerson.class)); + List result = jdbcTemplate.query("select name, age, birth_date, balance from people", + new BeanPropertyRowMapper(ConcretePerson.class)); assertEquals(1, result.size()); - ConcretePerson bean = (ConcretePerson) result.get(0); + ConcretePerson bean = result.get(0); verifyConcretePerson(bean); } public void testMappingWithNoUnpopulatedFieldsFound() throws SQLException { - List result = jdbcTemplate.query("select name, age, birth_date, balance from people", - new BeanPropertyRowMapper(ConcretePerson.class, true)); + List result = jdbcTemplate.query("select name, age, birth_date, balance from people", + new BeanPropertyRowMapper(ConcretePerson.class, true)); assertEquals(1, result.size()); - ConcretePerson bean = (ConcretePerson) result.get(0); + ConcretePerson bean = result.get(0); verifyConcretePerson(bean); } public void testMappingWithUnpopulatedFieldsNotChecked() throws SQLException { - List result = jdbcTemplate.query("select name, age, birth_date, balance from people", - new BeanPropertyRowMapper(ExtendedPerson.class)); + List result = jdbcTemplate.query("select name, age, birth_date, balance from people", + new BeanPropertyRowMapper(ExtendedPerson.class)); assertEquals(1, result.size()); - ExtendedPerson bean = (ExtendedPerson) result.get(0); + ExtendedPerson bean = result.get(0); verifyConcretePerson(bean); } public void testMappingWithUnpopulatedFieldsNotAccepted() throws SQLException { try { - List result = jdbcTemplate.query("select name, age, birth_date, balance from people", - new BeanPropertyRowMapper(ExtendedPerson.class, true)); + jdbcTemplate.query("select name, age, birth_date, balance from people", + new BeanPropertyRowMapper(ExtendedPerson.class, true)); fail("Should have thrown InvalidDataAccessApiUsageException because of missing field"); } catch (InvalidDataAccessApiUsageException ex) { @@ -92,28 +93,28 @@ public void testMappingWithUnpopulatedFieldsNotAccepted() throws SQLException { } public void testMappingNullValue() throws SQLException { - BeanPropertyRowMapper mapper = new BeanPropertyRowMapper(Person.class); + BeanPropertyRowMapper mapper = new BeanPropertyRowMapper(Person.class); try { - List result1 = jdbcTemplate2.query("select name, null as age, birth_date, balance from people", - mapper); + jdbcTemplate2.query( + "select name, null as age, birth_date, balance from people", mapper); fail("Should have thrown TypeMismatchException because of null value"); } catch (TypeMismatchException ex) { // expected } mapper.setPrimitivesDefaultedForNullValue(true); - List result2 = jdbcTemplate2.query("select name, null as age, birth_date, balance from people", + List result = jdbcTemplate2.query("select name, null as age, birth_date, balance from people", mapper); - assertEquals(1, result2.size()); - Person bean = (Person) result2.get(0); + assertEquals(1, result.size()); + Person bean = result.get(0); verifyPersonWithZeroAge(bean); } public void testQueryWithSpaceInColumnName() throws SQLException { - List result = jdbcTemplate3.query("select last_name as \"Last Name\", age, birth_date, balance from people", - new BeanPropertyRowMapper(SpacePerson.class)); + List result = jdbcTemplate3.query("select last_name as \"Last Name\", age, birth_date, balance from people", + new BeanPropertyRowMapper(SpacePerson.class)); assertEquals(1, result.size()); - SpacePerson bean = (SpacePerson) result.get(0); + SpacePerson bean = result.get(0); verifySpacePerson(bean); } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java index 9851a23923cb..593d1c24db9b 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -273,7 +273,7 @@ public void testQueryForMapWithSingleRowAndColumn() throws Exception { public void testQueryForObjectThrowsIncorrectResultSizeForMoreThanOneRow() throws Exception { String sql = "select pass from t_account where first_name='Alef'"; - + mockResultSetMetaData.getColumnCount(); ctrlResultSetMetaData.setReturnValue(1); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java index bfe4c148240d..2d83fcbf547c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import java.sql.Statement; import java.sql.Types; import java.util.ArrayList; -import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -51,7 +50,7 @@ import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter; import org.springframework.util.LinkedCaseInsensitiveMap; -/** +/** * Mock object based tests for JdbcTemplate. * * @author Rod Johnson @@ -221,12 +220,12 @@ private void doTestStrings( String[] results = { "rod", "gary", " portia" }; class StringHandler implements RowCallbackHandler { - private List list = new LinkedList(); + private List list = new LinkedList(); public void processRow(ResultSet rs) throws SQLException { list.add(rs.getString(1)); } public String[] getStrings() { - return (String[]) list.toArray(new String[list.size()]); + return list.toArray(new String[list.size()]); } } @@ -365,7 +364,7 @@ public void testConnectionCallback() throws Exception { JdbcTemplate template = new JdbcTemplate(mockDataSource); template.setNativeJdbcExtractor(new PlainNativeJdbcExtractor()); - Object result = template.execute(new ConnectionCallback() { + Object result = template.execute(new ConnectionCallback() { public Object doInConnection(Connection con) { assertSame(mockConnection, con); return "test"; @@ -389,7 +388,7 @@ public void testConnectionCallbackWithStatementSettings() throws Exception { replay(); JdbcTemplate template = new JdbcTemplate(mockDataSource); - Object result = template.execute(new ConnectionCallback() { + Object result = template.execute(new ConnectionCallback() { public Object doInConnection(Connection con) throws SQLException { PreparedStatement ps = con.prepareStatement("some SQL"); ps.close(); @@ -737,12 +736,12 @@ public void testBatchUpdateWithNoBatchSupportAndSelect() throws Exception { try { template.batchUpdate(sql); fail("Shouldn't have executed batch statement with a select"); - } + } catch (DataAccessException ex) { // pass assertTrue("Check exception type", ex.getClass() == InvalidDataAccessApiUsageException.class); } - + ctrlStatement.verify(); ctrlDatabaseMetaData.verify(); } @@ -1189,7 +1188,7 @@ public void testBatchUpdateWithListOfObjectArraysPlusTypeInfo() throws Exception BatchUpdateTestHelper.verifyBatchUpdateMocks(ctrlPreparedStatement, ctrlDatabaseMetaData); } - + public void testBatchUpdateWithCollectionOfObjects() throws Exception { final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?"; final List ids = new ArrayList(); @@ -1275,12 +1274,12 @@ public void testCouldntGetConnectionOrExceptionTranslator() throws SQLException RowCountCallbackHandler rcch = new RowCountCallbackHandler(); template.query("SELECT ID, FORENAME FROM CUSTMR WHERE ID < 3", rcch); fail("Shouldn't have executed query without a connection"); - } + } catch (CannotGetJdbcConnectionException ex) { // pass assertTrue("Check root cause", ex.getCause() == sex); } - + ctrlDataSource.verify(); } @@ -1348,7 +1347,7 @@ public void testCouldntGetConnectionInOperationWithExceptionTranslatorInitialize //mockConnection.close(); //ctrlConnection.setVoidCallable(1); ctrlConnection.replay(); - + // Change behaviour in setUp() because we only expect one call to getConnection(): // none is necessary to get metadata for exception translator ctrlDataSource = MockControl.createControl(DataSource.class); @@ -1366,26 +1365,26 @@ public void testCouldntGetConnectionInOperationWithExceptionTranslatorInitialize RowCountCallbackHandler rcch = new RowCountCallbackHandler(); template.query("SELECT ID, FORENAME FROM CUSTMR WHERE ID < 3", rcch); fail("Shouldn't have executed query without a connection"); - } + } catch (CannotGetJdbcConnectionException ex) { // pass assertTrue("Check root cause", ex.getCause() == sex); } - + ctrlDataSource.verify(); ctrlConnection.verify(); } - + public void testCouldntGetConnectionInOperationWithExceptionTranslatorInitializedViaBeanProperty() throws Exception { doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitialized(true); } - + public void testCouldntGetConnectionInOperationWithExceptionTranslatorInitializedInAfterPropertiesSet() throws Exception { doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitialized(false); } - + /** * If beanProperty is true, initialize via exception translator bean property; * if false, use afterPropertiesSet(). @@ -1402,7 +1401,7 @@ private void doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitial //mockConnection.close(); //ctrlConnection.setVoidCallable(1); ctrlConnection.replay(); - + // Change behaviour in setUp() because we only expect one call to getConnection(): // none is necessary to get metadata for exception translator ctrlDataSource = MockControl.createControl(DataSource.class); @@ -1434,7 +1433,7 @@ private void doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitial "SELECT ID, FORENAME FROM CUSTMR WHERE ID < 3", rcch); fail("Shouldn't have executed query without a connection"); - } + } catch (CannotGetJdbcConnectionException ex) { // pass assertTrue("Check root cause", ex.getCause() == sex); @@ -1778,7 +1777,7 @@ public void testUseCustomSQLErrorCodeTranslator() throws Exception { mockConnection.createStatement(); ctrlConnection.setReturnValue(mockStatement); - + // Change behaviour in setUp() because we only expect one call to getConnection(): // none is necessary to get metadata for exception translator ctrlConnection = MockControl.createControl(Connection.class); @@ -1817,11 +1816,11 @@ public void processRow(ResultSet rs) assertTrue( "Wanted same exception back, not " + ex, sex == ex.getCause()); - } + } ctrlResultSet.verify(); ctrlStatement.verify(); - + // We didn't call superclass replay() so we need to check these ourselves ctrlDataSource.verify(); ctrlConnection.verify(); @@ -2139,7 +2138,7 @@ public void testCaseInsensitiveResultsMap() throws Exception { template.setResultsMapCaseInsensitive(true); assertTrue("now it should have been set to case insensitive", template.isResultsMapCaseInsensitive()); - + List params = new ArrayList(); params.add(new SqlOutParameter("a", 12)); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/RowMapperTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/RowMapperTests.java index bd992919cb29..03be19d1837c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/RowMapperTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/RowMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public class RowMapperTests extends TestCase { private MockControl rsControl; private ResultSet rs; private JdbcTemplate jdbcTemplate; - private List result; + private List result; protected void setUp() throws SQLException { conControl = MockControl.createControl(Connection.class); @@ -229,8 +229,8 @@ protected void verify() { assertTrue(result != null); assertEquals(2, result.size()); - TestBean tb1 = (TestBean) result.get(0); - TestBean tb2 = (TestBean) result.get(1); + TestBean tb1 = result.get(0); + TestBean tb2 = result.get(1); assertEquals("tb1", tb1.getName()); assertEquals(1, tb1.getAge()); assertEquals("tb2", tb2.getName()); @@ -238,9 +238,9 @@ protected void verify() { } - private static class TestRowMapper implements RowMapper { + private static class TestRowMapper implements RowMapper { - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + public TestBean mapRow(ResultSet rs, int rowNum) throws SQLException { return new TestBean(rs.getString(1), rs.getInt(2)); } } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/StatementCreatorUtilsTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/StatementCreatorUtilsTests.java index 17292869391f..b8fbb4370c8c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/StatementCreatorUtilsTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/StatementCreatorUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java index a564cbaf84d4..f747e09159b4 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/BeanPropertySqlParameterSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ public void hasValueWhereTheUnderlyingBeanPropertyIsNotReadable() throws Excepti assertFalse(source.hasValue("noOp")); } - private static final class NoReadableProperties { + public static final class NoReadableProperties { public void setNoOp(String noOp) { } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java index d7a761323a58..b1180c0e55fb 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplateTests.java index 4716527a36df..c6fbf5894eb9 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -128,10 +128,10 @@ public void testExecute() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("perfId", new Integer(1)); params.put("priceId", new Integer(1)); - assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() { + assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() { public Object doInPreparedStatement(PreparedStatement ps) throws SQLException { assertEquals(mockPreparedStatement, ps); ps.executeUpdate(); @@ -160,10 +160,10 @@ public void testExecuteWithTypedParameters() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("perfId", new SqlParameterValue(Types.DECIMAL, new Integer(1))); params.put("priceId", new SqlParameterValue(Types.INTEGER, new Integer(1))); - assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() { + assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() { public Object doInPreparedStatement(PreparedStatement ps) throws SQLException { assertEquals(mockPreparedStatement, ps); ps.executeUpdate(); @@ -192,7 +192,7 @@ public void testUpdate() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("perfId", new Integer(1)); params.put("priceId", new Integer(1)); int rowsAffected = jt.update(UPDATE_NAMED_PARAMETERS, params); @@ -219,7 +219,7 @@ public void testUpdateWithTypedParameters() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("perfId", new SqlParameterValue(Types.DECIMAL, new Integer(1))); params.put("priceId", new SqlParameterValue(Types.INTEGER, new Integer(1))); int rowsAffected = jt.update(UPDATE_NAMED_PARAMETERS, params); @@ -255,10 +255,10 @@ public void testQueryWithResultSetExtractor() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("id", new SqlParameterValue(Types.DECIMAL, new Integer(1))); params.put("country", "UK"); - Customer cust = (Customer) jt.query(SELECT_NAMED_PARAMETERS, params, new ResultSetExtractor() { + Customer cust = (Customer) jt.query(SELECT_NAMED_PARAMETERS, params, new ResultSetExtractor() { public Object extractData(ResultSet rs) throws SQLException, DataAccessException { rs.next(); Customer cust = new Customer(); @@ -302,10 +302,10 @@ public void testQueryWithRowCallbackHandler() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("id", new SqlParameterValue(Types.DECIMAL, new Integer(1))); params.put("country", "UK"); - final List customers = new LinkedList(); + final List customers = new LinkedList(); jt.query(SELECT_NAMED_PARAMETERS, params, new RowCallbackHandler() { public void processRow(ResultSet rs) throws SQLException { Customer cust = new Customer(); @@ -315,7 +315,7 @@ public void processRow(ResultSet rs) throws SQLException { } }); assertEquals(1, customers.size()); - Customer cust = (Customer) customers.get(0); + Customer cust = customers.get(0); assertTrue("Customer id was assigned correctly", cust.getId() == 1); assertTrue("Customer forename was assigned correctly", cust.getForename().equals("rod")); } @@ -351,11 +351,11 @@ public void testQueryWithRowMapper() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("id", new SqlParameterValue(Types.DECIMAL, new Integer(1))); params.put("country", "UK"); - List customers = jt.query(SELECT_NAMED_PARAMETERS, params, new RowMapper() { - public Object mapRow(ResultSet rs, int rownum) throws SQLException { + List customers = jt.query(SELECT_NAMED_PARAMETERS, params, new RowMapper() { + public Customer mapRow(ResultSet rs, int rownum) throws SQLException { Customer cust = new Customer(); cust.setId(rs.getInt(COLUMN_NAMES[0])); cust.setForename(rs.getString(COLUMN_NAMES[1])); @@ -363,7 +363,7 @@ public Object mapRow(ResultSet rs, int rownum) throws SQLException { } }); assertEquals(1, customers.size()); - Customer cust = (Customer) customers.get(0); + Customer cust = customers.get(0); assertTrue("Customer id was assigned correctly", cust.getId() == 1); assertTrue("Customer forename was assigned correctly", cust.getForename().equals("rod")); } @@ -399,11 +399,11 @@ public void testQueryForObjectWithRowMapper() throws SQLException { replay(); NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource); - Map params = new HashMap(); + Map params = new HashMap(); params.put("id", new SqlParameterValue(Types.DECIMAL, new Integer(1))); params.put("country", "UK"); - Customer cust = (Customer) jt.queryForObject(SELECT_NAMED_PARAMETERS, params, new RowMapper() { - public Object mapRow(ResultSet rs, int rownum) throws SQLException { + Customer cust = jt.queryForObject(SELECT_NAMED_PARAMETERS, params, new RowMapper() { + public Customer mapRow(ResultSet rs, int rownum) throws SQLException { Customer cust = new Customer(); cust.setId(rs.getInt(COLUMN_NAMES[0])); cust.setForename(rs.getString(COLUMN_NAMES[1])); @@ -418,7 +418,8 @@ public void testBatchUpdateWithPlainMap() throws Exception { final String sqlToUse = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?"; final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = :id"; - final Map[] ids = new Map[2]; + @SuppressWarnings("unchecked") + final Map[] ids = new Map[2]; ids[0] = Collections.singletonMap("id", 100); ids[1] = Collections.singletonMap("id", 200); final int[] rowsAffected = new int[] { 1, 2 }; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterQueryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterQueryTests.java index 92166a19bb75..defc21d415ed 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterQueryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterQueryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,10 +113,10 @@ public void testQueryForListWithParamMap() throws Exception { MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); - List li = template.queryForList(sql, parms); + List> li = template.queryForList(sql, parms); assertEquals("All rows returned", 2, li.size()); - assertEquals("First row is Integer", 11, ((Integer)((Map)li.get(0)).get("age")).intValue()); - assertEquals("Second row is Integer", 12, ((Integer)((Map)li.get(1)).get("age")).intValue()); + assertEquals("First row is Integer", 11, li.get(0).get("age")); + assertEquals("Second row is Integer", 12, li.get(1).get("age")); } public void testQueryForListWithParamMapAndEmptyResult() throws Exception { @@ -149,7 +149,7 @@ public void testQueryForListWithParamMapAndEmptyResult() throws Exception { MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); - List li = template.queryForList(sql, parms); + List> li = template.queryForList(sql, parms); assertEquals("All rows returned", 0, li.size()); } @@ -192,9 +192,9 @@ public void testQueryForListWithParamMapAndSingleRowAndColumn() throws Exception MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); - List li = template.queryForList(sql, parms); + List> li = template.queryForList(sql, parms); assertEquals("All rows returned", 1, li.size()); - assertEquals("First row is Integer", 11, ((Integer)((Map)li.get(0)).get("age")).intValue()); + assertEquals("First row is Integer", 11, li.get(0).get("age")); } public void testQueryForListWithParamMapAndIntegerElementAndSingleRowAndColumn() throws Exception { @@ -236,9 +236,9 @@ public void testQueryForListWithParamMapAndIntegerElementAndSingleRowAndColumn() MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); - List li = template.queryForList(sql, parms, Integer.class); + List li = template.queryForList(sql, parms, Integer.class); assertEquals("All rows returned", 1, li.size()); - assertEquals("First row is Integer", 11, ((Integer) li.get(0)).intValue()); + assertEquals("First row is Integer", 11, li.get(0).intValue()); } public void testQueryForMapWithParamMapAndSingleRowAndColumn() throws Exception { @@ -280,8 +280,8 @@ public void testQueryForMapWithParamMapAndSingleRowAndColumn() throws Exception MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); - Map map = template.queryForMap(sql, parms); - assertEquals("Row is Integer", 11, ((Integer) map.get("age")).intValue()); + Map map = template.queryForMap(sql, parms); + assertEquals("Row is Integer", 11, map.get("age")); } public void testQueryForObjectWithParamMapAndRowMapper() throws Exception { @@ -316,8 +316,8 @@ public void testQueryForObjectWithParamMapAndRowMapper() throws Exception { MapSqlParameterSource parms = new MapSqlParameterSource(); parms.addValue("id", new Integer(3)); - Object o = template.queryForObject(sql, parms, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + Object o = template.queryForObject(sql, parms, new RowMapper() { + public Integer mapRow(ResultSet rs, int rowNum) throws SQLException { return new Integer(rs.getInt(1)); } }); @@ -360,7 +360,7 @@ public void testQueryForObjectWithMapAndInteger() throws Exception { NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); - Map parms = new HashMap(); + Map parms = new HashMap(); parms.put("id", new Integer(3)); Object o = template.queryForObject(sql, parms, Integer.class); @@ -498,7 +498,7 @@ public void testQueryForObjectWithParamMapAndListOfExpressionLists() throws Exce NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(mockDataSource); MapSqlParameterSource parms = new MapSqlParameterSource(); - List l1 = new ArrayList(); + List l1 = new ArrayList(); l1.add(new Object[] {new Integer(3), "Rod"}); l1.add(new Object[] {new Integer(4), "Juergen"}); parms.addValue("multiExpressionList", l1); @@ -592,7 +592,7 @@ public void testQueryForLongWithParamBean() throws Exception { } - private static class ParameterBean { + public static class ParameterBean { private int id; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java index 48875c60f07b..09bdebcc4b6a 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java @@ -117,7 +117,7 @@ public void convertTypeMapToSqlParameterList() { @Test(expected = InvalidDataAccessApiUsageException.class) public void buildValueArrayWithMissingParameterValue() throws Exception { String sql = "select count(0) from foo where id = :id"; - NamedParameterUtils.buildValueArray(sql, new HashMap()); + NamedParameterUtils.buildValueArray(sql, new HashMap()); } @Test @@ -168,7 +168,7 @@ public void parseSqlContainingComments() { String sql4 = "/*+ HINT */ xxx /* comment :a ? */ :a yyyy :b :c :a zzzzz /* :xx XX*"; ParsedSql psql4 = NamedParameterUtils.parseSqlStatement(sql4); - Map parameters = Collections.singletonMap("a", "0"); + Map parameters = Collections.singletonMap("a", "0"); assertEquals("/*+ HINT */ xxx /* comment :a ? */ ? yyyy ? ? ? zzzzz /* :xx XX*", NamedParameterUtils.substituteNamedParameters(psql4, new MapSqlParameterSource(parameters))); } @@ -227,7 +227,7 @@ public void parseSqlStatementWithEmptyBracketsOrBracketsInQuotes() throws Except assertEquals(0, parsedSql.getParameterNames().size()); String finalSql = NamedParameterUtils.substituteNamedParameters(parsedSql, null); assertEquals(expectedSql, finalSql); - + String expectedSql2 = "select foo from bar where baz = 'b:{p1}z'"; String sql2 = "select foo from bar where baz = 'b:{p1}z'"; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/ParameterizedBeanPropertyRowMapperTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/ParameterizedBeanPropertyRowMapperTests.java index 64bca82610d5..0c6e93ce6245 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/ParameterizedBeanPropertyRowMapperTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/ParameterizedBeanPropertyRowMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ /** * @author Thomas Risberg */ +@SuppressWarnings("deprecation") public class ParameterizedBeanPropertyRowMapperTests extends AbstractRowMapperTests { private SimpleJdbcTemplate simpleJdbcTemplate; @@ -36,6 +37,7 @@ protected void setUp() throws SQLException { simpleJdbcTemplate = new SimpleJdbcTemplate(jdbcTemplate); } + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testOverridingClassDefinedForMapping() { ParameterizedBeanPropertyRowMapper mapper = ParameterizedBeanPropertyRowMapper.newInstance(Person.class); @@ -56,7 +58,7 @@ public void testOverridingClassDefinedForMapping() { public void testStaticQueryWithRowMapper() throws SQLException { List result = simpleJdbcTemplate.query("select name, age, birth_date, balance from people", - ParameterizedBeanPropertyRowMapper.newInstance(Person.class)); + ParameterizedBeanPropertyRowMapper.newInstance(Person.class)); assertEquals(1, result.size()); Person bean = result.get(0); verifyPerson(bean); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java index 3f69a453194d..4aa217b22eaa 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertTests.java index 7d7b47918e16..319125df5af3 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public void testNoSuchTable() throws Exception { ctrlResultSet.setReturnValue(false); mockResultSet.close(); ctrlResultSet.setVoidCallable(); - + mockDatabaseMetaData.getDatabaseProductName(); ctrlDatabaseMetaData.setReturnValue("MyDB"); mockDatabaseMetaData.supportsGetGeneratedKeys(); @@ -105,7 +105,7 @@ public void testNoSuchTable() throws Exception { SimpleJdbcInsert insert = new SimpleJdbcInsert(mockDataSource).withTableName(NO_SUCH_TABLE); try { - insert.execute(new HashMap()); + insert.execute(new HashMap()); fail("Shouldn't succeed in inserting into table which doesn't exist"); } catch (InvalidDataAccessApiUsageException ex) { // OK diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java index a80ebbe4d460..8456323d30aa 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -328,15 +328,15 @@ public void testQueryForListWithoutArgs() throws Exception { } public void testQueryForListWithArgs() throws Exception { - testDelegation("queryForList", new Object[]{"sql"}, new Object[]{1, 2, 3}, new LinkedList()); + testDelegation("queryForList", new Object[]{"sql"}, new Object[]{1, 2, 3}, new LinkedList()); } public void testQueryForListWithMap() throws Exception { - HashMap args = new HashMap(3); + HashMap args = new HashMap(3); args.put("1", 1); args.put("2", 2); args.put("3", 3); - testDelegation("queryForList", new Object[]{"sql"}, new Object[]{args}, new LinkedList()); + testDelegation("queryForList", new Object[]{"sql"}, new Object[]{args}, new LinkedList()); } public void testQueryForListWithSqlParameterSource() throws Exception { @@ -344,24 +344,24 @@ public void testQueryForListWithSqlParameterSource() throws Exception { args.addValue("1", 1); args.addValue("2", 2); args.addValue("3", 3); - testDelegation("queryForList", new Object[]{"sql"}, new Object[]{args}, new LinkedList()); + testDelegation("queryForList", new Object[]{"sql"}, new Object[]{args}, new LinkedList()); } public void testQueryForMapWithoutArgs() throws Exception { - testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{}, new HashMap()); + testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{}, new HashMap()); } public void testQueryForMapWithArgs() throws Exception { - testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{1, 2, 3}, new HashMap()); + testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{1, 2, 3}, new HashMap()); // TODO test generic type } public void testQueryForMapWithMap() throws Exception { - HashMap args = new HashMap(3); + HashMap args = new HashMap(3); args.put("1", 1); args.put("2", 2); args.put("3", 3); - testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{args}, new HashMap()); + testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{args}, new HashMap()); } public void testQueryForMapWithSqlParameterSource() throws Exception { @@ -369,7 +369,7 @@ public void testQueryForMapWithSqlParameterSource() throws Exception { args.addValue("1", 1); args.addValue("2", 2); args.addValue("3", 3); - testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{args}, new HashMap()); + testDelegation("queryForMap", new Object[]{"sql"}, new Object[]{args}, new HashMap()); } public void testUpdateWithoutArgs() throws Exception { @@ -381,7 +381,7 @@ public void testUpdateWithArgs() throws Exception { } public void testUpdateWithMap() throws Exception { - HashMap args = new HashMap(3); + HashMap args = new HashMap(3); args.put("1", 1); args.put("2", 2); args.put("3", 3); @@ -397,9 +397,9 @@ public void testUpdateWithSqlParameterSource() throws Exception { } private Object testDelegation(String methodName, Object[] typedArgs, Object[] varargs, Object expectedResult) throws Exception { - Class[] unifiedTypes; + Class[] unifiedTypes; Object[] unifiedArgs; - Class[] unifiedTypes2; + Class[] unifiedTypes2; Object[] unifiedArgs2; boolean namedParameters = false; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/TableMetaDataContextTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/TableMetaDataContextTests.java index a02a105c74e8..d42a5810dd51 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/TableMetaDataContextTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/TableMetaDataContextTests.java @@ -144,12 +144,12 @@ public void testMatchInParametersAndSqlTypeInfoWrapping() throws Exception { ctrlMetaDataResultSet.replay(); ctrlColumnsResultSet.replay(); replay(); - + MapSqlParameterSource map = new MapSqlParameterSource(); map.addValue("id", 1); map.addValue("name", "Sven"); map.addValue("customersince", new Date()); - map.addValue("version", 0); + map.addValue("version", 0); map.registerSqlType("customersince", Types.DATE); map.registerSqlType("version", Types.NUMERIC); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcBeanDefinitionReaderTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcBeanDefinitionReaderTests.java index 16f620942cb2..21fc31ea8e1a 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcBeanDefinitionReaderTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcBeanDefinitionReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcDaoSupportTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcDaoSupportTests.java index d9cb7118cc09..d6d091807ced 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcDaoSupportTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/JdbcDaoSupportTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,7 +35,7 @@ public class JdbcDaoSupportTests extends TestCase { public void testJdbcDaoSupportWithDataSource() throws Exception { MockControl dsControl = MockControl.createControl(DataSource.class); DataSource ds = (DataSource) dsControl.getMock(); - final List test = new ArrayList(); + final List test = new ArrayList(); JdbcDaoSupport dao = new JdbcDaoSupport() { protected void initDao() { test.add("test"); @@ -50,7 +50,7 @@ protected void initDao() { public void testJdbcDaoSupportWithJdbcTemplate() throws Exception { JdbcTemplate template = new JdbcTemplate(); - final List test = new ArrayList(); + final List test = new ArrayList(); JdbcDaoSupport dao = new JdbcDaoSupport() { protected void initDao() { test.add("test"); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/LobSupportTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/LobSupportTests.java index 08f3a84f18f9..decd6e2f2b84 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/LobSupportTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/LobSupportTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,62 +34,62 @@ * @author Alef Arendsen */ public class LobSupportTests extends TestCase { - + public void testCreatingPreparedStatementCallback() throws SQLException { // - return value should match // - lob creator should be closed // - set return value should be called // - execute update should be called - + MockControl lobHandlerControl = MockControl.createControl(LobHandler.class); - LobHandler handler = (LobHandler)lobHandlerControl.getMock(); - + LobHandler handler = (LobHandler)lobHandlerControl.getMock(); + MockControl lobCreatorControl = MockControl.createControl(LobCreator.class); LobCreator creator = (LobCreator)lobCreatorControl.getMock(); - + MockControl psControl = MockControl.createControl(PreparedStatement.class); PreparedStatement ps = (PreparedStatement)psControl.getMock(); - + handler.getLobCreator(); lobHandlerControl.setReturnValue(creator); ps.executeUpdate(); psControl.setReturnValue(3); creator.close(); - + lobHandlerControl.replay(); lobCreatorControl.replay(); psControl.replay(); - + class SetValuesCalled { boolean b = false; } - + final SetValuesCalled svc = new SetValuesCalled(); - - AbstractLobCreatingPreparedStatementCallback psc = + + AbstractLobCreatingPreparedStatementCallback psc = new AbstractLobCreatingPreparedStatementCallback(handler) { - + protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException, DataAccessException { svc.b = true; } }; - + assertEquals(new Integer(3), psc.doInPreparedStatement(ps)); - + lobHandlerControl.verify(); lobCreatorControl.verify(); psControl.verify(); assertTrue(svc.b); } - + public void testAbstractLobStreamingResultSetExtractorNoRows() throws SQLException { MockControl rsetControl = MockControl.createControl(ResultSet.class); ResultSet rset = (ResultSet)rsetControl.getMock(); rset.next(); rsetControl.setReturnValue(false); rsetControl.replay(); - + AbstractLobStreamingResultSetExtractor lobRse = getResultSetExtractor(false); try { lobRse.extractData(rset); @@ -98,7 +98,7 @@ public void testAbstractLobStreamingResultSetExtractorNoRows() throws SQLExcepti // expected } } - + public void testAbstractLobStreamingResultSetExtractorOneRow() throws SQLException { MockControl rsetControl = MockControl.createControl(ResultSet.class); ResultSet rset = (ResultSet)rsetControl.getMock(); @@ -109,7 +109,7 @@ public void testAbstractLobStreamingResultSetExtractorOneRow() throws SQLExcepti rset.next(); rsetControl.setReturnValue(false); rsetControl.replay(); - + AbstractLobStreamingResultSetExtractor lobRse = getResultSetExtractor(false); lobRse.extractData(rset); rsetControl.verify(); @@ -125,7 +125,7 @@ public void testAbstractLobStreamingResultSetExtractorMultipleRows() throws SQLE rset.next(); rsetControl.setReturnValue(true); rsetControl.replay(); - + AbstractLobStreamingResultSetExtractor lobRse = getResultSetExtractor(false); try { lobRse.extractData(rset); @@ -135,14 +135,14 @@ public void testAbstractLobStreamingResultSetExtractorMultipleRows() throws SQLE } rsetControl.verify(); } - + public void testAbstractLobStreamingResultSetExtractorCorrectException() throws SQLException { MockControl rsetControl = MockControl.createControl(ResultSet.class); ResultSet rset = (ResultSet)rsetControl.getMock(); rset.next(); rsetControl.setReturnValue(true); rsetControl.replay(); - + AbstractLobStreamingResultSetExtractor lobRse = getResultSetExtractor(true); try { lobRse.extractData(rset); @@ -152,7 +152,7 @@ public void testAbstractLobStreamingResultSetExtractorCorrectException() throws } rsetControl.verify(); } - + private AbstractLobStreamingResultSetExtractor getResultSetExtractor(final boolean ex) { AbstractLobStreamingResultSetExtractor lobRse = new AbstractLobStreamingResultSetExtractor() { protected void streamData(ResultSet rs) throws SQLException, IOException { diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/SqlLobValueTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/SqlLobValueTests.java index 29a4a51fbc1a..ca45fe8cd237 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/SqlLobValueTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/support/SqlLobValueTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ /** * Test cases for the sql lob value: * - * BLOB: + * BLOB: * 1. Types.BLOB: setBlobAsBytes (byte[]) * 2. String: setBlobAsBytes (byte[]) * 3. else: IllegalArgumentException @@ -43,44 +43,44 @@ * 5. InputStream: setClobAsAsciiStream (InputStream) * 6. Reader: setClobAsCharacterStream (Reader) * 7. else: IllegalArgumentException - * + * * @author Alef Arendsen */ public class SqlLobValueTests extends TestCase { - + private MockControl psControl; private PreparedStatement ps; - + private MockControl lobHandlerControl; private LobHandler handler; - + private MockControl lobCreatorControl; private LobCreator creator; - + public void setUp() { // create preparedstatement psControl = MockControl.createControl(PreparedStatement.class); ps = (PreparedStatement) psControl.getMock(); - + // create handler controler lobHandlerControl = MockControl.createControl(LobHandler.class); handler = (LobHandler) lobHandlerControl.getMock(); - + // create creator control lobCreatorControl = MockControl.createControl(LobCreator.class); creator = (LobCreator) lobCreatorControl.getMock(); - + // set initial state handler.getLobCreator(); lobHandlerControl.setReturnValue(creator); } - + private void replay() { psControl.replay(); lobHandlerControl.replay(); lobCreatorControl.replay(); } - + public void test1() throws SQLException { byte[] testBytes = "Bla".getBytes(); creator.setBlobAsBytes(ps, 1, testBytes); @@ -88,40 +88,40 @@ public void test1() throws SQLException { SqlLobValue lob = new SqlLobValue(testBytes, handler); lob.setTypeValue(ps, 1, Types.BLOB, "test"); lobHandlerControl.verify(); - lobCreatorControl.verify(); + lobCreatorControl.verify(); } - + public void test2() throws SQLException { String testString = "Bla"; - + creator.setBlobAsBytes(ps, 1, testString.getBytes()); // set a matcher to match the byte array! - lobCreatorControl.setMatcher(new ArgumentsMatcher() { + lobCreatorControl.setMatcher(new ArgumentsMatcher() { public boolean matches(Object[] arg0, Object[] arg1) { byte[] one = (byte[]) arg0[2]; byte[] two = (byte[]) arg1[2]; return Arrays.equals(one, two); } - public String toString(Object[] arg0) { + public String toString(Object[] arg0) { return "bla"; } }); - + replay(); SqlLobValue lob = new SqlLobValue(testString, handler); lob.setTypeValue(ps, 1, Types.BLOB, "test"); lobHandlerControl.verify(); - lobCreatorControl.verify(); - + lobCreatorControl.verify(); + } - - public void test3() + + public void test3() throws SQLException { - + Date testContent = new Date(); - - SqlLobValue lob = + + SqlLobValue lob = new SqlLobValue(new InputStreamReader(new ByteArrayInputStream("Bla".getBytes())), 12); try { lob.setTypeValue(ps, 1, Types.BLOB, "test"); @@ -131,19 +131,19 @@ public void test3() // expected } } - + public void test4() throws SQLException { String testContent = "Bla"; creator.setClobAsString(ps, 1, testContent); - + replay(); - + SqlLobValue lob = new SqlLobValue(testContent, handler); lob.setTypeValue(ps, 1, Types.CLOB, "test"); lobHandlerControl.verify(); - lobCreatorControl.verify(); + lobCreatorControl.verify(); } - + public void test5() throws SQLException { byte[] testContent = "Bla".getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(testContent); @@ -157,15 +157,15 @@ public String toString(Object[] arg0) { return null; } }); - + replay(); - + SqlLobValue lob = new SqlLobValue(new ByteArrayInputStream(testContent), 3, handler); lob.setTypeValue(ps, 1, Types.CLOB, "test"); lobHandlerControl.verify(); - lobCreatorControl.verify(); + lobCreatorControl.verify(); } - + public void test6()throws SQLException { byte[] testContent = "Bla".getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(testContent); @@ -180,19 +180,19 @@ public String toString(Object[] arg0) { return null; } }); - + replay(); - + SqlLobValue lob = new SqlLobValue(reader, 3, handler); lob.setTypeValue(ps, 1, Types.CLOB, "test"); lobHandlerControl.verify(); lobCreatorControl.verify(); - + } - + public void test7() throws SQLException { Date testContent = new Date(); - + SqlLobValue lob = new SqlLobValue("bla".getBytes()); try { lob.setTypeValue(ps, 1, Types.CLOB, "test"); @@ -202,13 +202,13 @@ public void test7() throws SQLException { // expected } } - + public void testOtherConstructors() throws SQLException { // a bit BS, but we need to test them, as long as they don't throw exceptions - + SqlLobValue lob = new SqlLobValue("bla"); lob.setTypeValue(ps, 1, Types.CLOB, "test"); - + try { lob = new SqlLobValue("bla".getBytes()); lob.setTypeValue(ps, 1, Types.CLOB, "test"); @@ -220,24 +220,24 @@ public void testOtherConstructors() throws SQLException { lob = new SqlLobValue(new ByteArrayInputStream("bla".getBytes()), 3); lob.setTypeValue(ps, 1, Types.CLOB, "test"); - + lob = new SqlLobValue(new InputStreamReader( new ByteArrayInputStream("bla".getBytes())), 3); lob.setTypeValue(ps, 1, Types.CLOB, "test"); - - // same for BLOB + + // same for BLOB lob = new SqlLobValue("bla"); lob.setTypeValue(ps, 1, Types.BLOB, "test"); - + lob = new SqlLobValue("bla".getBytes()); lob.setTypeValue(ps, 1, Types.BLOB, "test"); - + lob = new SqlLobValue(new ByteArrayInputStream("bla".getBytes()), 3); lob.setTypeValue(ps, 1, Types.BLOB, "test"); - + lob = new SqlLobValue(new InputStreamReader( new ByteArrayInputStream("bla".getBytes())), 3); - + try { lob.setTypeValue(ps, 1, Types.BLOB, "test"); fail("IllegalArgumentException should have been thrown"); @@ -246,19 +246,19 @@ public void testOtherConstructors() throws SQLException { // expected } } - + public void testCorrectCleanup() throws SQLException { creator.setClobAsString(ps, 1, "Bla"); creator.close(); - + replay(); SqlLobValue lob = new SqlLobValue("Bla", handler); lob.setTypeValue(ps, 1, Types.CLOB, "test"); lob.cleanup(); - + lobCreatorControl.verify(); } - + public void testOtherSqlType() throws SQLException { replay(); SqlLobValue lob = new SqlLobValue("Bla", handler); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/AbstractPerson.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/AbstractPerson.java index 8526644e12f3..c71a7fd94863 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/AbstractPerson.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/AbstractPerson.java @@ -54,4 +54,4 @@ public void setBirth_date(Date birth_date) { this.birth_date = birth_date; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ConcretePerson.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ConcretePerson.java index 98642343975f..5d13c99c1b0b 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ConcretePerson.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ConcretePerson.java @@ -34,4 +34,4 @@ public void setBalance(BigDecimal balance) { this.balance = balance; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ExtendedPerson.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ExtendedPerson.java index b8fd5c918ad5..21c4f2eb6e2f 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ExtendedPerson.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/ExtendedPerson.java @@ -32,4 +32,4 @@ public void setSomeField(Object someField) { this.someField = someField; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/Person.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/Person.java index 6b2ea627932f..9613b37e94bc 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/Person.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/Person.java @@ -64,4 +64,4 @@ public void setBalance(BigDecimal balanace) { this.balance = balanace; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/SpacePerson.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/SpacePerson.java index b6ad9f9da3ba..5753d724170e 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/SpacePerson.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/test/SpacePerson.java @@ -63,4 +63,4 @@ public void setBalance(BigDecimal balanace) { this.balance = balanace; } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceJtaTransactionTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceJtaTransactionTests.java index 3dcee9661cfb..266afbc2ae11 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceJtaTransactionTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceJtaTransactionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -653,7 +653,7 @@ public void testJtaTransactionWithConnectionHolderStillBound() throws Exception JtaTransactionManager ptm = new JtaTransactionManager(ut) { protected void doRegisterAfterCompletionWithJtaTransaction( - JtaTransactionObject txObject, final List synchronizations) { + JtaTransactionObject txObject, final List synchronizations) { Thread async = new Thread() { public void run() { invokeAfterCompletion(synchronizations, TransactionSynchronization.STATUS_COMMITTED); @@ -843,7 +843,7 @@ private void doTestJtaTransactionWithIsolationLevelDataSourceRouter(boolean data ds2Control.replay(); final IsolationLevelDataSourceRouter dsToUse = new IsolationLevelDataSourceRouter(); - Map targetDataSources = new HashMap(); + Map targetDataSources = new HashMap(); if (dataSourceLookup) { targetDataSources.put("ISOLATION_REPEATABLE_READ", "ds2"); dsToUse.setDefaultTargetDataSource("ds1"); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java index 89ecf0bc66e3..be9c7837f7a2 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,11 +48,11 @@ * @since 04.07.2003 */ public class DataSourceTransactionManagerTests extends TestCase { - + public void testTransactionCommitWithAutoCommitTrue() throws Exception { doTestTransactionCommitRestoringAutoCommit(true, false, false); } - + public void testTransactionCommitWithAutoCommitFalse() throws Exception { doTestTransactionCommitRestoringAutoCommit(false, false, false); } @@ -159,11 +159,11 @@ protected void doInTransactionWithoutResult(TransactionStatus status) throws Run conControl.verify(); dsControl.verify(); } - + public void testTransactionRollbackWithAutoCommitTrue() throws Exception { doTestTransactionRollbackRestoringAutoCommit(true, false, false); } - + public void testTransactionRollbackWithAutoCommitFalse() throws Exception { doTestTransactionRollbackRestoringAutoCommit(false, false, false); } @@ -1509,7 +1509,7 @@ public void testTransactionWithExceptionOnRollback() throws Exception { // Must restore con.setAutoCommit(false); conControl.setVoidCallable(1); - + con.rollback(); conControl.setThrowable(new SQLException("Cannot rollback"), 1); con.setAutoCommit(true); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DriverManagerDataSourceTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DriverManagerDataSourceTests.java index 8696edf257d7..dd0d20930947 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DriverManagerDataSourceTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DriverManagerDataSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapterTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapterTests.java index d020c2113ccf..23cf88ea9db6 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapterTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilderTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilderTests.java index 4aa55573624e..99cd8f313f2c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilderTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,4 +81,4 @@ private void assertDatabaseCreatedAndShutdown(EmbeddedDatabase db) { db.shutdown(); } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryTests.java index f3e85fb790ce..3a9f6b94ecb1 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryTests.java @@ -8,9 +8,9 @@ import org.springframework.jdbc.datasource.init.DatabasePopulator; public class EmbeddedDatabaseFactoryTests { - + private EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory(); - + @Test public void testGetDataSource() { StubDatabasePopulator populator = new StubDatabasePopulator(); @@ -19,14 +19,14 @@ public void testGetDataSource() { assertTrue(populator.populateCalled); db.shutdown(); } - + private static class StubDatabasePopulator implements DatabasePopulator { private boolean populateCalled; - + public void populate(Connection connection) { this.populateCalled = true; } - + } } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookupTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookupTests.java index e6e8e10c0773..fcf29ab30b69 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookupTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/BeanFactoryDataSourceLookupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ public class BeanFactoryDataSourceLookupTests { @Test public void testLookupSunnyDay() { BeanFactory beanFactory = createMock(BeanFactory.class); - + StubDataSource expectedDataSource = new StubDataSource(); expect(beanFactory.getBean(DATASOURCE_BEAN_NAME, DataSource.class)).andReturn(expectedDataSource); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookupTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookupTests.java index 4534d493ed68..d64dab49db40 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookupTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,9 +36,9 @@ public void testSunnyDay() throws Exception { final DataSource expectedDataSource = new StubDataSource(); JndiDataSourceLookup lookup = new JndiDataSourceLookup() { @SuppressWarnings("unchecked") - protected Object lookup(String jndiName, Class requiredType) { + protected T lookup(String jndiName, Class requiredType) { assertEquals(DATA_SOURCE_NAME, jndiName); - return expectedDataSource; + return (T) expectedDataSource; } }; DataSource dataSource = lookup.getDataSource(DATA_SOURCE_NAME); @@ -49,8 +49,7 @@ protected Object lookup(String jndiName, Class requiredType) { @Test(expected=DataSourceLookupFailureException.class) public void testNoDataSourceAtJndiLocation() throws Exception { JndiDataSourceLookup lookup = new JndiDataSourceLookup() { - @SuppressWarnings("unchecked") - protected Object lookup(String jndiName, Class requiredType) throws NamingException { + protected T lookup(String jndiName, Class requiredType) throws NamingException { assertEquals(DATA_SOURCE_NAME, jndiName); throw new NamingException(); } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookupTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookupTests.java index 2c91098e01dc..86e16e103085 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookupTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/MapDataSourceLookupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public final class MapDataSourceLookupTests { private static final String DATA_SOURCE_NAME = "dataSource"; - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test(expected=UnsupportedOperationException.class) public void testGetDataSourcesReturnsUnmodifiableMap() throws Exception { MapDataSourceLookup lookup = new MapDataSourceLookup(new HashMap()); @@ -81,7 +81,7 @@ public void testAddingDataSourcePermitsOverride() throws Exception { assertSame(expectedDataSource, dataSource); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test(expected=ClassCastException.class) public void testGetDataSourceWhereSuppliedMapHasNonDataSourceTypeUnderSpecifiedKey() throws Exception { Map dataSources = new HashMap(); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/StubDataSource.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/StubDataSource.java index 22904830666a..a8521e70ba78 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/StubDataSource.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/lookup/StubDataSource.java @@ -23,9 +23,9 @@ /** * Stub, do-nothing DataSource implementation. - * + * *

      All methods throw {@link UnsupportedOperationException}. - * + * * @author Rick Evans */ class StubDataSource extends AbstractDataSource { diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/BatchSqlUpdateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/BatchSqlUpdateTests.java index b635c3a0cbe9..e90716424e25 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/BatchSqlUpdateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/BatchSqlUpdateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/CustomerMapper.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/CustomerMapper.java index 50455e803a8f..a497dca34e57 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/CustomerMapper.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/CustomerMapper.java @@ -9,7 +9,7 @@ public class CustomerMapper implements RowMapper { private static final String[] COLUMN_NAMES = new String[] {"id", "forename"}; - + public Customer mapRow(ResultSet rs, int rownum) throws SQLException { Customer cust = new Customer(); cust.setId(rs.getInt(COLUMN_NAMES[0])); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java index 785a0458f7ac..ace1086d15de 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,8 +40,8 @@ import org.springframework.jdbc.Customer; import org.springframework.jdbc.datasource.TestDataSourceWrapper; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; /** @@ -58,15 +58,16 @@ public class GenericSqlQueryTests extends AbstractJdbcTests { private PreparedStatement mockPreparedStatement; private ResultSet mockResultSet; - private BeanFactory bf; + private DefaultListableBeanFactory bf; + - @Before public void setUp() throws Exception { super.setUp(); mockPreparedStatement = createMock(PreparedStatement.class); mockResultSet = createMock(ResultSet.class); - this.bf = new XmlBeanFactory( + this.bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.bf).loadBeanDefinitions( new ClassPathResource("org/springframework/jdbc/object/GenericSqlQueryTests-context.xml")); TestDataSourceWrapper testDataSource = (TestDataSourceWrapper) bf.getBean("dataSource"); testDataSource.setTarget(mockDataSource); @@ -88,18 +89,20 @@ protected void replay() { } @Test + @SuppressWarnings("unchecked") public void testPlaceHoldersCustomerQuery() throws SQLException { - SqlQuery query = (SqlQuery) bf.getBean("queryWithPlaceHolders"); + SqlQuery query = (SqlQuery) bf.getBean("queryWithPlaceHolders"); testCustomerQuery(query, false); } @Test + @SuppressWarnings("unchecked") public void testNamedParameterCustomerQuery() throws SQLException { - SqlQuery query = (SqlQuery) bf.getBean("queryWithNamedParameters"); + SqlQuery query = (SqlQuery) bf.getBean("queryWithNamedParameters"); testCustomerQuery(query, true); } - private void testCustomerQuery(SqlQuery query, boolean namedParameters) throws SQLException { + private void testCustomerQuery(SqlQuery query, boolean namedParameters) throws SQLException { expect(mockResultSet.next()).andReturn(true); expect(mockResultSet.getInt("id")).andReturn(1); expect(mockResultSet.getString("forename")).andReturn("rod"); @@ -123,7 +126,7 @@ private void testCustomerQuery(SqlQuery query, boolean namedParameters) throws S replay(); - List l; + List l; if (namedParameters) { Map params = new HashMap(2); params.put("id", new Integer(1)); @@ -135,9 +138,9 @@ private void testCustomerQuery(SqlQuery query, boolean namedParameters) throws S l = query.execute(params); } assertTrue("Customer was returned correctly", l.size() == 1); - Customer cust = (Customer) l.get(0); + Customer cust = l.get(0); assertTrue("Customer id was assigned correctly", cust.getId() == 1); assertTrue("Customer forename was assigned correctly", cust.getForename().equals("rod")); } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java index fd96db3e39aa..f6f8ff52b979 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,8 +36,8 @@ import org.springframework.jdbc.AbstractJdbcTests; import org.springframework.jdbc.datasource.TestDataSourceWrapper; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; /** @@ -50,13 +50,14 @@ public class GenericStoredProcedureTests extends AbstractJdbcTests { private CallableStatement mockCallable; - private BeanFactory bf; + private DefaultListableBeanFactory bf; @Before public void setUp() throws Exception { super.setUp(); mockCallable = createMock(CallableStatement.class); - bf = new XmlBeanFactory( + bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.bf).loadBeanDefinitions( new ClassPathResource("org/springframework/jdbc/object/GenericStoredProcedureTests-context.xml")); TestDataSourceWrapper testDataSource = (TestDataSourceWrapper) bf.getBean("dataSource"); testDataSource.setTarget(mockDataSource); @@ -108,9 +109,9 @@ private void testAddInvoice(final int amount, final int custid) Map in = new HashMap(2); in.put("amount", amount); in.put("custid", custid); - Map out = adder.execute(in); + Map out = adder.execute(in); Integer id = (Integer) out.get("newid"); assertEquals(4, id.intValue()); } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/RdbmsOperationTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/RdbmsOperationTests.java index e94bcc372932..0f9fe39a1ad2 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/RdbmsOperationTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/RdbmsOperationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public void testTooFewParameters() { operation.setTypes(new int[] { Types.INTEGER }); try { operation.validateParameters((Object[]) null); - fail("Shouldn't validate without enough parameters"); + fail("Shouldn't validate without enough parameters"); } catch (InvalidDataAccessApiUsageException idaauex) { // OK @@ -96,7 +96,7 @@ public void testTooFewMapParameters() { operation.setSql("select * from mytable"); operation.setTypes(new int[] { Types.INTEGER }); try { - operation.validateNamedParameters((Map) null); + operation.validateNamedParameters((Map) null); fail("Shouldn't validate without enough parameters"); } catch (InvalidDataAccessApiUsageException idaauex) { @@ -123,7 +123,7 @@ public void testTooManyParameters() { operation.setSql("select * from mytable"); try { operation.validateParameters(new Object[] {new Integer(1), new Integer(2)}); - fail("Shouldn't validate with too many parameters"); + fail("Shouldn't validate with too many parameters"); } catch (InvalidDataAccessApiUsageException idaauex) { // OK @@ -134,7 +134,7 @@ public void testUnspecifiedMapParameters() { TestRdbmsOperation operation = new TestRdbmsOperation(); operation.setSql("select * from mytable"); try { - Map params = new HashMap(); + Map params = new HashMap(); params.put("col1", "value"); operation.validateNamedParameters(params); fail("Shouldn't validate with unspecified parameters"); @@ -193,7 +193,7 @@ public void testParametersSetWithList() { DataSource ds = new DriverManagerDataSource(); operation.setDataSource(ds); operation.setSql("select * from mytable where one = ? and two = ?"); - List l = new ArrayList(); + List l = new ArrayList(); l.add(new SqlParameter("one", Types.NUMERIC)); l.add(new SqlParameter("two", Types.VARCHAR)); operation.setParameters(new SqlParameter[] { diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java index 877164d0d8de..d4805b0ed5da 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,8 +129,8 @@ public void testQueryWithoutParams() throws SQLException { replay(); - SqlQuery query = new MappingSqlQueryWithParameters() { - protected Object mapRow(ResultSet rs, int rownum, Object[] params, Map context) throws SQLException { + SqlQuery query = new MappingSqlQueryWithParameters() { + protected Integer mapRow(ResultSet rs, int rownum, Object[] params, Map context) throws SQLException { assertTrue("params were null", params == null); assertTrue("context was null", context == null); return new Integer(rs.getInt(1)); @@ -140,10 +140,9 @@ protected Object mapRow(ResultSet rs, int rownum, Object[] params, Map context) query.setDataSource(mockDataSource); query.setSql(SELECT_ID); query.compile(); - List list = query.execute(); + List list = query.execute(); assertTrue("Found customers", list.size() != 0); - for (Iterator itr = list.iterator(); itr.hasNext();) { - Integer id = (Integer) itr.next(); + for (Integer id : list) { assertTrue( "Customer id was assigned correctly", id.intValue() == 1); @@ -153,8 +152,8 @@ protected Object mapRow(ResultSet rs, int rownum, Object[] params, Map context) public void testQueryWithoutEnoughParams() { replay(); - MappingSqlQuery query = new MappingSqlQuery() { - protected Object mapRow(ResultSet rs, int rownum) throws SQLException { + MappingSqlQuery query = new MappingSqlQuery() { + protected Integer mapRow(ResultSet rs, int rownum) throws SQLException { return new Integer(rs.getInt(1)); } @@ -168,7 +167,7 @@ protected Object mapRow(ResultSet rs, int rownum) throws SQLException { query.compile(); try { - List list = query.execute(); + query.execute(); fail("Shouldn't succeed in running query without enough params"); } catch (InvalidDataAccessApiUsageException ex) { @@ -179,8 +178,8 @@ protected Object mapRow(ResultSet rs, int rownum) throws SQLException { public void testQueryWithMissingMapParams() { replay(); - MappingSqlQuery query = new MappingSqlQuery() { - protected Object mapRow(ResultSet rs, int rownum) throws SQLException { + MappingSqlQuery query = new MappingSqlQuery() { + protected Integer mapRow(ResultSet rs, int rownum) throws SQLException { return new Integer(rs.getInt(1)); } }; @@ -193,9 +192,9 @@ protected Object mapRow(ResultSet rs, int rownum) throws SQLException { query.compile(); try { - Map params = new HashMap(); + Map params = new HashMap(); params.put(COLUMN_NAMES[0], "Value"); - List list = query.executeByNamedParam(params); + query.executeByNamedParam(params); fail("Shouldn't succeed in running query with missing params"); } catch (InvalidDataAccessApiUsageException ex) { @@ -423,7 +422,7 @@ public void testFindCustomerString() throws SQLException { replay(); - class CustomerQuery extends MappingSqlQuery { + class CustomerQuery extends MappingSqlQuery { public CustomerQuery(DataSource ds) { super(ds, SELECT_ID_FORENAME_WHERE); @@ -431,7 +430,7 @@ public CustomerQuery(DataSource ds) { compile(); } - protected Object mapRow(ResultSet rs, int rownum) throws SQLException { + protected Customer mapRow(ResultSet rs, int rownum) throws SQLException { Customer cust = new Customer(); cust.setId(rs.getInt(COLUMN_NAMES[0])); cust.setForename(rs.getString(COLUMN_NAMES[1])); @@ -439,7 +438,7 @@ protected Object mapRow(ResultSet rs, int rownum) throws SQLException { } public Customer findCustomer(String id) { - return (Customer) findObject(id); + return findObject(id); } } @@ -969,7 +968,7 @@ public List findCustomers(List ids) { Assert.assertEquals("Second customer id was assigned correctly", ((Customer)cust.get(1)).getId(), 2); Assert.assertEquals("Second customer forename was assigned correctly", ((Customer)cust.get(1)).getForename(), "juergen"); } - + public void testNamedParameterQueryReusingParameter() throws SQLException { mockResultSet.next(); ctrlResultSet.setReturnValue(true); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlUpdateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlUpdateTests.java index 447a8aa9c223..ed1e2643d45d 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlUpdateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlUpdateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -193,7 +193,7 @@ public NamedParameterUpdater() { } public int run(int performanceId, int type) { - Map params = new HashMap(); + Map params = new HashMap(); params.put("perfId", new Integer(performanceId)); params.put("priceId", new Integer(type)); return updateByNamedParam(params); @@ -272,7 +272,7 @@ public void testUpdateAndGeneratedKeys() throws SQLException { ctrlResultSet.setReturnValue(false); mockResultSet.close(); ctrlResultSet.setVoidCallable(); - + mockPreparedStatement.setString(1, "rod"); ctrlPreparedStatement.setVoidCallable(); mockPreparedStatement.executeUpdate(); @@ -383,7 +383,7 @@ public void testOverMaxRows() throws SQLException { MaxRowsUpdater pc = new MaxRowsUpdater(); try { - int rowsAffected = pc.run(); + pc.run(); fail("Shouldn't continue when too many rows affected"); } catch (JdbcUpdateAffectedIncorrectNumberOfRowsException juaicrex) { @@ -428,7 +428,7 @@ public void testNotRequiredRows() throws SQLException { RequiredRowsUpdater pc = new RequiredRowsUpdater(); try { - int rowsAffected = pc.run(); + pc.run(); fail("Shouldn't continue when too many rows affected"); } catch (JdbcUpdateAffectedIncorrectNumberOfRowsException juaicrex) { diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/StoredProcedureTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/StoredProcedureTests.java index ddce92f5a37b..eace78b5ad1c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/StoredProcedureTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/StoredProcedureTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -213,13 +213,13 @@ public void testAddInvoicesWithinTransaction() throws Exception { } } - + /** * Confirm no connection was used to get metadata. * Does not use superclass replay mechanism. * @throws Exception */ - public void testStoredProcedureConfiguredViaJdbcTemplateWithCustomExceptionTranslator() throws Exception { + public void testStoredProcedureConfiguredViaJdbcTemplateWithCustomExceptionTranslator() throws Exception { mockCallable.setObject(1, new Integer(11), Types.INTEGER); ctrlCallable.setVoidCallable(1); mockCallable.registerOutParameter(2, Types.INTEGER); @@ -246,7 +246,7 @@ public void testStoredProcedureConfiguredViaJdbcTemplateWithCustomExceptionTrans mockConnection.close(); ctrlConnection.setVoidCallable(1); ctrlConnection.replay(); - + MockControl dsControl = MockControl.createControl(DataSource.class); DataSource localDs = (DataSource) dsControl.getMock(); localDs.getConnection(); @@ -255,7 +255,7 @@ public void testStoredProcedureConfiguredViaJdbcTemplateWithCustomExceptionTrans class TestJdbcTemplate extends JdbcTemplate { int calls; - public Map call(CallableStatementCreator csc, List declaredParameters) throws DataAccessException { + public Map call(CallableStatementCreator csc, List declaredParameters) throws DataAccessException { calls++; return super.call(csc, declaredParameters); } @@ -267,15 +267,15 @@ public Map call(CallableStatementCreator csc, List declaredParameters) throws Da // DataSource here if we need to to create an ExceptionTranslator t.setExceptionTranslator(new SQLStateSQLExceptionTranslator()); StoredProcedureConfiguredViaJdbcTemplate sp = new StoredProcedureConfiguredViaJdbcTemplate(t); - + assertEquals(sp.execute(11), 5); assertEquals(1, t.calls); - + dsControl.verify(); ctrlCallable.verify(); ctrlConnection.verify(); } - + /** * Confirm our JdbcTemplate is used * @throws Exception @@ -301,11 +301,11 @@ public void testStoredProcedureConfiguredViaJdbcTemplate() throws Exception { mockConnection.prepareCall("{call " + StoredProcedureConfiguredViaJdbcTemplate.SQL + "(?, ?)}"); ctrlConnection.setReturnValue(mockCallable); - replay(); + replay(); JdbcTemplate t = new JdbcTemplate(); t.setDataSource(mockDataSource); StoredProcedureConfiguredViaJdbcTemplate sp = new StoredProcedureConfiguredViaJdbcTemplate(t); - + assertEquals(sp.execute(1106), 4); } @@ -341,8 +341,7 @@ public void testNullArg() throws Exception { public void testUnnamedParameter() throws Exception { replay(); try { - UnnamedParameterStoredProcedure unp = - new UnnamedParameterStoredProcedure(mockDataSource); + new UnnamedParameterStoredProcedure(mockDataSource); fail("Shouldn't succeed in creating stored procedure with unnamed parameter"); } catch (InvalidDataAccessApiUsageException idaauex) { // OK @@ -429,7 +428,8 @@ public void testStoredProcedureWithResultSet() throws Exception { ctrlResultSet.verify(); assertEquals(2, sproc.getCount()); } - + + @SuppressWarnings("unchecked") public void testStoredProcedureWithResultSetMapped() throws Exception { MockControl ctrlResultSet = MockControl.createControl(ResultSet.class); ResultSet mockResultSet = (ResultSet) ctrlResultSet.getMock(); @@ -470,17 +470,18 @@ public void testStoredProcedureWithResultSetMapped() throws Exception { ctrlResultSet.replay(); StoredProcedureWithResultSetMapped sproc = new StoredProcedureWithResultSetMapped(mockDataSource); - Map res = sproc.execute(); + Map res = sproc.execute(); ctrlResultSet.verify(); - - List rs = (List) res.get("rs"); + + List rs = (List) res.get("rs"); assertEquals(2, rs.size()); assertEquals("Foo", rs.get(0)); - assertEquals("Bar", rs.get(1)); + assertEquals("Bar", rs.get(1)); } + @SuppressWarnings("unchecked") public void testStoredProcedureWithUndeclaredResults() throws Exception { MockControl ctrlResultSet1 = MockControl.createControl(ResultSet.class); ResultSet mockResultSet1 = (ResultSet) ctrlResultSet1.getMock(); @@ -557,23 +558,23 @@ public void testStoredProcedureWithUndeclaredResults() throws Exception { ctrlResultSet2.replay(); StoredProcedureWithResultSetMapped sproc = new StoredProcedureWithResultSetMapped(mockDataSource); - Map res = sproc.execute(); + Map res = sproc.execute(); ctrlResultSet1.verify(); ctrlResultSet2.verify(); assertEquals("incorrect number of returns", 3, res.size()); - List rs1 = (List) res.get("rs"); + List rs1 = (List) res.get("rs"); assertEquals(2, rs1.size()); assertEquals("Foo", rs1.get(0)); assertEquals("Bar", rs1.get(1)); - List rs2 = (List) res.get("#result-set-2"); + List rs2 = (List) res.get("#result-set-2"); assertEquals(1, rs2.size()); Object o2 = rs2.get(0); assertTrue("wron type returned for result set 2", o2 instanceof Map); - Map m2 = (Map) o2; + Map m2 = (Map) o2; assertEquals("Spam", m2.get("spam")); assertEquals("Eggs", m2.get("eggs")); @@ -601,11 +602,12 @@ public void testStoredProcedureSkippingResultsProcessing() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(mockDataSource); jdbcTemplate.setSkipResultsProcessing(true); StoredProcedureWithResultSetMapped sproc = new StoredProcedureWithResultSetMapped(jdbcTemplate); - Map res = sproc.execute(); + Map res = sproc.execute(); assertEquals("incorrect number of returns", 0, res.size()); } + @SuppressWarnings("unchecked") public void testStoredProcedureSkippingUndeclaredResults() throws Exception { MockControl ctrlResultSet1 = MockControl.createControl(ResultSet.class); ResultSet mockResultSet1 = (ResultSet) ctrlResultSet1.getMock(); @@ -652,13 +654,13 @@ public void testStoredProcedureSkippingUndeclaredResults() throws Exception { JdbcTemplate jdbcTemplate = new JdbcTemplate(mockDataSource); jdbcTemplate.setSkipUndeclaredResults(true); StoredProcedureWithResultSetMapped sproc = new StoredProcedureWithResultSetMapped(jdbcTemplate); - Map res = sproc.execute(); + Map res = sproc.execute(); ctrlResultSet1.verify(); assertEquals("incorrect number of returns", 1, res.size()); - List rs1 = (List) res.get("rs"); + List rs1 = (List) res.get("rs"); assertEquals(2, rs1.size()); assertEquals("Foo", rs1.get(0)); assertEquals("Bar", rs1.get(1)); @@ -688,7 +690,7 @@ public void testParameterMapper() throws Exception { replay(); ParameterMapperStoredProcedure pmsp = new ParameterMapperStoredProcedure(mockDataSource); - Map out = pmsp.executeTest(); + Map out = pmsp.executeTest(); assertEquals("OK", out.get("out")); } @@ -719,7 +721,7 @@ public void testSqlTypeValue() throws Exception { replay(); SqlTypeValueStoredProcedure stvsp = new SqlTypeValueStoredProcedure(mockDataSource); - Map out = stvsp.executeTest(testVal); + Map out = stvsp.executeTest(testVal); assertEquals("OK", out.get("out")); } @@ -747,12 +749,12 @@ public void testNumericWithScale() throws Exception { replay(); NumericWithScaleStoredProcedure nwssp = new NumericWithScaleStoredProcedure(mockDataSource); - Map out = nwssp.executeTest(); + Map out = nwssp.executeTest(); assertEquals(new BigDecimal("12345.6789"), out.get("out")); } - private static class StoredProcedureConfiguredViaJdbcTemplate extends StoredProcedure { + public static class StoredProcedureConfiguredViaJdbcTemplate extends StoredProcedure { public static final String SQL = "configured_via_jt"; @@ -765,16 +767,16 @@ public StoredProcedureConfiguredViaJdbcTemplate(JdbcTemplate t) { } public int execute(int intIn) { - Map in = new HashMap(); + HashMap in = new HashMap(); in.put("intIn", new Integer(intIn)); - Map out = execute(in); + Map out = execute(in); Number intOut = (Number) out.get("intOut"); return intOut.intValue(); } } - private static class AddInvoice extends StoredProcedure { + public static class AddInvoice extends StoredProcedure { public static final String SQL = "add_invoice"; @@ -788,16 +790,16 @@ public AddInvoice(DataSource ds) { } public int execute(int amount, int custid) { - Map in = new HashMap(); + Map in = new HashMap(); in.put("amount", new Integer(amount)); in.put("custid", new Integer(custid)); - Map out = execute(in); + Map out = execute(in); Number id = (Number) out.get("newid"); return id.intValue(); } } - private static class AddInvoiceUsingObjectArray extends StoredProcedure { + public static class AddInvoiceUsingObjectArray extends StoredProcedure { public static final String SQL = "add_invoice"; @@ -811,7 +813,7 @@ public AddInvoiceUsingObjectArray(DataSource ds) { } public int execute(int amount, int custid) { - Map out = execute(new Object[] {amount, custid}); + Map out = execute(new Object[] {amount, custid}); System.out.println("####### " + out); Number id = (Number) out.get("newid"); return id.intValue(); @@ -819,7 +821,7 @@ public int execute(int amount, int custid) { } - private static class NullArg extends StoredProcedure { + public static class NullArg extends StoredProcedure { public static final String SQL = "takes_null"; @@ -831,14 +833,14 @@ public NullArg(DataSource ds) { } public void execute(String s) { - Map in = new HashMap(); + Map in = new HashMap(); in.put("ptest", s); - Map out = execute(in); + execute(in); } } - private static class NoSuchStoredProcedure extends StoredProcedure { + public static class NoSuchStoredProcedure extends StoredProcedure { public static final String SQL = "no_sproc_with_this_name"; @@ -849,12 +851,12 @@ public NoSuchStoredProcedure(DataSource ds) { } public void execute() { - execute(new HashMap()); + execute(new HashMap()); } } - private static class UnnamedParameterStoredProcedure extends StoredProcedure { + public static class UnnamedParameterStoredProcedure extends StoredProcedure { public UnnamedParameterStoredProcedure(DataSource ds) { super(ds, "unnamed_parameter_sp"); @@ -863,14 +865,14 @@ public UnnamedParameterStoredProcedure(DataSource ds) { } public void execute(int id) { - Map in = new HashMap(); + Map in = new HashMap(); in.put("id", new Integer(id)); - Map out = execute(in); + execute(in); } } - private static class MissingParameterStoredProcedure extends StoredProcedure { + public static class MissingParameterStoredProcedure extends StoredProcedure { public MissingParameterStoredProcedure(DataSource ds) { setDataSource(ds); @@ -880,12 +882,12 @@ public MissingParameterStoredProcedure(DataSource ds) { } public void execute() { - execute(new HashMap()); + execute(new HashMap()); } } - private static class StoredProcedureWithResultSet extends StoredProcedure { + public static class StoredProcedureWithResultSet extends StoredProcedure { public static final String SQL = "sproc_with_result_set"; @@ -899,7 +901,7 @@ public StoredProcedureWithResultSet(DataSource ds) { } public void execute() { - execute(new HashMap()); + execute(new HashMap()); } public int getCount() { @@ -908,7 +910,7 @@ public int getCount() { } - private static class StoredProcedureWithResultSetMapped extends StoredProcedure { + public static class StoredProcedureWithResultSetMapped extends StoredProcedure { public static final String SQL = "sproc_with_result_set"; @@ -928,20 +930,20 @@ public StoredProcedureWithResultSetMapped(JdbcTemplate jt) { compile(); } - public Map execute() { - Map out = execute(new HashMap()); + public Map execute() { + Map out = execute(new HashMap()); return out; } - private static class RowMapperImpl implements RowMapper { - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + private static class RowMapperImpl implements RowMapper { + public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString(2); } } } - private static class ParameterMapperStoredProcedure extends StoredProcedure { + public static class ParameterMapperStoredProcedure extends StoredProcedure { public static final String SQL = "parameter_mapper_sp"; @@ -953,19 +955,19 @@ public ParameterMapperStoredProcedure(DataSource ds) { compile(); } - public Map executeTest() { - Map out = null; + public Map executeTest() { + Map out = null; out = execute(new TestParameterMapper()); return out; } - + private static class TestParameterMapper implements ParameterMapper { - + private TestParameterMapper() { } - - public Map createMap(Connection conn) throws SQLException { - Map inParms = new HashMap(); + + public Map createMap(Connection conn) throws SQLException { + Map inParms = new HashMap(); String testValue = conn.toString(); inParms.put("in", testValue); return inParms; @@ -974,7 +976,7 @@ public Map createMap(Connection conn) throws SQLException { } - private static class SqlTypeValueStoredProcedure extends StoredProcedure { + public static class SqlTypeValueStoredProcedure extends StoredProcedure { public static final String SQL = "sql_type_value_sp"; @@ -986,8 +988,8 @@ public SqlTypeValueStoredProcedure(DataSource ds) { compile(); } - public Map executeTest(final int[] inValue) { - Map in = new HashMap(1); + public Map executeTest(final int[] inValue) { + Map in = new HashMap(1); in.put("in", new AbstractSqlTypeValue() { public Object createTypeValue(Connection con, int type, String typeName) { //assertEquals(Connection.class, con.getClass()); @@ -996,13 +998,13 @@ public Object createTypeValue(Connection con, int type, String typeName) { return inValue; } }); - Map out = null; + Map out = null; out = execute(in); return out; } } - private static class NumericWithScaleStoredProcedure extends StoredProcedure { + public static class NumericWithScaleStoredProcedure extends StoredProcedure { public static final String SQL = "numeric_with_scale_sp"; @@ -1013,16 +1015,16 @@ public NumericWithScaleStoredProcedure(DataSource ds) { compile(); } - public Map executeTest() { - Map in = new HashMap(1); - Map out = null; + public Map executeTest() { + Map in = new HashMap(1); + Map out = null; out = execute(in); return out; } } - private static class StoredProcedureExceptionTranslator extends StoredProcedure { + public static class StoredProcedureExceptionTranslator extends StoredProcedure { public static final String SQL = "no_sproc_with_this_name"; @@ -1042,12 +1044,12 @@ public DataAccessException translate( } public void execute() { - execute(new HashMap()); + execute(new HashMap()); } } - private static class CustomDataException extends DataAccessException { + public static class CustomDataException extends DataAccessException { public CustomDataException(String s) { super(s); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java index 7a26db34718d..a637cf1ba9af 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistrarTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistrarTests.java index 21ed920479e6..1b3bbd75eaa8 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistrarTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistrarTests.java @@ -17,9 +17,6 @@ package org.springframework.jdbc.support; import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; - import org.junit.Before; import org.junit.Test; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSqlExceptionTranslator.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSqlExceptionTranslator.java index 467f03f2e81d..087f56b7db0e 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSqlExceptionTranslator.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/CustomSqlExceptionTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java index 7c63fd5c5c09..15c7561eaddf 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java index 933d8089a57b..60cd34ded8bf 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java index 058ce7c3048c..448d79713749 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,19 +29,19 @@ * Tests for the KeyHolder and GeneratedKeyHolder * and it appears that JdbcUtils doesn't work exactly as documented. * - * @author trisberg + * @author Thomas Risberg * @since Jul 18, 2004 */ public class KeyHolderTests extends TestCase { private KeyHolder kh; - + public void setUp() { kh = new GeneratedKeyHolder(); } public void testSingleKey(){ - LinkedList l = new LinkedList(); - HashMap m = new HashMap(1); + LinkedList> l = new LinkedList>(); + HashMap m = new HashMap(1); m.put("key", new Integer(1)); l.add(m); kh.getKeyList().addAll(l); @@ -49,8 +49,8 @@ public void testSingleKey(){ } public void testSingleKeyNonNumeric(){ - LinkedList l = new LinkedList(); - HashMap m = new HashMap(1); + LinkedList> l = new LinkedList>(); + HashMap m = new HashMap(1); m.put("key", "1"); l.add(m); kh.getKeyList().addAll(l); @@ -63,8 +63,8 @@ public void testSingleKeyNonNumeric(){ } public void testNoKeyReturnedInMap(){ - LinkedList l = new LinkedList(); - HashMap m = new HashMap(); + LinkedList> l = new LinkedList>(); + HashMap m = new HashMap(1); l.add(m); kh.getKeyList().addAll(l); try { @@ -76,13 +76,13 @@ public void testNoKeyReturnedInMap(){ } public void testMultipleKeys(){ - LinkedList l = new LinkedList(); - HashMap m = new HashMap(1); + LinkedList> l = new LinkedList>(); + HashMap m = new HashMap(1); m.put("key", new Integer(1)); m.put("seq", new Integer(2)); l.add(m); kh.getKeyList().addAll(l); - Map keyMap = kh.getKeys(); + Map keyMap = kh.getKeys(); assertEquals("two keys should be in the map", 2, keyMap.size()); try { kh.getKey(); @@ -93,8 +93,8 @@ public void testMultipleKeys(){ } public void testMultipleKeyRows(){ - LinkedList l = new LinkedList(); - HashMap m = new HashMap(1); + LinkedList> l = new LinkedList>(); + HashMap m = new HashMap(1); m.put("key", new Integer(1)); m.put("seq", new Integer(2)); l.add(m); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java index a5c23af49cca..05a35bc5ae7c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java index b33aa870acc8..c7a6354c7f4a 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,7 +35,7 @@ * @author Rod Johnson */ public class SQLErrorCodeSQLExceptionTranslatorTests extends TestCase { - + private static SQLErrorCodes ERROR_CODES = new SQLErrorCodes(); static { ERROR_CODES.setBadSqlGrammarCodes(new String[] { "1", "2" }); @@ -81,7 +81,7 @@ public void testErrorCodeTranslation() { assertEquals(sex, bsgex2.getSQLException()); } - private void checkTranslation(SQLExceptionTranslator sext, int errorCode, Class exClass) { + private void checkTranslation(SQLExceptionTranslator sext, int errorCode, Class exClass) { SQLException sex = new SQLException("", "", errorCode); DataAccessException ex = sext.translate("", "", sex); assertTrue(exClass.isInstance(ex)); @@ -116,19 +116,19 @@ protected DataAccessException customTranslate(String task, String sql, SQLExcept } }; sext.setSqlErrorCodes(ERROR_CODES); - + // Shouldn't custom translate this assertEquals(customDex, sext.translate(TASK, SQL, badSqlEx)); DataIntegrityViolationException diex = (DataIntegrityViolationException) sext.translate(TASK, SQL, intVioEx); assertEquals(intVioEx, diex.getCause()); } - + public void testCustomExceptionTranslation() { final String TASK = "TASK"; final String SQL = "SQL SELECT *"; final SQLErrorCodes customErrorCodes = new SQLErrorCodes(); final CustomSQLErrorCodesTranslation customTranslation = new CustomSQLErrorCodesTranslation(); - + customErrorCodes.setBadSqlGrammarCodes(new String[] {"1", "2"}); customErrorCodes.setDataIntegrityViolationCodes(new String[] {"3", "4"}); customTranslation.setErrorCodes(new String[] {"1"}); @@ -137,7 +137,7 @@ public void testCustomExceptionTranslation() { SQLErrorCodeSQLExceptionTranslator sext = new SQLErrorCodeSQLExceptionTranslator(); sext.setSqlErrorCodes(customErrorCodes); - + // Should custom translate this SQLException badSqlEx = new SQLException("", "", 1); assertEquals(CustomErrorCodeException.class, sext.translate(TASK, SQL, badSqlEx).getClass()); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java index 6062ab5eb8a8..8481d142b259 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java @@ -67,40 +67,6 @@ private void assertIsOracle(SQLErrorCodes sec) { assertFalse(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "9xx42") >= 0); } - private void assertIsSQLServer(SQLErrorCodes sec) { - assertThat(sec.getDatabaseProductName(), equalTo("Microsoft SQL Server")); - - assertTrue(sec.getBadSqlGrammarCodes().length > 0); - - assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "156") >= 0); - assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "170") >= 0); - assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "207") >= 0); - assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "208") >= 0); - assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "209") >= 0); - assertFalse(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "9xx42") >= 0); - - assertTrue(sec.getPermissionDeniedCodes().length > 0); - assertTrue(Arrays.binarySearch(sec.getPermissionDeniedCodes(), "229") >= 0); - - assertTrue(sec.getDuplicateKeyCodes().length > 0); - assertTrue(Arrays.binarySearch(sec.getDuplicateKeyCodes(), "2601") >= 0); - assertTrue(Arrays.binarySearch(sec.getDuplicateKeyCodes(), "2627") >= 0); - - assertTrue(sec.getDataIntegrityViolationCodes().length > 0); - assertTrue(Arrays.binarySearch(sec.getDataIntegrityViolationCodes(), "544") >= 0); - assertTrue(Arrays.binarySearch(sec.getDataIntegrityViolationCodes(), "8114") >= 0); - assertTrue(Arrays.binarySearch(sec.getDataIntegrityViolationCodes(), "8115") >= 0); - - assertTrue(sec.getDataAccessResourceFailureCodes().length > 0); - assertTrue(Arrays.binarySearch(sec.getDataAccessResourceFailureCodes(), "4060") >= 0); - - assertTrue(sec.getCannotAcquireLockCodes().length > 0); - assertTrue(Arrays.binarySearch(sec.getCannotAcquireLockCodes(), "1222") >= 0); - - assertTrue(sec.getDeadlockLoserCodes().length > 0); - assertTrue(Arrays.binarySearch(sec.getDeadlockLoserCodes(), "1205") >= 0); - } - private void assertIsHsql(SQLErrorCodes sec) { assertTrue(sec.getBadSqlGrammarCodes().length > 0); assertTrue(sec.getDataIntegrityViolationCodes().length > 0); @@ -198,7 +164,7 @@ protected Resource loadResource(String path) { TestSQLErrorCodesFactory sf = new TestSQLErrorCodesFactory(); assertEquals(1, sf.getErrorCodes("Oracle").getCustomTranslations().length); CustomSQLErrorCodesTranslation translation = - (CustomSQLErrorCodesTranslation) sf.getErrorCodes("Oracle").getCustomTranslations()[0]; + sf.getErrorCodes("Oracle").getCustomTranslations()[0]; assertEquals(CustomErrorCodeException.class, translation.getExceptionClass()); assertEquals(1, translation.getErrorCodes().length); } @@ -289,11 +255,6 @@ private SQLErrorCodes getErrorCodesFromDataSource(String productName, SQLErrorCo return sec; } - public void testSQLServerRecognizedFromMetadata() throws Exception { - SQLErrorCodes sec = getErrorCodesFromDataSource("MS-SQL", null); - assertIsSQLServer(sec); - } - public void testOracleRecognizedFromMetadata() throws Exception { SQLErrorCodes sec = getErrorCodesFromDataSource("Oracle", null); assertIsOracle(sec); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionCustomTranslatorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionCustomTranslatorTests.java index 9bd769ef62f8..3e04d205f0e6 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionCustomTranslatorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionCustomTranslatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,4 +61,4 @@ public void testCustomErrorCodeTranslation() { } -} \ No newline at end of file +} diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java index 35a66acbf34a..15e85c7b284c 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,12 +24,12 @@ import org.springframework.jdbc.UncategorizedSQLException; /** - * + * * @author Rod Johnson * @since 13-Jan-03 */ public class SQLStateExceptionTranslatorTests extends TestCase { - + private SQLStateSQLExceptionTranslator trans = new SQLStateSQLExceptionTranslator(); // ALSO CHECK CHAIN of SQLExceptions!? @@ -39,7 +39,7 @@ public void testBadSqlGrammar() { String sql = "SELECT FOO FROM BAR"; SQLException sex = new SQLException("Message", "42001", 1); try { - throw this.trans.translate("task", sql, sex); + throw this.trans.translate("task", sql, sex); } catch (BadSqlGrammarException ex) { // OK @@ -47,7 +47,7 @@ public void testBadSqlGrammar() { assertTrue("Exception matches", sex.equals(ex.getSQLException())); } } - + public void testInvalidSqlStateCode() { String sql = "SELECT FOO FROM BAR"; SQLException sex = new SQLException("Message", "NO SUCH CODE", 1); @@ -60,26 +60,25 @@ public void testInvalidSqlStateCode() { assertTrue("Exception matches", sex.equals(ex.getSQLException())); } } - + /** * PostgreSQL can return null * SAP DB can apparently return empty SQL code - * Bug 729170 + * Bug 729170 */ public void testMalformedSqlStateCodes() { - String sql = "SELECT FOO FROM BAR"; SQLException sex = new SQLException("Message", null, 1); testMalformedSqlStateCode(sex); - + sex = new SQLException("Message", "", 1); testMalformedSqlStateCode(sex); - + // One char's not allowed sex = new SQLException("Message", "I", 1); testMalformedSqlStateCode(sex); } - - + + private void testMalformedSqlStateCode(SQLException sex) { String sql = "SELECT FOO FROM BAR"; try { diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslatorTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslatorTests.java index 9f124d154484..08dfcc41c62f 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslatorTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java index 4c72a08876c4..d2573a37a56b 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/config/AbstractListenerContainerParser.java b/spring-jms/src/main/java/org/springframework/jms/config/AbstractListenerContainerParser.java index 7b470f949dd3..ebd025950835 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/AbstractListenerContainerParser.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/AbstractListenerContainerParser.java @@ -103,7 +103,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) { } } } - + parserContext.popAndRegisterContainingComponent(); return null; } @@ -111,7 +111,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) { private void parseListener(Element listenerEle, Element containerEle, ParserContext parserContext) { RootBeanDefinition listenerDef = new RootBeanDefinition(); listenerDef.setSource(parserContext.extractSource(listenerEle)); - + String ref = listenerEle.getAttribute(REF_ATTRIBUTE); if (!StringUtils.hasText(ref)) { parserContext.getReaderContext().error( @@ -164,11 +164,11 @@ private void parseListener(Element listenerEle, Element containerEle, ParserCont containerDef.getPropertyValues().add("messageListener", listenerDef); String containerBeanName = listenerEle.getAttribute(ID_ATTRIBUTE); - // If no bean id is given auto generate one using the ReaderContext's BeanNameGenerator + // If no bean id is given auto generate one using the ReaderContext's BeanNameGenerator if (!StringUtils.hasText(containerBeanName)) { containerBeanName = parserContext.getReaderContext().generateBeanName(containerDef); } - + // Register the listener and fire event parserContext.registerBeanComponent(new BeanComponentDefinition(containerDef, containerBeanName)); } diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java b/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java index 1faf7d715e46..20df434ebf6f 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JcaListenerContainerParser.java @@ -41,7 +41,7 @@ protected BeanDefinition parseContainer(Element listenerEle, Element containerEl RootBeanDefinition containerDef = new RootBeanDefinition(); containerDef.setSource(parserContext.extractSource(containerEle)); containerDef.setBeanClassName("org.springframework.jms.listener.endpoint.JmsMessageEndpointManager"); - + if (containerEle.hasAttribute(RESOURCE_ADAPTER_ATTRIBUTE)) { String resourceAdapterBeanName = containerEle.getAttribute(RESOURCE_ADAPTER_ATTRIBUTE); if (!StringUtils.hasText(resourceAdapterBeanName)) { @@ -73,7 +73,7 @@ protected BeanDefinition parseContainer(Element listenerEle, Element containerEl RootBeanDefinition configDef = new RootBeanDefinition(); configDef.setSource(parserContext.extractSource(configDef)); configDef.setBeanClassName("org.springframework.jms.listener.endpoint.JmsActivationSpecConfig"); - + parseListenerConfiguration(listenerEle, parserContext, configDef); parseContainerConfiguration(containerEle, parserContext, configDef); diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java index e66a857155ec..a65db63d9db7 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JmsListenerContainerParser.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2012 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ /** * Parser for the JMS <listener-container> element. - * + * * @author Mark Fisher * @author Juergen Hoeller * @since 2.5 @@ -53,7 +53,7 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser { protected BeanDefinition parseContainer(Element listenerEle, Element containerEle, ParserContext parserContext) { RootBeanDefinition containerDef = new RootBeanDefinition(); containerDef.setSource(parserContext.extractSource(containerEle)); - + parseListenerConfiguration(listenerEle, parserContext, containerDef); parseContainerConfiguration(containerEle, parserContext, containerDef); diff --git a/spring-jms/src/main/java/org/springframework/jms/config/JmsNamespaceHandler.java b/spring-jms/src/main/java/org/springframework/jms/config/JmsNamespaceHandler.java index 281827387730..09949d552126 100644 --- a/spring-jms/src/main/java/org/springframework/jms/config/JmsNamespaceHandler.java +++ b/spring-jms/src/main/java/org/springframework/jms/config/JmsNamespaceHandler.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2007 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java b/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java index 35456ea45815..44c0121e5b2f 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java @@ -242,7 +242,7 @@ protected Session getSession(Connection con, Integer mode) throws JMSException { * @return the wrapped Session */ protected Session getCachedSessionProxy(Session target, LinkedList sessionList) { - List classes = new ArrayList(3); + List> classes = new ArrayList>(3); classes.add(SessionProxy.class); if (target instanceof QueueSession) { classes.add(QueueSession.class); diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/ChainedExceptionListener.java b/spring-jms/src/main/java/org/springframework/jms/connection/ChainedExceptionListener.java index fc8f481e4b57..31f9ad675bb0 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/ChainedExceptionListener.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/ChainedExceptionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java b/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java index a383c3a2fb6e..fbf7844d3d46 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/JmsResourceHolder.java b/spring-jms/src/main/java/org/springframework/jms/connection/JmsResourceHolder.java index 1a96d900e25e..feaf9b400770 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/JmsResourceHolder.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/JmsResourceHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java b/spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java index 239c51f28bd4..a0ff054bf1e0 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -443,7 +443,7 @@ protected void closeConnection(Connection con) { * @return the wrapped Connection */ protected Connection getSharedConnectionProxy(Connection target) { - List classes = new ArrayList(3); + List> classes = new ArrayList>(3); classes.add(Connection.class); if (target instanceof QueueConnection) { classes.add(QueueConnection.class); diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java b/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java index e406bb4ca18c..f8c71bff0f2e 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -190,7 +190,7 @@ public TopicConnection createTopicConnection(String username, String password) t * @return the wrapped Connection */ protected Connection getTransactionAwareConnectionProxy(Connection target) { - List classes = new ArrayList(3); + List> classes = new ArrayList>(3); classes.add(Connection.class); if (target instanceof QueueConnection) { classes.add(QueueConnection.class); @@ -261,7 +261,7 @@ else if (TopicSession.class.equals(method.getReturnType())) { } private Session getCloseSuppressingSessionProxy(Session target) { - List classes = new ArrayList(3); + List> classes = new ArrayList>(3); classes.add(SessionProxy.class); if (target instanceof QueueSession) { classes.add(QueueSession.class); diff --git a/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java b/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java index 6ea64fcb3242..7d0871abb8cc 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java @@ -24,7 +24,7 @@ /** * Specifies a basic set of JMS operations. - * + * *

      Implemented by {@link JmsTemplate}. Not often used but a useful option * to enhance testability, as it can easily be mocked or stubbed. * diff --git a/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate102.java b/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate102.java index 1e6a46e6758f..fa3ebddf4387 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate102.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate102.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,7 +150,7 @@ public void afterPropertiesSet() { * a QueueConnection or a TopicConnection, depending on the domain. */ protected Connection getConnection(JmsResourceHolder holder) { - return holder.getConnection(isPubSubDomain() ? (Class) TopicConnection.class : QueueConnection.class); + return holder.getConnection(isPubSubDomain() ? (Class) TopicConnection.class : QueueConnection.class); } /** @@ -158,7 +158,7 @@ protected Connection getConnection(JmsResourceHolder holder) { * a QueueSession or a TopicSession, depending on the domain. */ protected Session getSession(JmsResourceHolder holder) { - return holder.getSession(isPubSubDomain() ? (Class) TopicSession.class : QueueSession.class); + return holder.getSession(isPubSubDomain() ? (Class) TopicSession.class : QueueSession.class); } /** diff --git a/spring-jms/src/main/java/org/springframework/jms/core/MessageCreator.java b/spring-jms/src/main/java/org/springframework/jms/core/MessageCreator.java index fec95b353bfe..dfaeaceb9ded 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/MessageCreator.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/MessageCreator.java @@ -22,7 +22,7 @@ /** * Creates a JMS message given a {@link Session}. - * + * *

      The Session typically is provided by an instance * of the {@link JmsTemplate} class. * @@ -40,7 +40,7 @@ public interface MessageCreator { /** * Create a {@link Message} to be sent. * @param session the JMS {@link Session} to be used to create the - * Message (never null) + * Message (never null) * @return the Message to be sent * @throws javax.jms.JMSException if thrown by JMS API methods */ diff --git a/spring-jms/src/main/java/org/springframework/jms/core/ProducerCallback.java b/spring-jms/src/main/java/org/springframework/jms/core/ProducerCallback.java index 037b8df4867e..78b82b61e9e8 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/ProducerCallback.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/ProducerCallback.java @@ -46,7 +46,7 @@ public interface ProducerCallback { * when specified in the JmsTemplate call. * @param session the JMS Session object to use * @param producer the JMS MessageProducer object to use - * @return a result object from working with the Session, if any (can be null) + * @return a result object from working with the Session, if any (can be null) * @throws javax.jms.JMSException if thrown by JMS API methods */ T doInJms(Session session, MessageProducer producer) throws JMSException; diff --git a/spring-jms/src/main/java/org/springframework/jms/core/SessionCallback.java b/spring-jms/src/main/java/org/springframework/jms/core/SessionCallback.java index cf6fe1545c29..0702989f7bed 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/SessionCallback.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/SessionCallback.java @@ -22,7 +22,7 @@ /** * Callback for executing any number of operations on a provided * {@link Session}. - * + * *

      To be used with the {@link JmsTemplate#execute(SessionCallback)} * method, often implemented as an anonymous inner class. * @@ -36,7 +36,7 @@ public interface SessionCallback { * Execute any number of operations against the supplied JMS * {@link Session}, possibly returning a result. * @param session the JMS Session - * @return a result object from working with the Session, if any (so can be null) + * @return a result object from working with the Session, if any (so can be null) * @throws javax.jms.JMSException if thrown by JMS API methods */ T doInJms(Session session) throws JMSException; diff --git a/spring-jms/src/main/java/org/springframework/jms/core/support/JmsGatewaySupport.java b/spring-jms/src/main/java/org/springframework/jms/core/support/JmsGatewaySupport.java index c3abca4aceee..95314fd3b2d0 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/support/JmsGatewaySupport.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/support/JmsGatewaySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ /** * Convenient super class for application classes that need JMS access. - * + * *

      Requires a ConnectionFactory or a JmsTemplate instance to be set. * It will create its own JmsTemplate if a ConnectionFactory is passed in. * A custom JmsTemplate instance can be created for a given ConnectionFactory @@ -44,7 +44,7 @@ public abstract class JmsGatewaySupport implements InitializingBean { /** Logger available to subclasses */ protected final Log logger = LogFactory.getLog(getClass()); - + private JmsTemplate jmsTemplate; @@ -58,7 +58,7 @@ public abstract class JmsGatewaySupport implements InitializingBean { public final void setConnectionFactory(ConnectionFactory connectionFactory) { this.jmsTemplate = createJmsTemplate(connectionFactory); } - + /** * Create a JmsTemplate for the given ConnectionFactory. * Only invoked if populating the gateway with a ConnectionFactory reference. @@ -72,14 +72,14 @@ public final void setConnectionFactory(ConnectionFactory connectionFactory) { protected JmsTemplate createJmsTemplate(ConnectionFactory connectionFactory) { return new JmsTemplate(connectionFactory); } - + /** * Return the JMS ConnectionFactory used by the gateway. */ public final ConnectionFactory getConnectionFactory() { return (this.jmsTemplate != null ? this.jmsTemplate.getConnectionFactory() : null); } - + /** * Set the JmsTemplate for the gateway. * @param jmsTemplate @@ -88,14 +88,14 @@ public final ConnectionFactory getConnectionFactory() { public final void setJmsTemplate(JmsTemplate jmsTemplate) { this.jmsTemplate = jmsTemplate; } - + /** * Return the JmsTemplate for the gateway. */ public final JmsTemplate getJmsTemplate() { return this.jmsTemplate; } - + public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException { if (this.jmsTemplate == null) { throw new IllegalArgumentException("'connectionFactory' or 'jmsTemplate' is required"); @@ -107,7 +107,7 @@ public final void afterPropertiesSet() throws IllegalArgumentException, BeanInit throw new BeanInitializationException("Initialization of JMS gateway failed: " + ex.getMessage(), ex); } } - + /** * Subclasses can override this for custom initialization behavior. * Gets called after population of this instance's bean properties. diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java index 566e3f9de991..26baa5373065 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java @@ -24,7 +24,6 @@ import javax.jms.Session; import javax.jms.Topic; -import org.springframework.beans.factory.BeanNameAware; import org.springframework.jms.connection.ConnectionFactoryUtils; import org.springframework.jms.connection.JmsResourceHolder; import org.springframework.jms.connection.SingleConnectionFactory; diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java index 5a6f3cbc3ccf..b34168a18e20 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java @@ -87,7 +87,7 @@ * shrinking back to the standard number of consumers once the load decreases. * Consider adapting the {@link #setIdleTaskExecutionLimit "idleTaskExecutionLimit"} * setting to control the lifespan of each new task, to avoid frequent scaling up - * and down, in particular if the {@code ConnectionFactory} does not pool JMS + * and down, in particular if the {@code ConnectionFactory} does not pool JMS * {@code Sessions} and/or the {@code TaskExecutor} does not pool threads (check * your configuration!). Note that dynamic scaling only really makes sense for a * queue in the first place; for a topic, you will typically stick with the default @@ -421,7 +421,7 @@ public void setIdleConsumerLimit(int idleConsumerLimit) { } /** - * Return the limit for the number of idle consumers. + * Return the limit for the number of idle consumers. */ public final int getIdleConsumerLimit() { synchronized (this.lifecycleMonitor) { diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java index 9f070eb9f4a0..69cc01fd2fe3 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessageListenerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -327,7 +327,7 @@ public void onMessage(Message message, Session session) throws JMSException { if (delegate != this) { if (delegate instanceof SessionAwareMessageListener) { if (session != null) { - ((SessionAwareMessageListener) delegate).onMessage(message, session); + ((SessionAwareMessageListener) delegate).onMessage(message, session); return; } else if (!(delegate instanceof MessageListener)) { diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactory.java b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactory.java index b73aebec3430..c82e2d8da453 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public class DefaultJmsActivationSpecFactory extends StandardJmsActivationSpecFa * "ActiveMQActivationSpec" in the same package, or a class named * "ActivationSpecImpl" in the same package as the ResourceAdapter class. */ - protected Class determineActivationSpecClass(ResourceAdapter adapter) { + protected Class determineActivationSpecClass(ResourceAdapter adapter) { String adapterClassName = adapter.getClass().getName(); if (adapterClassName.endsWith(RESOURCE_ADAPTER_SUFFIX)) { diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java index 2a4bd7cf1fb8..a291d2da255c 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/endpoint/StandardJmsActivationSpecFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ */ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactory { - private Class activationSpecClass; + private Class activationSpecClass; private Map defaultProperties; @@ -61,7 +61,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor * Specify the fully-qualified ActivationSpec class name for the target * provider (e.g. "org.apache.activemq.ra.ActiveMQActivationSpec"). */ - public void setActivationSpecClass(Class activationSpecClass) { + public void setActivationSpecClass(Class activationSpecClass) { this.activationSpecClass = activationSpecClass; } @@ -92,7 +92,7 @@ public void setDestinationResolver(DestinationResolver destinationResolver) { public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) { - Class activationSpecClassToUse = this.activationSpecClass; + Class activationSpecClassToUse = this.activationSpecClass; if (activationSpecClassToUse == null) { activationSpecClassToUse = determineActivationSpecClass(adapter); if (activationSpecClassToUse == null) { @@ -117,7 +117,7 @@ public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivatio * if not determinable * @see #setActivationSpecClass */ - protected Class determineActivationSpecClass(ResourceAdapter adapter) { + protected Class determineActivationSpecClass(ResourceAdapter adapter) { return null; } diff --git a/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerClientInterceptor.java b/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerClientInterceptor.java index 7dd6ed748f00..cd807de975f5 100644 --- a/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerClientInterceptor.java +++ b/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerProxyFactoryBean.java b/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerProxyFactoryBean.java index 678b6f30fb3a..f5fd2c9b892b 100644 --- a/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerProxyFactoryBean.java +++ b/spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor implements FactoryBean, BeanClassLoaderAware { - private Class serviceInterface; + private Class serviceInterface; private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); @@ -57,7 +57,7 @@ public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor * is null, or if the supplied serviceInterface * is not an interface type */ - public void setServiceInterface(Class serviceInterface) { + public void setServiceInterface(Class serviceInterface) { if (serviceInterface == null || !serviceInterface.isInterface()) { throw new IllegalArgumentException("'serviceInterface' must be an interface"); } diff --git a/spring-jms/src/main/java/org/springframework/jms/remoting/package-info.java b/spring-jms/src/main/java/org/springframework/jms/remoting/package-info.java index cfb780cd8bda..4c350973814b 100644 --- a/spring-jms/src/main/java/org/springframework/jms/remoting/package-info.java +++ b/spring-jms/src/main/java/org/springframework/jms/remoting/package-info.java @@ -2,7 +2,7 @@ /** * * Remoting classes for transparent Java-to-Java remoting via a JMS provider. - * + * *

      Allows the target service to be load-balanced across a number of queue * receivers, and provides a level of indirection between the client and the * service: They only need to agree on a queue name and a service interface. diff --git a/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java b/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java index 1c6ffdc5ac44..9a2d64d82e97 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/support/JmsUtils.java b/spring-jms/src/main/java/org/springframework/jms/support/JmsUtils.java index 8f97bdf9be66..8d8a967fae91 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/JmsUtils.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/JmsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJacksonMessageConverter.java b/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJacksonMessageConverter.java index 091e5fc4a339..c371960c5f49 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJacksonMessageConverter.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJacksonMessageConverter.java @@ -357,7 +357,7 @@ protected JavaType getJavaTypeForMessage(Message message) throws JMSException { if (typeId == null) { throw new MessageConversionException("Could not find type id property [" + this.typeIdPropertyName + "]"); } - Class mappedClass = this.idClassMappings.get(typeId); + Class mappedClass = this.idClassMappings.get(typeId); if (mappedClass != null) { return TypeFactory.type(mappedClass); } diff --git a/spring-jms/src/main/java/org/springframework/jms/support/converter/MarshallingMessageConverter.java b/spring-jms/src/main/java/org/springframework/jms/support/converter/MarshallingMessageConverter.java index ec09cf4b653c..b1d21abe7862 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/converter/MarshallingMessageConverter.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/converter/MarshallingMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/main/java/org/springframework/jms/support/converter/SimpleMessageConverter.java b/spring-jms/src/main/java/org/springframework/jms/support/converter/SimpleMessageConverter.java index 6d58939730c0..c00d3b13b181 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/converter/SimpleMessageConverter.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/converter/SimpleMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ else if (object instanceof byte[]) { return createMessageForByteArray((byte[]) object, session); } else if (object instanceof Map) { - return createMessageForMap((Map) object, session); + return createMessageForMap((Map) object, session); } else if (object instanceof Serializable) { return createMessageForSerializable(((Serializable) object), session); @@ -144,7 +144,7 @@ protected BytesMessage createMessageForByteArray(byte[] bytes, Session session) */ protected MapMessage createMessageForMap(Map map, Session session) throws JMSException { MapMessage message = session.createMapMessage(); - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { if (!(entry.getKey() instanceof String)) { throw new MessageConversionException("Cannot convert non-String key of type [" + ObjectUtils.nullSafeClassName(entry.getKey()) + "] to JMS MapMessage entry"); @@ -195,9 +195,9 @@ protected byte[] extractByteArrayFromMessage(BytesMessage message) throws JMSExc * @return the resulting Map * @throws JMSException if thrown by JMS methods */ - protected Map extractMapFromMessage(MapMessage message) throws JMSException { + protected Map extractMapFromMessage(MapMessage message) throws JMSException { Map map = new HashMap(); - Enumeration en = message.getMapNames(); + Enumeration en = message.getMapNames(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); map.put(key, message.getObject(key)); diff --git a/spring-jms/src/main/java/org/springframework/jms/support/destination/BeanFactoryDestinationResolver.java b/spring-jms/src/main/java/org/springframework/jms/support/destination/BeanFactoryDestinationResolver.java index d1f6ddd3f383..aa40664ec7c7 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/destination/BeanFactoryDestinationResolver.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/destination/BeanFactoryDestinationResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ public Destination resolveDestinationName(Session session, String destinationNam Assert.state(this.beanFactory != null, "BeanFactory is required"); try { - return (Destination) this.beanFactory.getBean(destinationName, Destination.class); + return this.beanFactory.getBean(destinationName, Destination.class); } catch (BeansException ex) { throw new DestinationResolutionException( diff --git a/spring-jms/src/main/java/org/springframework/jms/support/destination/DestinationResolver.java b/spring-jms/src/main/java/org/springframework/jms/support/destination/DestinationResolver.java index 7f5d5d6ca4b7..e01c5129c3cb 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/destination/DestinationResolver.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/destination/DestinationResolver.java @@ -22,7 +22,7 @@ /** * Strategy interface for resolving JMS destinations. - * + * *

      Used by {@link org.springframework.jms.core.JmsTemplate} for resolving * destination names from simple {@link String Strings} to actual * {@link Destination} implementation instances. diff --git a/spring-jms/src/main/java/org/springframework/jms/support/destination/JndiDestinationResolver.java b/spring-jms/src/main/java/org/springframework/jms/support/destination/JndiDestinationResolver.java index 351a7807c6d2..fa1b57619356 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/destination/JndiDestinationResolver.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/destination/JndiDestinationResolver.java @@ -139,7 +139,7 @@ public Destination resolveDestinationName(Session session, String destinationNam * false in case of a Queue */ protected void validateDestination(Destination destination, String destinationName, boolean pubSubDomain) { - Class targetClass = Queue.class; + Class targetClass = Queue.class; if (pubSubDomain) { targetClass = Topic.class; } diff --git a/spring-jms/src/test/java/org/springframework/beans/Colour.java b/spring-jms/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..4db722187d9d 100644 --- a/spring-jms/src/test/java/org/springframework/beans/Colour.java +++ b/spring-jms/src/test/java/org/springframework/beans/Colour.java @@ -32,4 +32,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-jms/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-jms/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-jms/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/beans/IOther.java b/spring-jms/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-jms/src/test/java/org/springframework/beans/IOther.java +++ b/spring-jms/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/beans/ITestBean.java b/spring-jms/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-jms/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-jms/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-jms/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..4f3012666eac 100644 --- a/spring-jms/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-jms/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-jms/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-jms/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-jms/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/beans/TestBean.java b/spring-jms/src/test/java/org/springframework/beans/TestBean.java index ef4aef309ead..c2a39d387882 100644 --- a/spring-jms/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-jms/src/test/java/org/springframework/beans/TestBean.java @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-jms/src/test/java/org/springframework/jms/StubConnectionFactory.java b/spring-jms/src/test/java/org/springframework/jms/StubConnectionFactory.java index dced87b71684..3d7b35490ce6 100644 --- a/spring-jms/src/test/java/org/springframework/jms/StubConnectionFactory.java +++ b/spring-jms/src/test/java/org/springframework/jms/StubConnectionFactory.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2007 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ /** * A stub implementation of the JMS ConnectionFactory for testing. - * + * * @author Mark Fisher */ public class StubConnectionFactory implements ConnectionFactory { diff --git a/spring-jms/src/test/java/org/springframework/jms/config/JmsNamespaceHandlerTests.java b/spring-jms/src/test/java/org/springframework/jms/config/JmsNamespaceHandlerTests.java index acd9e4f474f1..1b54cc4127b4 100644 --- a/spring-jms/src/test/java/org/springframework/jms/config/JmsNamespaceHandlerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/config/JmsNamespaceHandlerTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2010 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -184,9 +184,9 @@ public void testComponentRegistration() { assertTrue("Parser should have registered a component named 'listener1'", context.containsComponentDefinition("listener1")); assertTrue("Parser should have registered a component named 'listener2'", context.containsComponentDefinition("listener2")); assertTrue("Parser should have registered a component named 'listener3'", context.containsComponentDefinition("listener3")); - assertTrue("Parser should have registered a component named '" + DefaultMessageListenerContainer.class.getName() + "#0'", + assertTrue("Parser should have registered a component named '" + DefaultMessageListenerContainer.class.getName() + "#0'", context.containsComponentDefinition(DefaultMessageListenerContainer.class.getName() + "#0")); - assertTrue("Parser should have registered a component named '" + JmsMessageEndpointManager.class.getName() + "#0'", + assertTrue("Parser should have registered a component named '" + JmsMessageEndpointManager.class.getName() + "#0'", context.containsComponentDefinition(JmsMessageEndpointManager.class.getName() + "#0")); } @@ -215,14 +215,14 @@ public void onMessage(Message message) { this.message = message; } } - + /** * Internal extension that registers a {@link ReaderEventListener} to store * registered {@link ComponentDefinition}s. */ private static class ToolingTestApplicationContext extends ClassPathXmlApplicationContext { - + private Set registeredComponents; public ToolingTestApplicationContext(String path, Class clazz) { @@ -234,7 +234,7 @@ protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionRe beanDefinitionReader.setEventListener(new StoringReaderEventListener(this.registeredComponents)); beanDefinitionReader.setSourceExtractor(new PassThroughSourceExtractor()); } - + public boolean containsComponentDefinition(String name) { for (ComponentDefinition cd : this.registeredComponents) { if (cd instanceof CompositeComponentDefinition) { @@ -253,21 +253,21 @@ public boolean containsComponentDefinition(String name) { } return false; } - + public Iterator getRegisteredComponents() { return this.registeredComponents.iterator(); } } - + private static class StoringReaderEventListener extends EmptyReaderEventListener { - + protected final Set registeredComponents; - + public StoringReaderEventListener(Set registeredComponents) { this.registeredComponents = registeredComponents; } - + public void componentRegistered(ComponentDefinition componentDefinition) { this.registeredComponents.add(componentDefinition); } diff --git a/spring-jms/src/test/java/org/springframework/jms/connection/JmsTransactionManagerTests.java b/spring-jms/src/test/java/org/springframework/jms/connection/JmsTransactionManagerTests.java index 24211c5fd5ce..e12176ec9f67 100644 --- a/spring-jms/src/test/java/org/springframework/jms/connection/JmsTransactionManagerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/connection/JmsTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/connection/SingleConnectionFactoryTests.java b/spring-jms/src/test/java/org/springframework/jms/connection/SingleConnectionFactoryTests.java index 19912ccc3958..72f341b23def 100644 --- a/spring-jms/src/test/java/org/springframework/jms/connection/SingleConnectionFactoryTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/connection/SingleConnectionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java index c9890fd55b45..b2229e830c8d 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplate102Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java index bcf880eaaecf..44113db586cd 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/core/support/JmsGatewaySupportTests.java b/spring-jms/src/test/java/org/springframework/jms/core/support/JmsGatewaySupportTests.java index 1007b4c1d704..7436f922a881 100644 --- a/spring-jms/src/test/java/org/springframework/jms/core/support/JmsGatewaySupportTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/core/support/JmsGatewaySupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ protected void initGateway() { assertEquals("Correct JmsTemplate", mockConnectionFactory, gateway.getJmsTemplate().getConnectionFactory()); assertEquals("initGatway called", test.size(), 1); connectionFactoryControl.verify(); - + } public void testJmsGatewaySupportWithJmsTemplate() throws Exception { JmsTemplate template = new JmsTemplate(); @@ -60,7 +60,7 @@ protected void initGateway() { gateway.setJmsTemplate(template); gateway.afterPropertiesSet(); assertEquals("Correct JmsTemplate", template, gateway.getJmsTemplate()); - assertEquals("initGateway called", test.size(), 1); + assertEquals("initGateway called", test.size(), 1); } } diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java index 78c212664621..0e51fae69360 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java @@ -28,7 +28,7 @@ public abstract class AbstractMessageListenerContainerTests { protected abstract AbstractMessageListenerContainer getContainer(); - + @Test(expected=IllegalArgumentException.class) public void testSettingMessageListenerToANullType() throws Exception { getContainer().setMessageListener(null); diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java index 18e47584a483..2e695999b2f3 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapter102Tests.java b/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapter102Tests.java index 89bdeab9370c..0a4b2824a7ec 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapter102Tests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapter102Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -379,7 +379,7 @@ public void testWithResponsiveMessageDelegateNoDefaultDestination_SendsReturnTex QueueSender queueSender = (QueueSender) mockQueueSender.getMock(); queueSender.send(responseTextMessage); mockQueueSender.setThrowable(new JMSException("Dow!")); - // ensure that regardless of a JMSException the producer is closed... + // ensure that regardless of a JMSException the producer is closed... queueSender.close(); mockQueueSender.setVoidCallable(); mockQueueSender.replay(); diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapterTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapterTests.java index 59838f8136f9..8b6a1cd8fae4 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapterTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/adapter/MessageListenerAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,6 @@ import javax.jms.Session; import javax.jms.TextMessage; -import junit.framework.TestCase; import org.easymock.MockControl; import org.junit.Test; diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/adapter/ResponsiveJmsTextMessageReturningMessageDelegate.java b/spring-jms/src/test/java/org/springframework/jms/listener/adapter/ResponsiveJmsTextMessageReturningMessageDelegate.java index ffa07f4f2940..89140fac0a55 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/adapter/ResponsiveJmsTextMessageReturningMessageDelegate.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/adapter/ResponsiveJmsTextMessageReturningMessageDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,6 @@ package org.springframework.jms.listener.adapter; import javax.jms.TextMessage; -import javax.jms.MapMessage; -import javax.jms.BytesMessage; -import javax.jms.ObjectMessage; - -import java.util.Map; -import java.io.Serializable; /** * See the MessageListenerAdapterTests class for usage. diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java index 3b7e23a91f6c..0ccddc132170 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/endpoint/DefaultJmsActivationSpecFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/remoting/JmsInvokerTests.java b/spring-jms/src/test/java/org/springframework/jms/remoting/JmsInvokerTests.java index 97c33f030778..30c12d9d3b9c 100644 --- a/spring-jms/src/test/java/org/springframework/jms/remoting/JmsInvokerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/remoting/JmsInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/JmsAccessorTests.java b/spring-jms/src/test/java/org/springframework/jms/support/JmsAccessorTests.java index 2461c808d78a..818c0e79f204 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/JmsAccessorTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/JmsAccessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverter102Tests.java b/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverter102Tests.java index 450c0889a526..4f60b3b9c7ad 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverter102Tests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverter102Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverterTests.java b/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverterTests.java index 7085c1669b4c..1f031bac9899 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverterTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/SimpleMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJacksonMessageConverterTests.java b/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJacksonMessageConverterTests.java index bf682af41358..c433ed18130c 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJacksonMessageConverterTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJacksonMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/converter/MarshallingMessageConverterTests.java b/spring-jms/src/test/java/org/springframework/jms/support/converter/MarshallingMessageConverterTests.java index 861179583d7b..af5f03fc520b 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/converter/MarshallingMessageConverterTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/converter/MarshallingMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/destination/DynamicDestinationResolverTests.java b/spring-jms/src/test/java/org/springframework/jms/support/destination/DynamicDestinationResolverTests.java index e968d8cf28b9..ef0a3ec3461c 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/destination/DynamicDestinationResolverTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/destination/DynamicDestinationResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java b/spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java index 133602bcbd86..474dacfa4d66 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/destination/JmsDestinationAccessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/jms/support/destination/JndiDestinationResolverTests.java b/spring-jms/src/test/java/org/springframework/jms/support/destination/JndiDestinationResolverTests.java index 739dbe3d3c2c..ccfe979e3532 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/destination/JndiDestinationResolverTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/destination/JndiDestinationResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-jms/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/spring-jms/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java index d5c2531fbde5..563d61071495 100644 --- a/spring-jms/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java +++ b/spring-jms/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java @@ -50,7 +50,7 @@ protected void doRollback(DefaultTransactionStatus status) { ++rollbacks; --inflight; } - + public void clear() { begun = commits = rollbacks = inflight = 0; } diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java index 6ad987fdfead..e841731a892e 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBuilder.java @@ -228,7 +228,6 @@ private boolean matchesFilter(MetadataReader reader, MetadataReaderFactory reade * Build the {@code SessionFactory}. */ @Override - @SuppressWarnings("deprecation") public SessionFactory buildSessionFactory() throws HibernateException { ClassLoader appClassLoader = (ClassLoader) getProperties().get(AvailableSettings.APP_CLASSLOADER); Thread currentThread = Thread.currentThread(); diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java index 486069f15e06..18069246abf5 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java @@ -33,9 +33,8 @@ import org.springframework.web.context.request.AsyncWebRequestInterceptor; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.WebRequest; -import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter; -import org.springframework.web.context.request.async.WebAsyncManager; -import org.springframework.web.context.request.async.WebAsyncUtils; +import org.springframework.web.context.request.async.AbstractDelegatingCallable; +import org.springframework.web.context.request.async.AsyncWebRequestInterceptor; /** * Spring web request interceptor that binds a Hibernate Session to the diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletInputStream.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletInputStream.java index b083e95b27e4..00892f40f34d 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletInputStream.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java index 66fca5df2f91..af0974faabb3 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockFilterConfig.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockFilterConfig.java index 34cafd55fc1f..49e5beb45a7b 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockFilterConfig.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockFilterConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java index 88afb595afe9..3a83fd4bfa41 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java @@ -96,6 +96,7 @@ public class MockHttpServletRequest implements HttpServletRequest { private static final String CHARSET_PREFIX = "charset="; + private boolean active = true; // --------------------------------------------------------------------- diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java index 550e927a4777..88f3dbab08ec 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java @@ -51,7 +51,7 @@ public class MockHttpServletResponse implements HttpServletResponse { private static final String CHARSET_PREFIX = "charset="; private static final String CONTENT_TYPE_HEADER = "Content-Type"; - + private static final String CONTENT_LENGTH_HEADER = "Content-Length"; private static final String LOCATION_HEADER = "Location"; @@ -141,7 +141,7 @@ public void setCharacterEncoding(String characterEncoding) { this.charset = true; updateContentTypeHeader(); } - + private void updateContentTypeHeader() { if (this.contentType != null) { StringBuilder sb = new StringBuilder(this.contentType); @@ -457,7 +457,7 @@ private void addHeaderValue(String name, Object value) { } doAddHeaderValue(name, value, false); } - + private boolean setSpecialHeader(String name, Object value) { if (CONTENT_TYPE_HEADER.equalsIgnoreCase(name)) { setContentType((String) value); diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpSession.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpSession.java index 3caa9213ee4d..c5096572d021 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpSession.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockHttpSession.java @@ -80,7 +80,7 @@ public MockHttpSession() { /** * Create a new MockHttpSession. - * + * * @param servletContext the ServletContext that the session runs in */ public MockHttpSession(ServletContext servletContext) { @@ -89,7 +89,7 @@ public MockHttpSession(ServletContext servletContext) { /** * Create a new MockHttpSession. - * + * * @param servletContext the ServletContext that the session runs in * @param id a unique identifier for this session */ @@ -222,7 +222,7 @@ public boolean isNew() { /** * Serialize the attributes of this session into an object that can be * turned into a byte array with standard Java serialization. - * + * * @return a representation of this session's serialized state */ public Serializable serializeState() { @@ -249,7 +249,7 @@ public Serializable serializeState() { /** * Deserialize the attributes of this session from a state object created by * {@link #serializeState()}. - * + * * @param state a representation of this session's serialized state */ @SuppressWarnings("unchecked") diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockServletConfig.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockServletConfig.java index c62ec1520d05..90e9dea3b6f5 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockServletConfig.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/MockServletConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/PassThroughFilterChain.java b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/PassThroughFilterChain.java index b3484a0a83a2..c2de4d2fccf9 100644 --- a/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/PassThroughFilterChain.java +++ b/spring-orm-hibernate4/src/test/java/org/springframework/mock/web/PassThroughFilterChain.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java b/spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java index 4cd1dc8da7b1..e75e01b10e9e 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java +++ b/spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public ObjectOptimisticLockingFailureException(String msg, Throwable cause) { * @param persistentClass the persistent class * @param identifier the ID of the object for which the locking failed */ - public ObjectOptimisticLockingFailureException(Class persistentClass, Object identifier) { + public ObjectOptimisticLockingFailureException(Class persistentClass, Object identifier) { this(persistentClass, identifier, null); } @@ -60,7 +60,7 @@ public ObjectOptimisticLockingFailureException(Class persistentClass, Object ide * @param cause the source exception */ public ObjectOptimisticLockingFailureException( - Class persistentClass, Object identifier, Throwable cause) { + Class persistentClass, Object identifier, Throwable cause) { this(persistentClass, identifier, "Object of class [" + persistentClass.getName() + "] with identifier [" + identifier + @@ -76,7 +76,7 @@ public ObjectOptimisticLockingFailureException( * @param cause the source exception */ public ObjectOptimisticLockingFailureException( - Class persistentClass, Object identifier, String msg, Throwable cause) { + Class persistentClass, Object identifier, String msg, Throwable cause) { super(msg, cause); this.persistentClass = persistentClass; @@ -129,8 +129,8 @@ public ObjectOptimisticLockingFailureException( * Return the persistent class of the object for which the locking failed. * If no Class was specified, this method returns null. */ - public Class getPersistentClass() { - return (this.persistentClass instanceof Class ? (Class) this.persistentClass : null); + public Class getPersistentClass() { + return (this.persistentClass instanceof Class ? (Class) this.persistentClass : null); } /** @@ -139,7 +139,7 @@ public Class getPersistentClass() { */ public String getPersistentClassName() { if (this.persistentClass instanceof Class) { - return ((Class) this.persistentClass).getName(); + return ((Class) this.persistentClass).getName(); } return (this.persistentClass != null ? this.persistentClass.toString() : null); } diff --git a/spring-orm/src/main/java/org/springframework/orm/ObjectRetrievalFailureException.java b/spring-orm/src/main/java/org/springframework/orm/ObjectRetrievalFailureException.java index b9151890fc2b..0bcdaf606700 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ObjectRetrievalFailureException.java +++ b/spring-orm/src/main/java/org/springframework/orm/ObjectRetrievalFailureException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public ObjectRetrievalFailureException(String msg, Throwable cause) { * @param persistentClass the persistent class * @param identifier the ID of the object that should have been retrieved */ - public ObjectRetrievalFailureException(Class persistentClass, Object identifier) { + public ObjectRetrievalFailureException(Class persistentClass, Object identifier) { this(persistentClass, identifier, "Object of class [" + persistentClass.getName() + "] with identifier [" + identifier + "]: not found", null); @@ -63,7 +63,7 @@ public ObjectRetrievalFailureException(Class persistentClass, Object identifier) * @param cause the source exception */ public ObjectRetrievalFailureException( - Class persistentClass, Object identifier, String msg, Throwable cause) { + Class persistentClass, Object identifier, String msg, Throwable cause) { super(msg, cause); this.persistentClass = persistentClass; @@ -103,8 +103,8 @@ public ObjectRetrievalFailureException( * Return the persistent class of the object that was not found. * If no Class was specified, this method returns null. */ - public Class getPersistentClass() { - return (this.persistentClass instanceof Class ? (Class) this.persistentClass : null); + public Class getPersistentClass() { + return (this.persistentClass instanceof Class ? (Class) this.persistentClass : null); } /** @@ -113,7 +113,7 @@ public Class getPersistentClass() { */ public String getPersistentClassName() { if (this.persistentClass instanceof Class) { - return ((Class) this.persistentClass).getName(); + return ((Class) this.persistentClass).getName(); } return (this.persistentClass != null ? this.persistentClass.toString() : null); } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/AbstractSessionFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/AbstractSessionFactoryBean.java index 9d712c3aa089..7d8df908f652 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/AbstractSessionFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/AbstractSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java index 65b9dd2152fc..b215fa06511c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateAccessor.java @@ -208,7 +208,7 @@ public Interceptor getEntityInterceptor() throws IllegalStateException, BeansExc if (this.beanFactory == null) { throw new IllegalStateException("Cannot get entity interceptor via bean name if no bean factory set"); } - return (Interceptor) this.beanFactory.getBean((String) this.entityInterceptor, Interceptor.class); + return this.beanFactory.getBean((String) this.entityInterceptor, Interceptor.class); } return (Interceptor) this.entityInterceptor; } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateExceptionTranslator.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateExceptionTranslator.java index 60e298cccf44..b302d15da20b 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateExceptionTranslator.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateExceptionTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateInterceptor.java index d53bee15402f..0e673b776b26 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateJdbcException.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateJdbcException.java index c6cf41537f0f..7d422ac624ae 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateJdbcException.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateJdbcException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateObjectRetrievalFailureException.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateObjectRetrievalFailureException.java index 726430889c4f..aad63d1cc67d 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateObjectRetrievalFailureException.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateObjectRetrievalFailureException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java index 25353ae56a19..85e2e3b5da81 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +94,7 @@ public interface HibernateOperations { * @return a List result returned by the action, or null * @throws org.springframework.dao.DataAccessException in case of Hibernate errors */ - List executeFind(HibernateCallback action) throws DataAccessException; + List executeFind(HibernateCallback action) throws DataAccessException; //------------------------------------------------------------------------- @@ -239,7 +239,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) /** * Return all persistent instances of the given entity class. - * Note: Use queries or criteria for retrieving a specific subset. + * Note: Use queries or criteria for retrieving a specific subset. * @param entityClass a persistent class * @return a {@link List} containing 0 or more persistent instances * @throws org.springframework.dao.DataAccessException if there is a Hibernate error @@ -444,7 +444,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) * saveOrUpdate or merge usage */ @Deprecated - void saveOrUpdateAll(Collection entities) throws DataAccessException; + void saveOrUpdateAll(Collection entities) throws DataAccessException; /** * Persist the state of the given detached instance according to the @@ -580,7 +580,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#delete(Object) */ - void deleteAll(Collection entities) throws DataAccessException; + void deleteAll(Collection entities) throws DataAccessException; /** * Flush all pending saves, updates and deletes to the database. @@ -613,7 +613,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#createQuery */ - List find(String queryString) throws DataAccessException; + List find(String queryString) throws DataAccessException; /** * Execute an HQL query, binding one value to a "?" parameter in the @@ -624,7 +624,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#createQuery */ - List find(String queryString, Object value) throws DataAccessException; + List find(String queryString, Object value) throws DataAccessException; /** * Execute an HQL query, binding a number of values to "?" parameters @@ -635,7 +635,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#createQuery */ - List find(String queryString, Object... values) throws DataAccessException; + List find(String queryString, Object... values) throws DataAccessException; /** * Execute an HQL query, binding one value to a ":" named parameter @@ -647,7 +647,7 @@ Object load(String entityName, Serializable id, LockMode lockMode) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedParam(String queryString, String paramName, Object value) + List findByNamedParam(String queryString, String paramName, Object value) throws DataAccessException; /** @@ -660,7 +660,7 @@ List findByNamedParam(String queryString, String paramName, Object value) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedParam(String queryString, String[] paramNames, Object[] values) + List findByNamedParam(String queryString, String[] paramNames, Object[] values) throws DataAccessException; /** @@ -673,7 +673,7 @@ List findByNamedParam(String queryString, String[] paramNames, Object[] values) * @see org.hibernate.Query#setProperties * @see org.hibernate.Session#createQuery */ - List findByValueBean(String queryString, Object valueBean) throws DataAccessException; + List findByValueBean(String queryString, Object valueBean) throws DataAccessException; //------------------------------------------------------------------------- @@ -688,7 +688,7 @@ List findByNamedParam(String queryString, String[] paramNames, Object[] values) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedQuery(String queryName) throws DataAccessException; + List findByNamedQuery(String queryName) throws DataAccessException; /** * Execute a named query, binding one value to a "?" parameter in @@ -700,7 +700,7 @@ List findByNamedParam(String queryString, String[] paramNames, Object[] values) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedQuery(String queryName, Object value) throws DataAccessException; + List findByNamedQuery(String queryName, Object value) throws DataAccessException; /** * Execute a named query binding a number of values to "?" parameters @@ -712,7 +712,7 @@ List findByNamedParam(String queryString, String[] paramNames, Object[] values) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedQuery(String queryName, Object... values) throws DataAccessException; + List findByNamedQuery(String queryName, Object... values) throws DataAccessException; /** * Execute a named query, binding one value to a ":" named parameter @@ -725,7 +725,7 @@ List findByNamedParam(String queryString, String[] paramNames, Object[] values) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedQueryAndNamedParam(String queryName, String paramName, Object value) + List findByNamedQueryAndNamedParam(String queryName, String paramName, Object value) throws DataAccessException; /** @@ -739,7 +739,7 @@ List findByNamedQueryAndNamedParam(String queryName, String paramName, Object va * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values) + List findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values) throws DataAccessException; /** @@ -753,7 +753,7 @@ List findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object * @see org.hibernate.Query#setProperties * @see org.hibernate.Session#getNamedQuery(String) */ - List findByNamedQueryAndValueBean(String queryName, Object valueBean) + List findByNamedQueryAndValueBean(String queryName, Object valueBean) throws DataAccessException; @@ -770,7 +770,7 @@ List findByNamedQueryAndValueBean(String queryName, Object valueBean) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.criterion.DetachedCriteria#getExecutableCriteria(org.hibernate.Session) */ - List findByCriteria(DetachedCriteria criteria) throws DataAccessException; + List findByCriteria(DetachedCriteria criteria) throws DataAccessException; /** * Execute a query based on the given Hibernate criteria object. @@ -787,7 +787,7 @@ List findByNamedQueryAndValueBean(String queryName, Object valueBean) * @see org.hibernate.Criteria#setFirstResult(int) * @see org.hibernate.Criteria#setMaxResults(int) */ - List findByCriteria(DetachedCriteria criteria, int firstResult, int maxResults) throws DataAccessException; + List findByCriteria(DetachedCriteria criteria, int firstResult, int maxResults) throws DataAccessException; /** * Execute a query based on the given example entity object. @@ -797,7 +797,7 @@ List findByNamedQueryAndValueBean(String queryName, Object valueBean) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.criterion.Example#create(Object) */ - List findByExample(Object exampleEntity) throws DataAccessException; + List findByExample(Object exampleEntity) throws DataAccessException; /** * Execute a query based on the given example entity object. @@ -808,7 +808,7 @@ List findByNamedQueryAndValueBean(String queryName, Object valueBean) * @throws org.springframework.dao.DataAccessException in case of Hibernate errors * @see org.hibernate.criterion.Example#create(Object) */ - List findByExample(String entityName, Object exampleEntity) throws DataAccessException; + List findByExample(String entityName, Object exampleEntity) throws DataAccessException; /** * Execute a query based on a given example entity object. @@ -824,7 +824,7 @@ List findByNamedQueryAndValueBean(String queryName, Object valueBean) * @see org.hibernate.Criteria#setFirstResult(int) * @see org.hibernate.Criteria#setMaxResults(int) */ - List findByExample(Object exampleEntity, int firstResult, int maxResults) throws DataAccessException; + List findByExample(Object exampleEntity, int firstResult, int maxResults) throws DataAccessException; /** * Execute a query based on a given example entity object. @@ -841,7 +841,7 @@ List findByNamedQueryAndValueBean(String queryName, Object valueBean) * @see org.hibernate.Criteria#setFirstResult(int) * @see org.hibernate.Criteria#setMaxResults(int) */ - List findByExample(String entityName, Object exampleEntity, int firstResult, int maxResults) + List findByExample(String entityName, Object exampleEntity, int firstResult, int maxResults) throws DataAccessException; @@ -859,7 +859,7 @@ List findByExample(String entityName, Object exampleEntity, int firstResult, int * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#iterate */ - Iterator iterate(String queryString) throws DataAccessException; + Iterator iterate(String queryString) throws DataAccessException; /** * Execute a query for persistent instances, binding one value @@ -873,7 +873,7 @@ List findByExample(String entityName, Object exampleEntity, int firstResult, int * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#iterate */ - Iterator iterate(String queryString, Object value) throws DataAccessException; + Iterator iterate(String queryString, Object value) throws DataAccessException; /** * Execute a query for persistent instances, binding a number of @@ -887,7 +887,7 @@ List findByExample(String entityName, Object exampleEntity, int firstResult, int * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#iterate */ - Iterator iterate(String queryString, Object... values) throws DataAccessException; + Iterator iterate(String queryString, Object... values) throws DataAccessException; /** * Immediately close an {@link Iterator} created by any of the various @@ -897,7 +897,7 @@ List findByExample(String entityName, Object exampleEntity, int firstResult, int * @throws DataAccessException if the Iterator could not be closed * @see org.hibernate.Hibernate#close */ - void closeIterator(Iterator it) throws DataAccessException; + void closeIterator(Iterator it) throws DataAccessException; /** * Update/delete all objects according to the given query. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOptimisticLockingFailureException.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOptimisticLockingFailureException.java index fb58c8efcc8e..933e22c48097 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOptimisticLockingFailureException.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOptimisticLockingFailureException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateQueryException.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateQueryException.java index 743600991b6c..34c65b3a8a6b 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateQueryException.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateQueryException.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateSystemException.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateSystemException.java index 83fdb0f3d514..42d0cde3a753 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateSystemException.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateSystemException.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java index 72962e4087f8..39116345d6a9 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -339,13 +339,14 @@ public T execute(HibernateCallback action) throws DataAccessException { return doExecute(action, false, false); } - public List executeFind(HibernateCallback action) throws DataAccessException { + @SuppressWarnings("unchecked") + public List executeFind(HibernateCallback action) throws DataAccessException { Object result = doExecute(action, false, false); if (result != null && !(result instanceof List)) { throw new InvalidDataAccessApiUsageException( "Result object returned from HibernateCallback isn't a List: [" + result + "]"); } - return (List) result; + return (List) result; } /** @@ -480,8 +481,8 @@ else if (SessionFactoryUtils.hasTransactionalSession(getSessionFactory())) { * @see #prepareCriteria */ protected Session createSessionProxy(Session session) { - Class[] sessionIfcs = null; - Class mainIfc = (session instanceof org.hibernate.classic.Session ? + Class[] sessionIfcs = null; + Class mainIfc = (session instanceof org.hibernate.classic.Session ? org.hibernate.classic.Session.class : Session.class); if (session instanceof EventSource) { sessionIfcs = new Class[] {mainIfc, EventSource.class}; @@ -753,7 +754,7 @@ public Object doInHibernate(Session session) throws HibernateException { }); } - public void saveOrUpdateAll(final Collection entities) throws DataAccessException { + public void saveOrUpdateAll(final Collection entities) throws DataAccessException { executeWithNativeSession(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { checkWriteOperationAllowed(session); @@ -865,7 +866,7 @@ public Object doInHibernate(Session session) throws HibernateException { }); } - public void deleteAll(final Collection entities) throws DataAccessException { + public void deleteAll(final Collection entities) throws DataAccessException { executeWithNativeSession(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { checkWriteOperationAllowed(session); @@ -900,17 +901,18 @@ public Object doInHibernate(Session session) { // Convenience finder methods for HQL strings //------------------------------------------------------------------------- - public List find(String queryString) throws DataAccessException { + public List find(String queryString) throws DataAccessException { return find(queryString, (Object[]) null); } - public List find(String queryString, Object value) throws DataAccessException { + public List find(String queryString, Object value) throws DataAccessException { return find(queryString, new Object[] {value}); } - public List find(final String queryString, final Object... values) throws DataAccessException { - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + public List find(final String queryString, final Object... values) throws DataAccessException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Query queryObject = session.createQuery(queryString); prepareQuery(queryObject); if (values != null) { @@ -923,20 +925,21 @@ public List doInHibernate(Session session) throws HibernateException { }); } - public List findByNamedParam(String queryString, String paramName, Object value) + public List findByNamedParam(String queryString, String paramName, Object value) throws DataAccessException { return findByNamedParam(queryString, new String[] {paramName}, new Object[] {value}); } - public List findByNamedParam(final String queryString, final String[] paramNames, final Object[] values) + public List findByNamedParam(final String queryString, final String[] paramNames, final Object[] values) throws DataAccessException { if (paramNames.length != values.length) { throw new IllegalArgumentException("Length of paramNames array must match length of values array"); } - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Query queryObject = session.createQuery(queryString); prepareQuery(queryObject); if (values != null) { @@ -949,11 +952,12 @@ public List doInHibernate(Session session) throws HibernateException { }); } - public List findByValueBean(final String queryString, final Object valueBean) + public List findByValueBean(final String queryString, final Object valueBean) throws DataAccessException { - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Query queryObject = session.createQuery(queryString); prepareQuery(queryObject); queryObject.setProperties(valueBean); @@ -967,17 +971,18 @@ public List doInHibernate(Session session) throws HibernateException { // Convenience finder methods for named queries //------------------------------------------------------------------------- - public List findByNamedQuery(String queryName) throws DataAccessException { + public List findByNamedQuery(String queryName) throws DataAccessException { return findByNamedQuery(queryName, (Object[]) null); } - public List findByNamedQuery(String queryName, Object value) throws DataAccessException { + public List findByNamedQuery(String queryName, Object value) throws DataAccessException { return findByNamedQuery(queryName, new Object[] {value}); } - public List findByNamedQuery(final String queryName, final Object... values) throws DataAccessException { - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + public List findByNamedQuery(final String queryName, final Object... values) throws DataAccessException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Query queryObject = session.getNamedQuery(queryName); prepareQuery(queryObject); if (values != null) { @@ -990,21 +995,22 @@ public List doInHibernate(Session session) throws HibernateException { }); } - public List findByNamedQueryAndNamedParam(String queryName, String paramName, Object value) + public List findByNamedQueryAndNamedParam(String queryName, String paramName, Object value) throws DataAccessException { return findByNamedQueryAndNamedParam(queryName, new String[] {paramName}, new Object[] {value}); } - public List findByNamedQueryAndNamedParam( + public List findByNamedQueryAndNamedParam( final String queryName, final String[] paramNames, final Object[] values) throws DataAccessException { if (paramNames != null && values != null && paramNames.length != values.length) { throw new IllegalArgumentException("Length of paramNames array must match length of values array"); } - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Query queryObject = session.getNamedQuery(queryName); prepareQuery(queryObject); if (values != null) { @@ -1017,11 +1023,12 @@ public List doInHibernate(Session session) throws HibernateException { }); } - public List findByNamedQueryAndValueBean(final String queryName, final Object valueBean) + public List findByNamedQueryAndValueBean(final String queryName, final Object valueBean) throws DataAccessException { - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Query queryObject = session.getNamedQuery(queryName); prepareQuery(queryObject); queryObject.setProperties(valueBean); @@ -1035,16 +1042,17 @@ public List doInHibernate(Session session) throws HibernateException { // Convenience finder methods for detached criteria //------------------------------------------------------------------------- - public List findByCriteria(DetachedCriteria criteria) throws DataAccessException { + public List findByCriteria(DetachedCriteria criteria) throws DataAccessException { return findByCriteria(criteria, -1, -1); } - public List findByCriteria(final DetachedCriteria criteria, final int firstResult, final int maxResults) + public List findByCriteria(final DetachedCriteria criteria, final int firstResult, final int maxResults) throws DataAccessException { Assert.notNull(criteria, "DetachedCriteria must not be null"); - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Criteria executableCriteria = criteria.getExecutableCriteria(session); prepareCriteria(executableCriteria); if (firstResult >= 0) { @@ -1058,25 +1066,26 @@ public List doInHibernate(Session session) throws HibernateException { }); } - public List findByExample(Object exampleEntity) throws DataAccessException { + public List findByExample(Object exampleEntity) throws DataAccessException { return findByExample(null, exampleEntity, -1, -1); } - public List findByExample(String entityName, Object exampleEntity) throws DataAccessException { + public List findByExample(String entityName, Object exampleEntity) throws DataAccessException { return findByExample(entityName, exampleEntity, -1, -1); } - public List findByExample(Object exampleEntity, int firstResult, int maxResults) throws DataAccessException { + public List findByExample(Object exampleEntity, int firstResult, int maxResults) throws DataAccessException { return findByExample(null, exampleEntity, firstResult, maxResults); } - public List findByExample( + public List findByExample( final String entityName, final Object exampleEntity, final int firstResult, final int maxResults) throws DataAccessException { Assert.notNull(exampleEntity, "Example entity must not be null"); - return executeWithNativeSession(new HibernateCallback() { - public List doInHibernate(Session session) throws HibernateException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public List doInHibernate(Session session) throws HibernateException { Criteria executableCriteria = (entityName != null ? session.createCriteria(entityName) : session.createCriteria(exampleEntity.getClass())); executableCriteria.add(Example.create(exampleEntity)); @@ -1097,17 +1106,18 @@ public List doInHibernate(Session session) throws HibernateException { // Convenience query methods for iteration and bulk updates/deletes //------------------------------------------------------------------------- - public Iterator iterate(String queryString) throws DataAccessException { + public Iterator iterate(String queryString) throws DataAccessException { return iterate(queryString, (Object[]) null); } - public Iterator iterate(String queryString, Object value) throws DataAccessException { + public Iterator iterate(String queryString, Object value) throws DataAccessException { return iterate(queryString, new Object[] {value}); } - public Iterator iterate(final String queryString, final Object... values) throws DataAccessException { - return executeWithNativeSession(new HibernateCallback() { - public Iterator doInHibernate(Session session) throws HibernateException { + public Iterator iterate(final String queryString, final Object... values) throws DataAccessException { + return executeWithNativeSession(new HibernateCallback>() { + @SuppressWarnings("unchecked") + public Iterator doInHibernate(Session session) throws HibernateException { Query queryObject = session.createQuery(queryString); prepareQuery(queryObject); if (values != null) { @@ -1120,7 +1130,7 @@ public Iterator doInHibernate(Session session) throws HibernateException { }); } - public void closeIterator(Iterator it) throws DataAccessException { + public void closeIterator(Iterator it) throws DataAccessException { try { Hibernate.close(it); } @@ -1237,7 +1247,7 @@ protected void applyNamedParameterToQuery(Query queryObject, String paramName, O throws HibernateException { if (value instanceof Collection) { - queryObject.setParameterList(paramName, (Collection) value); + queryObject.setParameterList(paramName, (Collection) value); } else if (value instanceof Object[]) { queryObject.setParameterList(paramName, (Object[]) value); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java index ae5f3853b3c8..694df3bfbd88 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalRegionFactoryProxy.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalRegionFactoryProxy.java index e06659415721..ae6e3ba811e7 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalRegionFactoryProxy.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/LocalRegionFactoryProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java index 240ebcbcc944..88b80e167f43 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringSessionSynchronization.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringTransactionFactory.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringTransactionFactory.java index 068d1f9e6b01..8fa1e9403478 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringTransactionFactory.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/SpringTransactionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java index 3264e821ceea..f73ed3885719 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem private static final String RESOURCE_PATTERN = "/**/*.class"; - private Class[] annotatedClasses; + private Class[] annotatedClasses; private String[] annotatedPackages; @@ -114,7 +114,7 @@ public void setConfigurationClass(Class configurationClass) { * class-level JDK 1.5+ annotation metadata. * @see org.hibernate.cfg.AnnotationConfiguration#addAnnotatedClass(Class) */ - public void setAnnotatedClasses(Class[] annotatedClasses) { + public void setAnnotatedClasses(Class[] annotatedClasses) { this.annotatedClasses = annotatedClasses; } @@ -163,7 +163,7 @@ public void setResourceLoader(ResourceLoader resourceLoader) { protected void postProcessMappings(Configuration config) throws HibernateException { AnnotationConfiguration annConfig = (AnnotationConfiguration) config; if (this.annotatedClasses != null) { - for (Class annotatedClass : this.annotatedClasses) { + for (Class annotatedClass : this.annotatedClasses) { annConfig.addAnnotatedClass(annotatedClass); } } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/AbstractLobType.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/AbstractLobType.java index 5ab3c68bbbe9..753304e3c821 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/AbstractLobType.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/AbstractLobType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import java.sql.ResultSet; import java.sql.SQLException; -import javax.transaction.Status; import javax.transaction.TransactionManager; import org.apache.commons.logging.Log; @@ -31,14 +30,10 @@ import org.hibernate.usertype.UserType; import org.hibernate.util.EqualsHelper; -import org.springframework.dao.DataAccessResourceFailureException; -import org.springframework.jdbc.support.lob.JtaLobCreatorSynchronization; import org.springframework.jdbc.support.lob.LobCreator; import org.springframework.jdbc.support.lob.LobHandler; -import org.springframework.jdbc.support.lob.SpringLobCreatorSynchronization; import org.springframework.jdbc.support.lob.LobCreatorUtils; import org.springframework.orm.hibernate3.LocalSessionFactoryBean; -import org.springframework.transaction.support.TransactionSynchronizationManager; /** * Abstract base class for Hibernate UserType implementations that map to LOBs. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobByteArrayType.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobByteArrayType.java index c30f81fdb1b4..14fb9a57c1c3 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobByteArrayType.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobByteArrayType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public int[] sqlTypes() { return new int[] {Types.BLOB}; } - public Class returnedClass() { + public Class returnedClass() { return byte[].class; } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobSerializableType.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobSerializableType.java index 9334c8db88ca..3a6ecb52f717 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobSerializableType.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobSerializableType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ public int[] sqlTypes() { return new int[] {Types.BLOB}; } - public Class returnedClass() { + public Class returnedClass() { return Serializable.class; } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobStringType.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobStringType.java index be7ac8f15c6b..c07b97941a51 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobStringType.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/BlobStringType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,7 +70,7 @@ public int[] sqlTypes() { return new int[] {Types.BLOB}; } - public Class returnedClass() { + public Class returnedClass() { return String.class; } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ClobStringType.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ClobStringType.java index 12435ba890c4..4ceb9e79567b 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ClobStringType.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ClobStringType.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -66,7 +66,7 @@ public int[] sqlTypes() { return new int[] {Types.CLOB}; } - public Class returnedClass() { + public Class returnedClass() { return String.class; } diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/HibernateDaoSupport.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/HibernateDaoSupport.java index 5428baeed510..fe398f39e43a 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/HibernateDaoSupport.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/HibernateDaoSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java index 4392b39e9fd8..8d375e60e92b 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/IdTransferringMergeEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,7 @@ public class IdTransferringMergeEventListener extends DefaultMergeEventListener * Hibernate 3.1 implementation of ID transferral. */ @Override + @SuppressWarnings("rawtypes") protected void entityIsTransient(MergeEvent event, Map copyCache) { super.entityIsTransient(event, copyCache); SessionImplementor session = event.getSession(); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptor.java index e2bc17731f0d..c78f28268f7d 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientFactoryBean.java index ee77fe43066f..626709bf9751 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -236,7 +236,7 @@ public void setUseTransactionAwareDataSource(boolean useTransactionAwareDataSour * @see com.ibatis.sqlmap.engine.transaction.jta.JtaTransactionConfig * @see com.ibatis.sqlmap.client.SqlMapTransactionManager */ - public void setTransactionConfigClass(Class transactionConfigClass) { + public void setTransactionConfigClass(Class transactionConfigClass) { if (transactionConfigClass == null || !TransactionConfig.class.isAssignableFrom(transactionConfigClass)) { throw new IllegalArgumentException("Invalid transactionConfigClass: does not implement " + "com.ibatis.sqlmap.engine.transaction.TransactionConfig"); diff --git a/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientOperations.java b/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientOperations.java index 91ac466c5b2e..9a7d160697da 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientOperations.java +++ b/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import java.util.List; import java.util.Map; -import com.ibatis.common.util.PaginatedList; import com.ibatis.sqlmap.client.event.RowHandler; import org.springframework.dao.DataAccessException; @@ -69,27 +68,27 @@ Object queryForObject(String statementName, Object parameterObject, Object resul * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String) * @throws org.springframework.dao.DataAccessException in case of errors */ - List queryForList(String statementName) throws DataAccessException; + List queryForList(String statementName) throws DataAccessException; /** * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String, Object) * @throws org.springframework.dao.DataAccessException in case of errors */ - List queryForList(String statementName, Object parameterObject) + List queryForList(String statementName, Object parameterObject) throws DataAccessException; /** * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String, int, int) * @throws org.springframework.dao.DataAccessException in case of errors */ - List queryForList(String statementName, int skipResults, int maxResults) + List queryForList(String statementName, int skipResults, int maxResults) throws DataAccessException; /** * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String, Object, int, int) * @throws org.springframework.dao.DataAccessException in case of errors */ - List queryForList(String statementName, Object parameterObject, int skipResults, int maxResults) + List queryForList(String statementName, Object parameterObject, int skipResults, int maxResults) throws DataAccessException; /** diff --git a/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientTemplate.java b/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientTemplate.java index 5d454b85cb91..b095c06b0e73 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -242,6 +242,7 @@ public T execute(SqlMapClientCallback action) throws DataAccessException * {@link #execute} method */ @Deprecated + @SuppressWarnings("rawtypes") public List executeWithListResult(SqlMapClientCallback action) throws DataAccessException { return execute(action); } @@ -256,6 +257,7 @@ public List executeWithListResult(SqlMapClientCallback action) throws Data * {@link #execute} method */ @Deprecated + @SuppressWarnings("rawtypes") public Map executeWithMapResult(SqlMapClientCallback action) throws DataAccessException { return execute(action); } @@ -286,32 +288,34 @@ public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException { }); } - public List queryForList(String statementName) throws DataAccessException { + public List queryForList(String statementName) throws DataAccessException { return queryForList(statementName, null); } - public List queryForList(final String statementName, final Object parameterObject) + public List queryForList(final String statementName, final Object parameterObject) throws DataAccessException { - return execute(new SqlMapClientCallback() { - public List doInSqlMapClient(SqlMapExecutor executor) throws SQLException { + return execute(new SqlMapClientCallback>() { + @SuppressWarnings("unchecked") + public List doInSqlMapClient(SqlMapExecutor executor) throws SQLException { return executor.queryForList(statementName, parameterObject); } }); } - public List queryForList(String statementName, int skipResults, int maxResults) + public List queryForList(String statementName, int skipResults, int maxResults) throws DataAccessException { return queryForList(statementName, null, skipResults, maxResults); } - public List queryForList( + public List queryForList( final String statementName, final Object parameterObject, final int skipResults, final int maxResults) throws DataAccessException { - return execute(new SqlMapClientCallback() { - public List doInSqlMapClient(SqlMapExecutor executor) throws SQLException { + return execute(new SqlMapClientCallback>() { + @SuppressWarnings("unchecked") + public List doInSqlMapClient(SqlMapExecutor executor) throws SQLException { return executor.queryForList(statementName, parameterObject, skipResults, maxResults); } }); diff --git a/spring-orm/src/main/java/org/springframework/orm/ibatis/package-info.java b/spring-orm/src/main/java/org/springframework/orm/ibatis/package-info.java index c16fc59bab01..b76167a271c7 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ibatis/package-info.java +++ b/spring-orm/src/main/java/org/springframework/orm/ibatis/package-info.java @@ -4,7 +4,7 @@ * Package providing integration of * iBATIS Database Layer * with Spring concepts. - * + * *

      Contains resource helper classes and template classes for * data access with the iBATIS SqlMapClient API. * diff --git a/spring-orm/src/main/java/org/springframework/orm/ibatis/support/AbstractLobTypeHandler.java b/spring-orm/src/main/java/org/springframework/orm/ibatis/support/AbstractLobTypeHandler.java index 9519e654dda9..0d8cf8e7c388 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ibatis/support/AbstractLobTypeHandler.java +++ b/spring-orm/src/main/java/org/springframework/orm/ibatis/support/AbstractLobTypeHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/ibatis/support/SqlMapClientDaoSupport.java b/spring-orm/src/main/java/org/springframework/orm/ibatis/support/SqlMapClientDaoSupport.java index 6b5dc3ee42b0..51c7de841a05 100644 --- a/spring-orm/src/main/java/org/springframework/orm/ibatis/support/SqlMapClientDaoSupport.java +++ b/spring-orm/src/main/java/org/springframework/orm/ibatis/support/SqlMapClientDaoSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/DefaultJdoDialect.java b/spring-orm/src/main/java/org/springframework/orm/jdo/DefaultJdoDialect.java index 5b08921b71c8..ba0c0cc7c816 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/DefaultJdoDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/DefaultJdoDialect.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoAccessor.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoAccessor.java index d747628b8231..c9d90a9c2c0f 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoAccessor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoDialect.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoDialect.java index 91120706ff3c..7d3e3b63c80c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoDialect.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoInterceptor.java index 1a3c51d78990..e75500542fa2 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoOperations.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoOperations.java index 57354e29a46c..9d40de5ec9f9 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoOperations.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoOperations.java @@ -79,7 +79,7 @@ public interface JdoOperations { * @return a Collection result returned by the action, or null * @throws org.springframework.dao.DataAccessException in case of JDO errors */ - Collection executeFind(JdoCallback action) throws DataAccessException; + Collection executeFind(JdoCallback action) throws DataAccessException; //------------------------------------------------------------------------- @@ -131,7 +131,7 @@ public interface JdoOperations { * @throws org.springframework.dao.DataAccessException in case of JDO errors * @see javax.jdo.PersistenceManager#evictAll(java.util.Collection) */ - void evictAll(Collection entities) throws DataAccessException; + void evictAll(Collection entities) throws DataAccessException; /** * Remove all objects from the PersistenceManager cache. @@ -154,7 +154,7 @@ public interface JdoOperations { * @throws org.springframework.dao.DataAccessException in case of JDO errors * @see javax.jdo.PersistenceManager#refreshAll(java.util.Collection) */ - void refreshAll(Collection entities) throws DataAccessException; + void refreshAll(Collection entities) throws DataAccessException; /** * Re-read the state of all persistent instances. @@ -199,7 +199,7 @@ public interface JdoOperations { * @throws org.springframework.dao.DataAccessException in case of JDO errors * @see javax.jdo.PersistenceManager#deletePersistentAll(java.util.Collection) */ - void deletePersistentAll(Collection entities) throws DataAccessException; + void deletePersistentAll(Collection entities) throws DataAccessException; /** * Detach a copy of the given persistent instance from the current JDO transaction, @@ -351,7 +351,7 @@ Collection find( * @see javax.jdo.Query#JDOQL * @see javax.jdo.Query#SQL */ - Collection find(String language, Object queryObject) throws DataAccessException; + Collection find(String language, Object queryObject) throws DataAccessException; /** * Find persistent instances through the given single-string JDOQL query. @@ -360,7 +360,7 @@ Collection find( * @throws org.springframework.dao.DataAccessException in case of JDO errors * @see javax.jdo.PersistenceManager#newQuery(String) */ - Collection find(String queryString) throws DataAccessException; + Collection find(String queryString) throws DataAccessException; /** * Find persistent instances through the given single-string JDOQL query. @@ -370,7 +370,7 @@ Collection find( * @throws org.springframework.dao.DataAccessException in case of JDO errors * @see javax.jdo.PersistenceManager#newQuery(String) */ - Collection find(String queryString, Object... values) throws DataAccessException; + Collection find(String queryString, Object... values) throws DataAccessException; /** * Find persistent instances through the given single-string JDOQL query. @@ -380,7 +380,7 @@ Collection find( * @throws org.springframework.dao.DataAccessException in case of JDO errors * @see javax.jdo.PersistenceManager#newQuery(String) */ - Collection find(String queryString, Map values) throws DataAccessException; + Collection find(String queryString, Map values) throws DataAccessException; /** * Find persistent instances through the given named query. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoSystemException.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoSystemException.java index 088b80a0b37e..6d193d463fe8 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoSystemException.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoSystemException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,5 +34,5 @@ public class JdoSystemException extends UncategorizedDataAccessException { public JdoSystemException(JDOException ex) { super(ex.getMessage(), ex); } - + } diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java index 0f25a17d63bc..be6aebb6bb14 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -179,13 +179,14 @@ public T execute(JdoCallback action) throws DataAccessException { return execute(action, isExposeNativePersistenceManager()); } - public Collection executeFind(JdoCallback action) throws DataAccessException { + @SuppressWarnings("unchecked") + public Collection executeFind(JdoCallback action) throws DataAccessException { Object result = execute(action, isExposeNativePersistenceManager()); if (result != null && !(result instanceof Collection)) { throw new InvalidDataAccessApiUsageException( "Result object returned from JdoCallback isn't a Collection: [" + result + "]"); } - return (Collection) result; + return (Collection) result; } /** @@ -235,7 +236,7 @@ public T execute(JdoCallback action, boolean exposeNativePersistenceManag * @see #prepareQuery */ protected PersistenceManager createPersistenceManagerProxy(PersistenceManager pm) { - Class[] ifcs = ClassUtils.getAllInterfacesForClass(pm.getClass(), getClass().getClassLoader()); + Class[] ifcs = ClassUtils.getAllInterfacesForClass(pm.getClass(), getClass().getClassLoader()); return (PersistenceManager) Proxy.newProxyInstance( pm.getClass().getClassLoader(), ifcs, new CloseSuppressingInvocationHandler(pm)); } @@ -287,7 +288,7 @@ public Object doInJdo(PersistenceManager pm) throws JDOException { }, true); } - public void evictAll(final Collection entities) throws DataAccessException { + public void evictAll(final Collection entities) throws DataAccessException { execute(new JdoCallback() { public Object doInJdo(PersistenceManager pm) throws JDOException { pm.evictAll(entities); @@ -314,7 +315,7 @@ public Object doInJdo(PersistenceManager pm) throws JDOException { }, true); } - public void refreshAll(final Collection entities) throws DataAccessException { + public void refreshAll(final Collection entities) throws DataAccessException { execute(new JdoCallback() { public Object doInJdo(PersistenceManager pm) throws JDOException { pm.refreshAll(entities); @@ -357,7 +358,7 @@ public Object doInJdo(PersistenceManager pm) throws JDOException { }, true); } - public void deletePersistentAll(final Collection entities) throws DataAccessException { + public void deletePersistentAll(final Collection entities) throws DataAccessException { execute(new JdoCallback() { public Object doInJdo(PersistenceManager pm) throws JDOException { pm.deletePersistentAll(entities); @@ -469,43 +470,46 @@ public Collection doInJdo(PersistenceManager pm) throws JDOException { }, true); } - public Collection find(final String language, final Object queryObject) throws DataAccessException { - return execute(new JdoCallback() { - public Collection doInJdo(PersistenceManager pm) throws JDOException { + public Collection find(final String language, final Object queryObject) throws DataAccessException { + return execute(new JdoCallback>() { + @SuppressWarnings("unchecked") + public Collection doInJdo(PersistenceManager pm) throws JDOException { Query query = pm.newQuery(language, queryObject); prepareQuery(query); - return (Collection) query.execute(); + return (Collection) query.execute(); } }, true); } - public Collection find(final String queryString) throws DataAccessException { - return execute(new JdoCallback() { + public Collection find(final String queryString) throws DataAccessException { + return execute(new JdoCallback>() { @SuppressWarnings("unchecked") - public Collection doInJdo(PersistenceManager pm) throws JDOException { + public Collection doInJdo(PersistenceManager pm) throws JDOException { Query query = pm.newQuery(queryString); prepareQuery(query); - return (Collection) query.execute(); + return (Collection) query.execute(); } }, true); } - public Collection find(final String queryString, final Object... values) throws DataAccessException { - return execute(new JdoCallback() { - public Collection doInJdo(PersistenceManager pm) throws JDOException { + public Collection find(final String queryString, final Object... values) throws DataAccessException { + return execute(new JdoCallback>() { + @SuppressWarnings("unchecked") + public Collection doInJdo(PersistenceManager pm) throws JDOException { Query query = pm.newQuery(queryString); prepareQuery(query); - return (Collection) query.executeWithArray(values); + return (Collection) query.executeWithArray(values); } }, true); } - public Collection find(final String queryString, final Map values) throws DataAccessException { - return execute(new JdoCallback() { - public Collection doInJdo(PersistenceManager pm) throws JDOException { + public Collection find(final String queryString, final Map values) throws DataAccessException { + return execute(new JdoCallback>() { + @SuppressWarnings("unchecked") + public Collection doInJdo(PersistenceManager pm) throws JDOException { Query query = pm.newQuery(queryString); prepareQuery(query); - return (Collection) query.executeWithMap(values); + return (Collection) query.executeWithMap(values); } }, true); } diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoUsageException.java b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoUsageException.java index b4c444191060..c7114178f61a 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/JdoUsageException.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/JdoUsageException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryBean.java index 09ce80a2dd5a..dcee552523b3 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -267,7 +267,7 @@ protected PersistenceManagerFactory newPersistenceManagerFactory(String name) { * @return the PersistenceManagerFactory instance * @see javax.jdo.JDOHelper#getPersistenceManagerFactory(java.util.Map) */ - protected PersistenceManagerFactory newPersistenceManagerFactory(Map props) { + protected PersistenceManagerFactory newPersistenceManagerFactory(Map props) { return JDOHelper.getPersistenceManagerFactory(props, this.beanClassLoader); } diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/PersistenceManagerFactoryUtils.java b/spring-orm/src/main/java/org/springframework/orm/jdo/PersistenceManagerFactoryUtils.java index b6983a4c5c11..19d6a80a2366 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/PersistenceManagerFactoryUtils.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/PersistenceManagerFactoryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/TransactionAwarePersistenceManagerFactoryProxy.java b/spring-orm/src/main/java/org/springframework/orm/jdo/TransactionAwarePersistenceManagerFactoryProxy.java index a01ba2f117d5..e0efe17c258c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/TransactionAwarePersistenceManagerFactoryProxy.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/TransactionAwarePersistenceManagerFactoryProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public class TransactionAwarePersistenceManagerFactoryProxy implements FactoryBe public void setTargetPersistenceManagerFactory(PersistenceManagerFactory target) { Assert.notNull(target, "Target PersistenceManagerFactory must not be null"); this.target = target; - Class[] ifcs = ClassUtils.getAllInterfacesForClass(target.getClass(), target.getClass().getClassLoader()); + Class[] ifcs = ClassUtils.getAllInterfacesForClass(target.getClass(), target.getClass().getClassLoader()); this.proxy = (PersistenceManagerFactory) Proxy.newProxyInstance( target.getClass().getClassLoader(), ifcs, new PersistenceManagerFactoryInvocationHandler()); } @@ -157,7 +157,7 @@ else if (method.getName().equals("getPersistenceManager")) { PersistenceManagerFactory target = getTargetPersistenceManagerFactory(); PersistenceManager pm = PersistenceManagerFactoryUtils.doGetPersistenceManager(target, isAllowCreate()); - Class[] ifcs = ClassUtils.getAllInterfacesForClass(pm.getClass(), pm.getClass().getClassLoader()); + Class[] ifcs = ClassUtils.getAllInterfacesForClass(pm.getClass(), pm.getClass().getClassLoader()); return Proxy.newProxyInstance( pm.getClass().getClassLoader(), ifcs, new PersistenceManagerInvocationHandler(pm, target)); } diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewInterceptor.java index 021b2721522b..6e7ad31b238c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/support/SpringPersistenceManagerProxyBean.java b/spring-orm/src/main/java/org/springframework/orm/jdo/support/SpringPersistenceManagerProxyBean.java index a27a1c7f2b14..4d2941d08dd5 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/support/SpringPersistenceManagerProxyBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/support/SpringPersistenceManagerProxyBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java index 46f9e167a95e..0d7ba706d068 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -331,7 +331,7 @@ public final void afterPropertiesSet() throws PersistenceException { * @return proxy entity manager */ protected EntityManagerFactory createEntityManagerFactoryProxy(EntityManagerFactory emf) { - Set ifcs = new LinkedHashSet(); + Set> ifcs = new LinkedHashSet>(); if (this.entityManagerFactoryInterface != null) { ifcs.add(this.entityManagerFactoryInterface); } @@ -509,7 +509,7 @@ else if (method.getName().equals("hashCode")) { } else if (method.getName().equals("unwrap")) { // Handle JPA 2.1 unwrap method - could be a proxy match. - Class targetClass = (Class) args[0]; + Class targetClass = (Class) args[0]; if (targetClass == null || targetClass.isInstance(proxy)) { return proxy; } diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryAccessor.java b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryAccessor.java index 005b6c1c6a19..5acec13ae526 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryAccessor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryInfo.java b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryInfo.java index a9d3fc267053..140d1fef0b3c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryInfo.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryInfo.java @@ -33,7 +33,7 @@ * @since 2.0 */ public interface EntityManagerFactoryInfo { - + /** * Return the raw underlying EntityManagerFactory. * @return the unadorned EntityManagerFactory (never null) @@ -59,7 +59,7 @@ public interface EntityManagerFactoryInfo { PersistenceUnitInfo getPersistenceUnitInfo(); /** - * Return the name of the persistence unit used to create this + * Return the name of the persistence unit used to create this * EntityManagerFactory, or null if it is an unnamed default. *

      If getPersistenceUnitInfo() returns non-null, the result of * getPersistenceUnitName() must be equal to the value returned by diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java index 8ed9ed0718fb..1db1ec11838d 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java @@ -140,7 +140,7 @@ public static EntityManager getTransactionalEntityManager(EntityManagerFactory e * @throws DataAccessResourceFailureException if the EntityManager couldn't be obtained * @see JpaTransactionManager */ - public static EntityManager getTransactionalEntityManager(EntityManagerFactory emf, Map properties) + public static EntityManager getTransactionalEntityManager(EntityManagerFactory emf, Map properties) throws DataAccessResourceFailureException { try { return doGetTransactionalEntityManager(emf, properties); @@ -164,7 +164,7 @@ public static EntityManager getTransactionalEntityManager(EntityManagerFactory e * @see JpaTransactionManager */ public static EntityManager doGetTransactionalEntityManager( - EntityManagerFactory emf, Map properties) throws PersistenceException { + EntityManagerFactory emf, Map properties) throws PersistenceException { Assert.notNull(emf, "No EntityManagerFactory specified"); @@ -317,11 +317,11 @@ public static DataAccessException convertJpaAccessExceptionIfPossible(RuntimeExc if (ex instanceof PersistenceException) { return new JpaSystemException((PersistenceException) ex); } - + // If we get here, we have an exception that resulted from user code, // rather than the persistence provider, so we return null to indicate // that translation should not occur. - return null; + return null; } /** diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/ExtendedEntityManagerCreator.java b/spring-orm/src/main/java/org/springframework/orm/jpa/ExtendedEntityManagerCreator.java index eb5109f9b319..e703d69df91c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/ExtendedEntityManagerCreator.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/ExtendedEntityManagerCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -189,7 +189,7 @@ public static EntityManager createContainerManagedEntityManager(EntityManagerFac * in any managed transaction * @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map) */ - public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf, Map properties) { + public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf, Map properties) { Assert.notNull(emf, "EntityManagerFactory must not be null"); if (emf instanceof EntityManagerFactoryInfo) { EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf; @@ -250,7 +250,7 @@ private static EntityManager createProxy( Boolean jta, boolean containerManaged) { Assert.notNull(rawEm, "EntityManager must not be null"); - Set ifcs = new LinkedHashSet(); + Set> ifcs = new LinkedHashSet>(); if (emIfc != null) { ifcs.add(emIfc); } @@ -325,7 +325,7 @@ else if (method.getName().equals("getTargetEntityManager")) { } else if (method.getName().equals("unwrap")) { // Handle JPA 2.0 unwrap method - could be a proxy match. - Class targetClass = (Class) args[0]; + Class targetClass = (Class) args[0]; if (targetClass == null || targetClass.isInstance(proxy)) { return proxy; } diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java index b3802f055914..0d0562dbd6fc 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java @@ -32,7 +32,7 @@ * does not offer, such as access to the underlying JDBC Connection. This * strategy is mainly intended for standalone usage of a JPA provider; most * of its functionality is not relevant when running with JTA transactions. - * + * *

      Also allows for the provision of value-added methods for portable yet * more capable EntityManager and EntityManagerFactory subinterfaces offered * by Spring. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaInterceptor.java index 3d5c3a62e7f9..b13eda42be46 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaOperations.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaOperations.java index 1d7de7954b6d..8f4cbe0739b2 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaOperations.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ public interface JpaOperations { T execute(JpaCallback action) throws DataAccessException; - List executeFind(JpaCallback action) throws DataAccessException; + List executeFind(JpaCallback action) throws DataAccessException; T find(Class entityClass, Object id) throws DataAccessException; @@ -73,16 +73,16 @@ public interface JpaOperations { void flush() throws DataAccessException; - List find(String queryString) throws DataAccessException; + List find(String queryString) throws DataAccessException; - List find(String queryString, Object... values) throws DataAccessException; + List find(String queryString, Object... values) throws DataAccessException; - List findByNamedParams(String queryString, Map params) throws DataAccessException; + List findByNamedParams(String queryString, Map params) throws DataAccessException; - List findByNamedQuery(String queryName) throws DataAccessException; + List findByNamedQuery(String queryName) throws DataAccessException; - List findByNamedQuery(String queryName, Object... values) throws DataAccessException; + List findByNamedQuery(String queryName, Object... values) throws DataAccessException; - List findByNamedQueryAndNamedParams(String queryName, Map params) throws DataAccessException; + List findByNamedQueryAndNamedParams(String queryName, Map params) throws DataAccessException; } diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaSystemException.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaSystemException.java index 710ab144c830..362374a6b5b4 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaSystemException.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaSystemException.java @@ -34,5 +34,5 @@ public class JpaSystemException extends UncategorizedDataAccessException { public JpaSystemException(PersistenceException ex) { super(ex.getMessage(), ex); } - + } diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTemplate.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTemplate.java index a0422e1972db..bacc4df12f79 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,13 +150,14 @@ public T execute(JpaCallback action) throws DataAccessException { return execute(action, isExposeNativeEntityManager()); } - public List executeFind(JpaCallback action) throws DataAccessException { + @SuppressWarnings("unchecked") + public List executeFind(JpaCallback action) throws DataAccessException { Object result = execute(action, isExposeNativeEntityManager()); if (!(result instanceof List)) { throw new InvalidDataAccessApiUsageException( "Result object returned from JpaCallback isn't a List: [" + result + "]"); } - return (List) result; + return (List) result; } /** @@ -209,10 +210,10 @@ public T execute(JpaCallback action, boolean exposeNativeEntityManager) t * @see javax.persistence.EntityManager#close */ protected EntityManager createEntityManagerProxy(EntityManager em) { - Class[] ifcs = null; + Class[] ifcs = null; EntityManagerFactory emf = getEntityManagerFactory(); if (emf instanceof EntityManagerFactoryInfo) { - Class entityManagerInterface = ((EntityManagerFactoryInfo) emf).getEntityManagerInterface(); + Class entityManagerInterface = ((EntityManagerFactoryInfo) emf).getEntityManagerInterface(); if (entityManagerInterface != null) { ifcs = new Class[] {entityManagerInterface}; } @@ -302,13 +303,14 @@ public Object doInJpa(EntityManager em) throws PersistenceException { // Convenience finder methods //------------------------------------------------------------------------- - public List find(String queryString) throws DataAccessException { + public List find(String queryString) throws DataAccessException { return find(queryString, (Object[]) null); } - public List find(final String queryString, final Object... values) throws DataAccessException { - return execute(new JpaCallback() { - public List doInJpa(EntityManager em) throws PersistenceException { + public List find(final String queryString, final Object... values) throws DataAccessException { + return execute(new JpaCallback>() { + @SuppressWarnings("unchecked") + public List doInJpa(EntityManager em) throws PersistenceException { Query queryObject = em.createQuery(queryString); prepareQuery(queryObject); if (values != null) { @@ -321,9 +323,10 @@ public List doInJpa(EntityManager em) throws PersistenceException { }); } - public List findByNamedParams(final String queryString, final Map params) throws DataAccessException { - return execute(new JpaCallback() { - public List doInJpa(EntityManager em) throws PersistenceException { + public List findByNamedParams(final String queryString, final Map params) throws DataAccessException { + return execute(new JpaCallback>() { + @SuppressWarnings("unchecked") + public List doInJpa(EntityManager em) throws PersistenceException { Query queryObject = em.createQuery(queryString); prepareQuery(queryObject); if (params != null) { @@ -336,13 +339,14 @@ public List doInJpa(EntityManager em) throws PersistenceException { }); } - public List findByNamedQuery(String queryName) throws DataAccessException { + public List findByNamedQuery(String queryName) throws DataAccessException { return findByNamedQuery(queryName, (Object[]) null); } - public List findByNamedQuery(final String queryName, final Object... values) throws DataAccessException { - return execute(new JpaCallback() { - public List doInJpa(EntityManager em) throws PersistenceException { + public List findByNamedQuery(final String queryName, final Object... values) throws DataAccessException { + return execute(new JpaCallback>() { + @SuppressWarnings("unchecked") + public List doInJpa(EntityManager em) throws PersistenceException { Query queryObject = em.createNamedQuery(queryName); prepareQuery(queryObject); if (values != null) { @@ -355,11 +359,12 @@ public List doInJpa(EntityManager em) throws PersistenceException { }); } - public List findByNamedQueryAndNamedParams(final String queryName, final Map params) + public List findByNamedQueryAndNamedParams(final String queryName, final Map params) throws DataAccessException { - return execute(new JpaCallback() { - public List doInJpa(EntityManager em) throws PersistenceException { + return execute(new JpaCallback>() { + @SuppressWarnings("unchecked") + public List doInJpa(EntityManager em) throws PersistenceException { Query queryObject = em.createNamedQuery(queryName); prepareQuery(queryObject); if (params != null) { diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java index efd2ef1a6493..bae6e6509284 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java b/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java index b6e03c619e38..67724053adf8 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,11 +74,11 @@ public static EntityManager createSharedEntityManager(EntityManagerFactory emf) * createEntityManager call (may be null) * @return a shareable transaction EntityManager proxy */ - public static EntityManager createSharedEntityManager(EntityManagerFactory emf, Map properties) { - Class[] emIfcs; + public static EntityManager createSharedEntityManager(EntityManagerFactory emf, Map properties) { + Class[] emIfcs; if (emf instanceof EntityManagerFactoryInfo) { EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf; - Class emIfc = emfInfo.getEntityManagerInterface(); + Class emIfc = emfInfo.getEntityManagerInterface(); if (emIfc == null) { emIfc = EntityManager.class; } @@ -106,13 +106,13 @@ public static EntityManager createSharedEntityManager(EntityManagerFactory emf, * @return a shareable transactional EntityManager proxy */ public static EntityManager createSharedEntityManager( - EntityManagerFactory emf, Map properties, Class... entityManagerInterfaces) { + EntityManagerFactory emf, Map properties, Class... entityManagerInterfaces) { ClassLoader cl = null; if (emf instanceof EntityManagerFactoryInfo) { cl = ((EntityManagerFactoryInfo) emf).getBeanClassLoader(); } - Class[] ifcs = new Class[entityManagerInterfaces.length + 1]; + Class[] ifcs = new Class[entityManagerInterfaces.length + 1]; System.arraycopy(entityManagerInterfaces, 0, ifcs, 0, entityManagerInterfaces.length); ifcs[entityManagerInterfaces.length] = EntityManagerProxy.class; return (EntityManager) Proxy.newProxyInstance( @@ -132,11 +132,11 @@ private static class SharedEntityManagerInvocationHandler implements InvocationH private final EntityManagerFactory targetFactory; - private final Map properties; + private final Map properties; private transient volatile ClassLoader proxyClassLoader; - public SharedEntityManagerInvocationHandler(EntityManagerFactory target, Map properties) { + public SharedEntityManagerInvocationHandler(EntityManagerFactory target, Map properties) { this.targetFactory = target; this.properties = properties; initProxyClassLoader(); @@ -181,7 +181,7 @@ else if (method.getName().equals("getCriteriaBuilder") || method.getName().equal } else if (method.getName().equals("unwrap")) { // JPA 2.0: handle unwrap method - could be a proxy match. - Class targetClass = (Class) args[0]; + Class targetClass = (Class) args[0]; if (targetClass == null || targetClass.isInstance(proxy)) { return proxy; } @@ -241,7 +241,7 @@ else if (method.getName().equals("unwrap")) { if (result instanceof Query) { Query query = (Query) result; if (isNewEm) { - Class[] ifcs = ClassUtils.getAllInterfacesForClass(query.getClass(), this.proxyClassLoader); + Class[] ifcs = ClassUtils.getAllInterfacesForClass(query.getClass(), this.proxyClassLoader); result = Proxy.newProxyInstance(this.proxyClassLoader, ifcs, new DeferredQueryInvocationHandler(query, target)); isNewEm = false; @@ -299,7 +299,7 @@ else if (method.getName().equals("hashCode")) { } else if (method.getName().equals("unwrap")) { // Handle JPA 2.0 unwrap method - could be a proxy match. - Class targetClass = (Class) args[0]; + Class targetClass = (Class) args[0]; if (targetClass == null || targetClass.isInstance(proxy)) { return proxy; } diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/ClassFileTransformerAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/ClassFileTransformerAdapter.java index 7402618f12d1..b4350bcffb44 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/ClassFileTransformerAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/ClassFileTransformerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ * @see javax.persistence.spi.PersistenceUnitInfo#addTransformer(javax.persistence.spi.ClassTransformer) */ class ClassFileTransformerAdapter implements ClassFileTransformer { - + private static final Log logger = LogFactory.getLog(ClassFileTransformerAdapter.class); private final ClassTransformer classTransformer; @@ -51,7 +51,7 @@ public ClassFileTransformerAdapter(ClassTransformer classTransformer) { public byte[] transform( ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { - + try { byte[] transformed = this.classTransformer.transform( loader, className, classBeingRedefined, protectionDomain, classfileBuffer); diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java index 728e5f832bf5..aa1fab293b67 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/DefaultPersistenceUnitManager.java @@ -584,17 +584,19 @@ private static class Jpa2PersistenceUnitInfoDecorator implements InvocationHandl private final SpringPersistenceUnitInfo target; + @SuppressWarnings("rawtypes") private final Class sharedCacheModeEnum; + @SuppressWarnings("rawtypes") private final Class validationModeEnum; @SuppressWarnings("unchecked") public Jpa2PersistenceUnitInfoDecorator(SpringPersistenceUnitInfo target) { this.target = target; try { - this.sharedCacheModeEnum = (Class) + this.sharedCacheModeEnum = (Class>) ClassUtils.forName("javax.persistence.SharedCacheMode", PersistenceUnitInfo.class.getClassLoader()); - this.validationModeEnum = (Class) + this.validationModeEnum = (Class>) ClassUtils.forName("javax.persistence.ValidationMode", PersistenceUnitInfo.class.getClassLoader()); } catch (Exception ex) { @@ -606,6 +608,7 @@ public final SpringPersistenceUnitInfo getTarget() { return this.target; } + @SuppressWarnings("unchecked") public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("getSharedCacheMode")) { return Enum.valueOf(this.sharedCacheModeEnum, this.target.getSharedCacheModeName()); diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/MutablePersistenceUnitInfo.java b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/MutablePersistenceUnitInfo.java index dd2da772a925..423af5f0261d 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/MutablePersistenceUnitInfo.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/MutablePersistenceUnitInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceUnitReader.java b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceUnitReader.java index d823e45c53f9..fb6ff707806a 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceUnitReader.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/PersistenceUnitReader.java @@ -293,8 +293,7 @@ protected SpringPersistenceUnitInfo parsePersistenceUnitInfo(Element persistence /** * Parse the property XML elements. */ - @SuppressWarnings("unchecked") - protected void parseProperties(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { + protected void parseProperty(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { Element propRoot = DomUtils.getChildElementByTagName(persistenceUnit, PROPERTIES); if (propRoot == null) { return; @@ -310,8 +309,7 @@ protected void parseProperties(Element persistenceUnit, SpringPersistenceUnitInf /** * Parse the class XML elements. */ - @SuppressWarnings("unchecked") - protected void parseManagedClasses(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { + protected void parseClass(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { List classes = DomUtils.getChildElementsByTagName(persistenceUnit, MANAGED_CLASS_NAME); for (Element element : classes) { String value = DomUtils.getTextValue(element).trim(); @@ -323,10 +321,9 @@ protected void parseManagedClasses(Element persistenceUnit, SpringPersistenceUni /** * Parse the mapping-file XML elements. */ - @SuppressWarnings("unchecked") - protected void parseMappingFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { - List files = DomUtils.getChildElementsByTagName(persistenceUnit, MAPPING_FILE_NAME); - for (Element element : files) { + protected void parseJarFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) throws IOException { + List jars = DomUtils.getChildElementsByTagName(persistenceUnit, JAR_FILE_URL); + for (Element element : jars) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) { unitInfo.addMappingFileName(value); @@ -337,10 +334,9 @@ protected void parseMappingFiles(Element persistenceUnit, SpringPersistenceUnitI /** * Parse the jar-file XML elements. */ - @SuppressWarnings("unchecked") - protected void parseJarFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) throws IOException { - List jars = DomUtils.getChildElementsByTagName(persistenceUnit, JAR_FILE_URL); - for (Element element : jars) { + protected void parseMappingFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { + List files = DomUtils.getChildElementsByTagName(persistenceUnit, MAPPING_FILE_NAME); + for (Element element : files) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) { Resource[] resources = this.resourcePatternResolver.getResources(value); diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/support/SharedEntityManagerBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/support/SharedEntityManagerBean.java index 72e483997f1e..0e150e338aaa 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/support/SharedEntityManagerBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/support/SharedEntityManagerBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ public final void afterPropertiesSet() { if (emf == null) { throw new IllegalArgumentException("'entityManagerFactory' or 'persistenceUnitName' is required"); } - Class[] ifcs = null; + Class[] ifcs = null; if (emf instanceof EntityManagerFactoryInfo) { EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf; if (this.entityManagerInterface == null) { diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/AbstractJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/AbstractJpaVendorAdapter.java index 400d9d5ffcbf..264b6d2bf771 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/AbstractJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/AbstractJpaVendorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/Database.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/Database.java index 053acca358b6..7b7c4643d95f 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/Database.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/Database.java @@ -49,7 +49,7 @@ public enum Database { ORACLE, - POSTGRESQL, + POSTGRESQL, SQL_SERVER, diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java index fcc3afd86ecf..e16c82bed3dd 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ * Thanks to Mike Keith for the original EclipseLink support prototype! * *

      NOTE: No need to filter out classes from the JPA providers package for - * EclipseLink (see SPR-6040) + * EclipseLink (see SPR-6040) * * @author Juergen Hoeller * @author Thomas Risberg diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java index c3cda31f4464..066d9eb1d5fa 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaSessionFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaSessionFactoryBean.java index a1584090ab17..aa4afc875f88 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaSessionFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java index e1e396ada22a..815d77543b14 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public Map getJpaPropertyMap() { jpaProperties.put(Environment.DIALECT, getDatabasePlatform()); } else if (getDatabase() != null) { - Class databaseDialectClass = determineDatabaseDialectClass(getDatabase()); + Class databaseDialectClass = determineDatabaseDialectClass(getDatabase()); if (databaseDialectClass != null) { jpaProperties.put(Environment.DIALECT, databaseDialectClass.getName()); } @@ -97,7 +97,7 @@ else if (getDatabase() != null) { * @param database the target database * @return the Hibernate database dialect class, or null if none found */ - protected Class determineDatabaseDialectClass(Database database) { + protected Class determineDatabaseDialectClass(Database database) { switch (database) { case DB2: return DB2Dialect.class; case DERBY: return DerbyDialect.class; diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java index c6ba980f127b..cf4b68e96588 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaDialect.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java index cc3a7d79d37e..9093c04956f4 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.java index 89b9141b93af..bbaef3c3d0f2 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.java @@ -54,7 +54,7 @@ */ @Deprecated public class TopLinkJpaDialect extends DefaultJpaDialect { - + private boolean lazyDatabaseTransaction = false; diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.java index 573b0a85bfff..c8f64796734b 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/beans/Colour.java b/spring-orm/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..4db722187d9d 100644 --- a/spring-orm/src/test/java/org/springframework/beans/Colour.java +++ b/spring-orm/src/test/java/org/springframework/beans/Colour.java @@ -32,4 +32,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-orm/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-orm/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-orm/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/beans/IOther.java b/spring-orm/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-orm/src/test/java/org/springframework/beans/IOther.java +++ b/spring-orm/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/beans/ITestBean.java b/spring-orm/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-orm/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-orm/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-orm/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..4f3012666eac 100644 --- a/spring-orm/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-orm/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-orm/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-orm/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-orm/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/beans/TestBean.java b/spring-orm/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..4cd145c9bb7e 100644 --- a/spring-orm/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-orm/src/test/java/org/springframework/beans/TestBean.java @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-orm/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-orm/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java index 28670fd43837..3dd9166cb526 100644 --- a/spring-orm/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java +++ b/spring-orm/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import javax.naming.NamingException; -import org.springframework.core.CollectionFactory; import org.springframework.jndi.JndiTemplate; /** diff --git a/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java index b6489e42029f..fd67ca3d5d0d 100644 --- a/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ b/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java index 8b816b45d0d6..e3084b889585 100644 --- a/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ b/spring-orm/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ * DataSource ds = new DriverManagerDataSource(...); * builder.bind("java:comp/env/jdbc/myds", ds); * builder.activate(); - * + * * Note that it's impossible to activate multiple builders within the same JVM, * due to JNDI restrictions. Thus to configure a fresh builder repeatedly, use * the following code to get a reference to either an already activated builder diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateInterceptorTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateInterceptorTests.java index e957562d6dd0..598671a47de8 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateInterceptorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateJtaTransactionTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateJtaTransactionTests.java index 76f05bbf687b..a3376b80e119 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateJtaTransactionTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateJtaTransactionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,6 @@ import org.hibernate.classic.Session; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionImplementor; -import org.junit.Ignore; import org.junit.Test; import org.springframework.dao.DataAccessException; import org.springframework.transaction.MockJtaTransaction; diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java index 9dcb05b7f664..ebd68398c540 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTransactionManagerTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTransactionManagerTests.java index 81a4bf6ea469..818092684844 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTransactionManagerTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1024,7 +1024,7 @@ public void testTransactionCommitWithEntityInterceptorBeanName() throws Exceptio beanFactory.getBean("entityInterceptor", Interceptor.class); beanFactoryControl.setReturnValue(entityInterceptor2, 1); beanFactoryControl.replay(); - + HibernateTransactionManager tm = new HibernateTransactionManager(sf); tm.setEntityInterceptorBeanName("entityInterceptor"); tm.setBeanFactory(beanFactory); diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java index 25ba32f690ff..d5aeca6b59ba 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/HibernateDaoSupportTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/HibernateDaoSupportTests.java index b6d0e0e1df82..2087316e32de 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/HibernateDaoSupportTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/HibernateDaoSupportTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/LobTypeTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/LobTypeTests.java index 3be8ba5f8583..60784145b4f6 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/LobTypeTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/LobTypeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptorTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptorTests.java index 4d74833ab975..c884a39fa4ba 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/ScopedBeanInterceptorTests.java @@ -32,7 +32,7 @@ public void testInterceptorWithPlainObject() throws Exception { ScopedObject scoped = new ScopedObject() { public Object getTargetObject() { - return realObject; + return realObject; } public void removeFromScope() { // do nothing diff --git a/spring-orm/src/test/java/org/springframework/orm/ibatis/SqlMapClientTests.java b/spring-orm/src/test/java/org/springframework/orm/ibatis/SqlMapClientTests.java index c2f9c63ff935..ca934f43bd90 100644 --- a/spring-orm/src/test/java/org/springframework/orm/ibatis/SqlMapClientTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/ibatis/SqlMapClientTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/ibatis/support/LobTypeHandlerTests.java b/spring-orm/src/test/java/org/springframework/orm/ibatis/support/LobTypeHandlerTests.java index 6732ddcd5487..5675728887b0 100644 --- a/spring-orm/src/test/java/org/springframework/orm/ibatis/support/LobTypeHandlerTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/ibatis/support/LobTypeHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java index 46093da105eb..a07a672b09f5 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoInterceptorTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTemplateTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTemplateTests.java index 5ac6d360421c..33a38ffbb73b 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTemplateTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTransactionManagerTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTransactionManagerTests.java index 204d4e1b31d4..878de1d91d6e 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTransactionManagerTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/JdoTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryTests.java index 5ad9c14d397b..a8965fa87f1d 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/LocalPersistenceManagerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/support/JdoDaoSupportTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/support/JdoDaoSupportTests.java index 89b3987b1116..c3764bd9f2b7 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/support/JdoDaoSupportTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/support/JdoDaoSupportTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-orm/src/test/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewTests.java b/spring-orm/src/test/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewTests.java index cbfd34748a95..133e08311eb7 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewTests.java @@ -43,7 +43,7 @@ * @since 15.06.2004 */ public class OpenPersistenceManagerInViewTests extends TestCase { - + public void testOpenPersistenceManagerInViewInterceptor() throws Exception { MockControl pmfControl = MockControl.createControl(PersistenceManagerFactory.class); PersistenceManagerFactory pmf = (PersistenceManagerFactory) pmfControl.getMock(); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java index e53c4a1fadaf..aac1b766beff 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests @NotTransactional public void testEntityManagerFactoryImplementsEntityManagerFactoryInfo() { assertTrue(Proxy.isProxyClass(entityManagerFactory.getClass())); - assertTrue("Must have introduced config interface", + assertTrue("Must have introduced config interface", entityManagerFactory instanceof EntityManagerFactoryInfo); EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory; //assertEquals("Person", emfi.getPersistenceUnitName()); @@ -79,7 +79,7 @@ public void testEntityManagerProxyIsProxy() { assertTrue(Proxy.isProxyClass(sharedEntityManager.getClass())); Query q = sharedEntityManager.createQuery("select p from Person as p"); List people = q.getResultList(); - + assertTrue("Should be open to start with", sharedEntityManager.isOpen()); sharedEntityManager.close(); assertTrue("Close should have been silently ignored", sharedEntityManager.isOpen()); @@ -96,8 +96,8 @@ public void testBogusQuery() { public void testGetReferenceWhenNoRow() { // Fails here with TopLink Person notThere = sharedEntityManager.getReference(Person.class, 666); - - // We may get here (as with Hibernate). + + // We may get here (as with Hibernate). // Either behaviour is valid: throw exception on first access // or on getReference itself. notThere.getFirstName(); @@ -112,15 +112,15 @@ public void testLazyLoading() { sharedEntityManager.persist(tony); setComplete(); endTransaction(); - + startNewTransaction(); sharedEntityManager.clear(); Person newTony = entityManagerFactory.createEntityManager().getReference(Person.class, tony.getId()); assertNotSame(newTony, tony); endTransaction(); - + assertNotNull(newTony.getDriversLicense()); - + newTony.getDriversLicense().getSerialNumber(); } finally { @@ -128,17 +128,17 @@ public void testLazyLoading() { //setComplete(); } } - + @SuppressWarnings("unchecked") public void testMultipleResults() { // Add with JDBC String firstName = "Tony"; insertPerson(firstName); - + assertTrue(Proxy.isProxyClass(sharedEntityManager.getClass())); Query q = sharedEntityManager.createQuery("select p from Person as p"); List people = q.getResultList(); - + assertEquals(1, people.size()); assertEquals(firstName, people.get(0).getFirstName()); } @@ -147,32 +147,32 @@ protected final void insertPerson(String firstName) { String INSERT_PERSON = "INSERT INTO PERSON (ID, FIRST_NAME, LAST_NAME) VALUES (?, ?, ?)"; simpleJdbcTemplate.update(INSERT_PERSON, 1, firstName, "Blair"); } - + public void testEntityManagerProxyRejectsProgrammaticTxManagement() { try { sharedEntityManager.getTransaction(); fail("Should not be able to create transactions on container managed EntityManager"); } - catch (IllegalStateException ex) { + catch (IllegalStateException ex) { } } - + public void testSharedEntityManagerProxyRejectsProgrammaticTxJoining() { try { sharedEntityManager.joinTransaction(); fail("Should not be able to join transactions with container managed EntityManager"); } - catch (IllegalStateException ex) { + catch (IllegalStateException ex) { } } - + // public void testAspectJInjectionOfConfigurableEntity() { // Person p = new Person(); // System.err.println(p); // assertNotNull("Was injected", p.getTestBean()); // assertEquals("Ramnivas", p.getTestBean().getName()); // } - + public void testInstantiateAndSaveWithSharedEmProxy() { testInstantiateAndSave(sharedEntityManager); } @@ -183,7 +183,7 @@ protected void testInstantiateAndSave(EntityManager em) { p.setFirstName("Tony"); p.setLastName("Blair"); em.persist(p); - + em.flush(); assertEquals("1 row must have been inserted", 1, countRowsInTable("person")); } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBeanTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBeanTests.java index f4e651226766..29ead69b377f 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBeanTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ protected void tearDown() throws Exception { protected static class DummyEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean { private final EntityManagerFactory emf; - + public DummyEntityManagerFactoryBean(EntityManagerFactory emf) { this.emf = emf; } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java index d2cf740ab367..23f241e5ab10 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/ApplicationManagedEntityManagerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ import javax.persistence.Query; import javax.persistence.TransactionRequiredException; -import org.springframework.aop.support.AopUtils; import org.springframework.orm.jpa.domain.Person; import org.springframework.orm.jpa.AbstractEntityManagerFactoryIntegrationTests; import org.springframework.test.annotation.NotTransactional; @@ -37,7 +36,7 @@ * @since 2.0 */ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEntityManagerFactoryIntegrationTests { - + @NotTransactional public void testEntityManagerIsProxy() { assertTrue("EntityManagerFactory is proxied", Proxy.isProxyClass(entityManagerFactory.getClass())); @@ -49,25 +48,25 @@ public void testEntityManagerProxyIsProxy() { assertTrue(Proxy.isProxyClass(em.getClass())); Query q = em.createQuery("select p from Person as p"); List people = q.getResultList(); - + assertTrue("Should be open to start with", em.isOpen()); em.close(); assertFalse("Close should work on application managed EM", em.isOpen()); } - + public void testEntityManagerProxyAcceptsProgrammaticTxJoining() { EntityManager em = entityManagerFactory.createEntityManager(); em.joinTransaction(); } - + public void testInstantiateAndSave() { EntityManager em = entityManagerFactory.createEntityManager(); em.joinTransaction(); doInstantiateAndSave(em); } - + public void testCannotFlushWithoutGettingTransaction() { - EntityManager em = entityManagerFactory.createEntityManager(); + EntityManager em = entityManagerFactory.createEntityManager(); try { doInstantiateAndSave(em); fail("Should have thrown TransactionRequiredException"); @@ -75,7 +74,7 @@ public void testCannotFlushWithoutGettingTransaction() { catch (TransactionRequiredException ex) { // expected } - + // TODO following lines are a workaround for Hibernate bug // If Hibernate throws an exception due to flush(), // it actually HAS flushed, meaning that the database @@ -83,15 +82,15 @@ public void testCannotFlushWithoutGettingTransaction() { deleteAllPeopleUsingEntityManager(sharedEntityManager); setComplete(); } - + public void doInstantiateAndSave(EntityManager em) { testStateClean(); Person p = new Person(); - + p.setFirstName("Tony"); p.setLastName("Blair"); em.persist(p); - + em.flush(); assertEquals("1 row must have been inserted", 1, countRowsInTable("person")); } @@ -99,31 +98,31 @@ public void doInstantiateAndSave(EntityManager em) { public void testStateClean() { assertEquals("Should be no people from previous transactions", 0, countRowsInTable("person")); } - + public void testReuseInNewTransaction() { EntityManager em = entityManagerFactory.createEntityManager(); em.joinTransaction(); - + doInstantiateAndSave(em); endTransaction(); - + assertFalse(em.getTransaction().isActive()); - + startNewTransaction(); // Call any method: should cause automatic tx invocation assertFalse(em.contains(new Person())); - + assertFalse(em.getTransaction().isActive()); em.joinTransaction(); - + assertTrue(em.getTransaction().isActive()); - + doInstantiateAndSave(em); setComplete(); endTransaction(); // Should rollback assertEquals("Tx must have committed back", 1, countRowsInTable("person")); - + // Now clean up the database startNewTransaction(); em.joinTransaction(); @@ -132,7 +131,7 @@ public void testReuseInNewTransaction() { 0, countRowsInTable("person")); setComplete(); } - + public static void deleteAllPeopleUsingEntityManager(EntityManager em) { em.createQuery("delete from Person p").executeUpdate(); } @@ -145,19 +144,19 @@ public void testRollbackOccurs() { assertEquals("Tx must have been rolled back", 0, countRowsInTable("person")); } - + public void testCommitOccurs() { EntityManager em = entityManagerFactory.createEntityManager(); em.joinTransaction(); doInstantiateAndSave(em); - + setComplete(); endTransaction(); // Should rollback assertEquals("Tx must have committed back", 1, countRowsInTable("person")); - + // Now clean up the database deleteFromTables(new String[] { "person" }); } - + } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java index 22f22831e464..391a067a5801 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import javax.persistence.Query; import javax.persistence.TransactionRequiredException; -import org.springframework.aop.support.AopUtils; import org.springframework.dao.DataAccessException; import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.orm.jpa.domain.Person; @@ -33,17 +32,17 @@ /** * Integration tests using in-memory database for container-managed JPA - * + * * @author Rod Johnson * @since 2.0 */ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntityManagerFactoryIntegrationTests { - + @NotTransactional - public void testExceptionTranslationWithDialectFoundOnIntroducedEntityManagerInfo() throws Exception { + public void testExceptionTranslationWithDialectFoundOnIntroducedEntityManagerInfo() throws Exception { doTestExceptionTranslationWithDialectFound(((EntityManagerFactoryInfo) entityManagerFactory).getJpaDialect()); } - + @NotTransactional public void testExceptionTranslationWithDialectFoundOnEntityManagerFactoryBean() throws Exception { AbstractEntityManagerFactoryBean aefb = @@ -51,7 +50,7 @@ public void testExceptionTranslationWithDialectFoundOnEntityManagerFactoryBean() assertNotNull("Dialect must have been set", aefb.getJpaDialect()); doTestExceptionTranslationWithDialectFound(aefb); } - + protected void doTestExceptionTranslationWithDialectFound(PersistenceExceptionTranslator pet) throws Exception { RuntimeException in1 = new RuntimeException("in1"); PersistenceException in2 = new PersistenceException(); @@ -60,14 +59,14 @@ protected void doTestExceptionTranslationWithDialectFound(PersistenceExceptionTr assertNotNull(dex); assertSame(in2, dex.getCause()); } - + public void testEntityManagerProxyIsProxy() { EntityManager em = createContainerManagedEntityManager(); assertTrue(Proxy.isProxyClass(em.getClass())); Query q = em.createQuery("select p from Person as p"); List people = q.getResultList(); assertTrue(people.isEmpty()); - + assertTrue("Should be open to start with", em.isOpen()); try { em.close(); @@ -78,7 +77,7 @@ public void testEntityManagerProxyIsProxy() { } assertTrue(em.isOpen()); } - + // This would be legal, at least if not actually _starting_ a tx @ExpectedException(IllegalStateException.class) public void testEntityManagerProxyRejectsProgrammaticTxManagement() { @@ -92,53 +91,53 @@ public void testEntityManagerProxyRejectsProgrammaticTxManagement() { public void testContainerEntityManagerProxyAllowsJoinTransactionInTransaction() { createContainerManagedEntityManager().joinTransaction(); } - + @NotTransactional @ExpectedException(TransactionRequiredException.class) public void testContainerEntityManagerProxyRejectsJoinTransactionWithoutTransaction() { createContainerManagedEntityManager().joinTransaction(); } - + public void testInstantiateAndSave() { EntityManager em = createContainerManagedEntityManager(); doInstantiateAndSave(em); } - + public void doInstantiateAndSave(EntityManager em) { assertEquals("Should be no people from previous transactions", 0, countRowsInTable("person")); Person p = new Person(); - + p.setFirstName("Tony"); p.setLastName("Blair"); em.persist(p); - + em.flush(); assertEquals("1 row must have been inserted", 1, countRowsInTable("person")); } - + public void testReuseInNewTransaction() { EntityManager em = createContainerManagedEntityManager(); doInstantiateAndSave(em); endTransaction(); - + //assertFalse(em.getTransaction().isActive()); - + startNewTransaction(); // Call any method: should cause automatic tx invocation assertFalse(em.contains(new Person())); //assertTrue(em.getTransaction().isActive()); - + doInstantiateAndSave(em); setComplete(); endTransaction(); // Should rollback assertEquals("Tx must have committed back", 1, countRowsInTable("person")); - + // Now clean up the database deleteFromTables(new String[] { "person" }); } - + public void testRollbackOccurs() { EntityManager em = createContainerManagedEntityManager(); doInstantiateAndSave(em); @@ -146,7 +145,7 @@ public void testRollbackOccurs() { assertEquals("Tx must have been rolled back", 0, countRowsInTable("person")); } - + public void testCommitOccurs() { EntityManager em = createContainerManagedEntityManager(); doInstantiateAndSave(em); @@ -154,7 +153,7 @@ public void testCommitOccurs() { endTransaction(); // Should rollback assertEquals("Tx must have committed back", 1, countRowsInTable("person")); - + // Now clean up the database deleteFromTables(new String[] { "person" }); } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/DefaultJpaDialectTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/DefaultJpaDialectTests.java index 5135a401fdb5..8bea21440351 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/DefaultJpaDialectTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/DefaultJpaDialectTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2006 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,9 +28,9 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; /** - * + * * @author Costin Leau - * + * */ public class DefaultJpaDialectTests extends TestCase { JpaDialect dialect; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryBeanSupportTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryBeanSupportTests.java index 9ad43e6e7f87..e88c59dc31a6 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryBeanSupportTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryBeanSupportTests.java @@ -20,7 +20,7 @@ * @author Rod Johnson */ public class EntityManagerFactoryBeanSupportTests extends AbstractEntityManagerFactoryBeanTests { - + @Override protected void setUp() throws Exception { super.setUp(); @@ -28,17 +28,17 @@ protected void setUp() throws Exception { emfMc.setVoidCallable(); emfMc.replay(); } - + public void testHookIsCalled() throws Exception { DummyEntityManagerFactoryBean demf = new DummyEntityManagerFactoryBean(mockEmf); - + demf.afterPropertiesSet(); - + checkInvariants(demf); - + // Should trigger close method expected by EntityManagerFactory mock demf.destroy(); - + emfMc.verify(); } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryUtilsTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryUtilsTests.java index e3b323ab35d7..697cd2a8880f 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryUtilsTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public void testDoGetEntityManagerWithTx() throws Exception { // no tx active assertSame(manager, EntityManagerFactoryUtils.doGetTransactionalEntityManager(factory, null)); assertSame(manager, ((EntityManagerHolder)TransactionSynchronizationManager.unbindResource(factory)).getEntityManager()); - + mockControl.verify(); } finally { @@ -91,21 +91,21 @@ public void testDoGetEntityManagerWithTx() throws Exception { assertTrue(TransactionSynchronizationManager.getResourceMap().isEmpty()); } - + public void testTranslatesIllegalStateException() { IllegalStateException ise = new IllegalStateException(); DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ise); assertSame(ise, dex.getCause()); assertTrue(dex instanceof InvalidDataAccessApiUsageException); } - + public void testTranslatesIllegalArgumentException() { IllegalArgumentException iae = new IllegalArgumentException(); DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(iae); assertSame(iae, dex.getCause()); assertTrue(dex instanceof InvalidDataAccessApiUsageException); } - + /** * We do not convert unknown exceptions. They may result from user code. */ diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java index b70e89752ff1..82b75609e58b 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public void testInterceptorWithNewEntityManagerAndLazyFlush() throws Persistence public void testInterceptorWithThreadBound() { factoryControl.replay(); managerControl.replay(); - + TransactionSynchronizationManager.bindResource(factory, new EntityManagerHolder(entityManager)); JpaInterceptor interceptor = new JpaInterceptor(); interceptor.setEntityManagerFactory(factory); @@ -179,12 +179,12 @@ public void testInterceptorWithThreadBoundAndFlushCommit() { public void testInterceptorWithFlushFailure() throws Throwable { factoryControl.expectAndReturn(factory.createEntityManager(), entityManager); entityManager.flush(); - + PersistenceException exception = new PersistenceException(); managerControl.setThrowable(exception, 1); managerControl.expectAndReturn(entityManager.isOpen(), true); entityManager.close(); - + factoryControl.replay(); managerControl.replay(); @@ -203,16 +203,16 @@ public void testInterceptorWithFlushFailure() throws Throwable { factoryControl.verify(); managerControl.verify(); } - + public void testInterceptorWithFlushFailureWithoutConversion() throws Throwable { factoryControl.expectAndReturn(factory.createEntityManager(), entityManager); entityManager.flush(); - + PersistenceException exception = new PersistenceException(); managerControl.setThrowable(exception, 1); managerControl.expectAndReturn(entityManager.isOpen(), true); entityManager.close(); - + factoryControl.replay(); managerControl.replay(); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTemplateTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTemplateTests.java index c78959f5cc96..d864b7b06161 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTemplateTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTransactionManagerTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTransactionManagerTests.java index 722f25adfee7..f79598eae9a6 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTransactionManagerTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/JpaTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java index 89c41cdc24ce..5ca2641c7680 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBeanTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBeanTests.java index b2d3557e9b88..ad68b90a6f95 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBeanTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBeanTests.java @@ -27,7 +27,7 @@ * @author Rod Johnson */ public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFactoryBeanTests { - + // Static fields set by inner class DummyPersistenceProvider private static String actualName; @@ -42,48 +42,48 @@ protected void setUp() throws Exception { emfMc.setVoidCallable(); emfMc.replay(); } - + public void testValidUsageWithDefaultProperties() throws Exception { testValidUsage(null); } - + public void testValidUsageWithExplicitProperties() throws Exception { testValidUsage(new Properties()); } - + protected void testValidUsage(Properties props) throws Exception { // This will be set by DummyPersistenceProvider actualName = null; actualProps = null; - + LocalEntityManagerFactoryBean lemfb = new LocalEntityManagerFactoryBean(); String entityManagerName = "call me Bob"; - + lemfb.setPersistenceUnitName(entityManagerName); lemfb.setPersistenceProviderClass(DummyPersistenceProvider.class); if (props != null) { lemfb.setJpaProperties(props); } lemfb.afterPropertiesSet(); - + assertSame(entityManagerName, actualName); if (props != null) { assertEquals(props, actualProps); } checkInvariants(lemfb); - + lemfb.destroy(); - + emfMc.verify(); } - - + + protected static class DummyPersistenceProvider implements PersistenceProvider { - + public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo pui, Map map) { throw new UnsupportedOperationException(); } - + public EntityManagerFactory createEntityManagerFactory(String emfName, Map properties) { actualName = emfName; actualProps = properties; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/domain/DriversLicense.java b/spring-orm/src/test/java/org/springframework/orm/jpa/domain/DriversLicense.java index c0b900365473..da0ad4e13886 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/domain/DriversLicense.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/domain/DriversLicense.java @@ -23,16 +23,16 @@ @Entity @Table(name="DRIVERS_LICENSE") public class DriversLicense { - + @Id private int id; - + private String serial_number; - + protected DriversLicense() { } - + public DriversLicense(String serialNumber) { this.serial_number = serialNumber; } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/domain/Person.java b/spring-orm/src/test/java/org/springframework/orm/jpa/domain/Person.java index 69c51ca869f2..4e41f0cba27c 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/domain/Person.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/domain/Person.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; -import javax.persistence.Table; - import org.springframework.beans.TestBean; import org.springframework.beans.factory.annotation.Configurable; @@ -39,7 +37,7 @@ @Configurable public class Person { - @Id + @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/eclipselink/EclipseLinkEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/eclipselink/EclipseLinkEntityManagerFactoryIntegrationTests.java index 4e092f7ffc3b..d28956f02a5c 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/eclipselink/EclipseLinkEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/eclipselink/EclipseLinkEntityManagerFactoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateEntityManagerFactoryIntegrationTests.java index 40e7af043196..e7a439080a17 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateEntityManagerFactoryIntegrationTests.java @@ -29,7 +29,7 @@ /** * Hibernate-specific JPA tests. - * + * * @author Juergen Hoeller * @author Rod Johnson */ diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryIntegrationTests.java index fbdb0eda301a..18a3bc867e24 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java index 44dc72070a36..3b1f71ba3c90 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java @@ -19,7 +19,7 @@ import org.junit.Ignore; /** - * Test that AspectJ weaving (in particular the currently shipped aspects) work with JPA (see SPR-3873 for more details). + * Test that AspectJ weaving (in particular the currently shipped aspects) work with JPA (see SPR-3873 for more details). * * @author Ramnivas Laddad */ @@ -34,7 +34,7 @@ public class OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests exten protected String[] getConfigLocations() { return new String[] { - "/org/springframework/orm/jpa/openjpa/openjpa-manager-aspectj-weaving.xml", + "/org/springframework/orm/jpa/openjpa/openjpa-manager-aspectj-weaving.xml", "/org/springframework/orm/jpa/memdb.xml", "/org/springframework/orm/jpa/inject.xml"}; } diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java index 559a9c98a587..a09e090765a4 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java @@ -40,7 +40,7 @@ /** * Unit and integration tests for the JPA XML resource parsing support. - * + * * @author Costin Leau * @author Juergen Hoeller */ @@ -275,7 +275,7 @@ public void testPersistenceUnitRootUrl() throws Exception { url = reader.determinePersistenceUnitRootUrl(new ClassPathResource("/org/springframework/orm/jpa/META-INF/persistence.xml")); assertTrue("the containing folder should have been returned", url.toString().endsWith("/org/springframework/orm/jpa")); } - + @Test public void testPersistenceUnitRootUrlWithJar() throws Exception { PersistenceUnitReader reader = new PersistenceUnitReader( diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/JpaDaoSupportTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/JpaDaoSupportTests.java index e5513a0cf5de..ec65890b8846 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/JpaDaoSupportTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/JpaDaoSupportTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2006 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ /** * @author Costin Leau - * + * */ public class JpaDaoSupportTests extends TestCase { diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java index c03e6a4b1e7f..96421aed176d 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java @@ -59,6 +59,8 @@ */ public class OpenEntityManagerInViewTests extends TestCase { + private MockControl factoryControl, managerControl; + private EntityManager manager; private EntityManagerFactory factory; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java index 51d1ff93b1c7..ce83061f3421 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -256,7 +256,7 @@ public void testPublicPersistenceUnitSetter() { public void testPublicPersistenceUnitSetterWithOverriding() { EntityManagerFactory mockEmf2 = - (EntityManagerFactory) MockControl.createControl(EntityManagerFactory.class).getMock(); + MockControl.createControl(EntityManagerFactory.class).getMock(); GenericApplicationContext gac = new GenericApplicationContext(); gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", mockEmf); @@ -274,7 +274,7 @@ public void testPublicPersistenceUnitSetterWithOverriding() { public void testPublicPersistenceUnitSetterWithUnitIdentifiedThroughBeanName() { EntityManagerFactory mockEmf2 = - (EntityManagerFactory) MockControl.createControl(EntityManagerFactory.class).getMock(); + MockControl.createControl(EntityManagerFactory.class).getMock(); GenericApplicationContext gac = new GenericApplicationContext(); gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", mockEmf); @@ -329,7 +329,7 @@ public void testPublicPersistenceUnitSetterWithMultipleUnitsIdentifiedThroughUni @Ignore public void ignoreTestPersistenceUnitsFromJndi() { mockEmf.createEntityManager(); - Object mockEm = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); + Object mockEm = MockControl.createControl(EntityManager.class).getMock(); emfMc.setReturnValue(mockEm, 1); emfMc.replay(); @@ -428,9 +428,9 @@ public void testSinglePersistenceUnitFromJndi() { } public void testPersistenceContextsFromJndi() { - Object mockEm = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); - Object mockEm2 = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); - Object mockEm3 = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); + Object mockEm = MockControl.createControl(EntityManager.class).getMock(); + Object mockEm2 = MockControl.createControl(EntityManager.class).getMock(); + Object mockEm3 = MockControl.createControl(EntityManager.class).getMock(); Map persistenceContexts = new HashMap(); persistenceContexts.put("", "pc1"); @@ -467,9 +467,9 @@ public void testPersistenceContextsFromJndi() { } public void testPersistenceContextsFromJndiWithDefaultUnit() { - Object mockEm = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); - Object mockEm2 = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); - Object mockEm3 = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); + Object mockEm = MockControl.createControl(EntityManager.class).getMock(); + Object mockEm2 = MockControl.createControl(EntityManager.class).getMock(); + Object mockEm3 = MockControl.createControl(EntityManager.class).getMock(); Map persistenceContexts = new HashMap(); persistenceContexts.put("System", "pc1"); @@ -507,8 +507,8 @@ public void testPersistenceContextsFromJndiWithDefaultUnit() { } public void testSinglePersistenceContextFromJndi() { - Object mockEm = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); - Object mockEm2 = (EntityManager) MockControl.createControl(EntityManager.class).getMock(); + Object mockEm = MockControl.createControl(EntityManager.class).getMock(); + Object mockEm2 = MockControl.createControl(EntityManager.class).getMock(); Map persistenceContexts = new HashMap(); persistenceContexts.put("System", "pc1"); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/SharedEntityManagerFactoryTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/SharedEntityManagerFactoryTests.java index b22527cdab04..3296f1f258d0 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/SharedEntityManagerFactoryTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/SharedEntityManagerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ public void testValidUsage() { assertTrue(EntityManager.class.isAssignableFrom(proxyFactoryBean.getObjectType())); assertTrue(proxyFactoryBean.isSingleton()); - EntityManager proxy = (EntityManager) proxyFactoryBean.getObject(); + EntityManager proxy = proxyFactoryBean.getObject(); assertSame(proxy, proxyFactoryBean.getObject()); assertFalse(proxy.contains(o)); diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkEntityManagerFactoryIntegrationTests.java index ef97dec7a984..d69241996e25 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkEntityManagerFactoryIntegrationTests.java @@ -21,7 +21,7 @@ /** * TopLink-specific JPA tests. - * + * * @author Costin Leau * @author Rod Johnson * @author Juergen Hoeller diff --git a/spring-orm/src/test/java/org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.java b/spring-orm/src/test/java/org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.java index 6641a9b213f5..8bb772fb097a 100644 --- a/spring-orm/src/test/java/org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.java +++ b/spring-orm/src/test/java/org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.jdbc.JdbcTestUtils; -import org.springframework.util.StringUtils; /** * Subclass of AbstractTransactionalSpringContextTests that adds some convenience diff --git a/spring-orm/src/test/java/org/springframework/test/ConditionalTestCase.java b/spring-orm/src/test/java/org/springframework/test/ConditionalTestCase.java index 9fd311931543..f1b168483446 100644 --- a/spring-orm/src/test/java/org/springframework/test/ConditionalTestCase.java +++ b/spring-orm/src/test/java/org/springframework/test/ConditionalTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/test/annotation/ProfileValueUtils.java b/spring-orm/src/test/java/org/springframework/test/annotation/ProfileValueUtils.java index ea1a6797af59..9280bbacd6fd 100644 --- a/spring-orm/src/test/java/org/springframework/test/annotation/ProfileValueUtils.java +++ b/spring-orm/src/test/java/org/springframework/test/annotation/ProfileValueUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/test/jdbc/JdbcTestUtils.java b/spring-orm/src/test/java/org/springframework/test/jdbc/JdbcTestUtils.java index a3b9784c2315..9283c8f4431c 100644 --- a/spring-orm/src/test/java/org/springframework/test/jdbc/JdbcTestUtils.java +++ b/spring-orm/src/test/java/org/springframework/test/jdbc/JdbcTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-orm/src/test/java/org/springframework/test/jpa/AbstractJpaTests.java b/spring-orm/src/test/java/org/springframework/test/jpa/AbstractJpaTests.java index 99ffd1dcfd4b..9a52d6b5bad0 100644 --- a/spring-orm/src/test/java/org/springframework/test/jpa/AbstractJpaTests.java +++ b/spring-orm/src/test/java/org/springframework/test/jpa/AbstractJpaTests.java @@ -59,8 +59,8 @@ * JpaTransactionManager through the superclass. * *

      When using Xerces, make sure a post 2.0.2 version is available on the classpath - * to avoid a critical - * bug + * to avoid a critical + * bug * that leads to StackOverflow. Maven users are likely to encounter this problem since * 2.0.2 is used by default. * @@ -83,7 +83,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactionalTests { private static final String DEFAULT_ORM_XML_LOCATION = "META-INF/orm.xml"; - + /** * Map from String defining unique combination of config locations, to ApplicationContext. * Values are intentionally not strongly typed, to avoid potential class cast exceptions @@ -139,15 +139,15 @@ protected boolean shouldUseShadowLoader() { @Override public void setDirty() { - super.setDirty(); + super.setDirty(); contextCache.remove(cacheKeys()); classLoaderCache.remove(cacheKeys()); - + // If we are a shadow loader, we need to invoke - // the shadow parent to set it dirty, as + // the shadow parent to set it dirty, as // it is the shadow parent that maintains the cache state, // not the child - if (this.shadowParent != null) { + if (this.shadowParent != null) { try { Method m = shadowParent.getClass().getMethod("setDirty", (Class[]) null); m.invoke(shadowParent, (Object[]) null); @@ -158,11 +158,11 @@ public void setDirty() { } } - + @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void runBare() throws Throwable { - + // getName will return the name of the method being run. if (isDisabledInThisEnvironment(getName())) { // Let superclass log that we didn't run the test. @@ -178,13 +178,13 @@ public void runBare() throws Throwable { + "Total disabled tests=" + getDisabledTestCount()); return; } - + if (!shouldUseShadowLoader()) { super.runBare(); return; } - - String combinationOfContextLocationsForThisTestClass = cacheKeys(); + + String combinationOfContextLocationsForThisTestClass = cacheKeys(); ClassLoader classLoaderForThisTestClass = getClass().getClassLoader(); // save the TCCL ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); @@ -254,7 +254,7 @@ public void runBare() throws Throwable { } // create the shadowed test Class shadowedTestClass = shadowingClassLoader.loadClass(getClass().getName()); - + // So long as JUnit is excluded from shadowing we // can minimize reflective invocation here TestCase shadowedTestCase = (TestCase) BeanUtils.instantiateClass(shadowedTestClass); @@ -294,12 +294,12 @@ protected String cacheKeys() { * class to be loaded eagerly when this test case loads, creating verify errors at runtime. */ protected ClassLoader createShadowingClassLoader(ClassLoader classLoader) { - OrmXmlOverridingShadowingClassLoader orxl = new OrmXmlOverridingShadowingClassLoader(classLoader, - getActualOrmXmlLocation()); + OrmXmlOverridingShadowingClassLoader orxl = new OrmXmlOverridingShadowingClassLoader(classLoader, + getActualOrmXmlLocation()); customizeResourceOverridingShadowingClassLoader(orxl); return orxl; } - + /** * Customize the shadowing class loader. * @param shadowingClassLoader this parameter is actually of type @@ -310,7 +310,7 @@ protected ClassLoader createShadowingClassLoader(ClassLoader classLoader) { protected void customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader) { // empty } - + /** * Subclasses can override this to return the real location path for * orm.xml or null if they do not wish to find any orm.xml @@ -366,7 +366,7 @@ public void addTransformer(ClassFileTransformer transformer) { public ClassLoader getInstrumentableClassLoader() { return this.shadowingClassLoader; } - + public ClassLoader getThrowawayClassLoader() { // Be sure to copy the same resource overrides and same class file transformers: // We want the throwaway class loader to behave like the instrumentable class loader. diff --git a/spring-orm/src/test/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java b/spring-orm/src/test/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java index a6baeaffcd25..0f2180ebebfa 100644 --- a/spring-orm/src/test/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java +++ b/spring-orm/src/test/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java @@ -31,7 +31,7 @@ * @since 2.0 */ class OrmXmlOverridingShadowingClassLoader extends ResourceOverridingShadowingClassLoader { - + /** * Default location of the orm.xml file in the class path: * "META-INF/orm.xml" diff --git a/spring-orm/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-orm/src/test/java/org/springframework/util/SerializationTestUtils.java index dbe6421093e4..39a7582e831c 100644 --- a/spring-orm/src/test/java/org/springframework/util/SerializationTestUtils.java +++ b/spring-orm/src/test/java/org/springframework/util/SerializationTestUtils.java @@ -94,4 +94,4 @@ public void testWithSerializableObject() throws Exception { assertEquals(y, (int) p2.getY()); } -} \ No newline at end of file +} diff --git a/spring-oxm/src/main/java/org/springframework/oxm/GenericUnmarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/GenericUnmarshaller.java index 5b90d1f5a5ca..8c053b0420f6 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/GenericUnmarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/GenericUnmarshaller.java @@ -34,4 +34,4 @@ public interface GenericUnmarshaller extends Unmarshaller { */ boolean supports(Type genericType); -} \ No newline at end of file +} diff --git a/spring-oxm/src/main/java/org/springframework/oxm/Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/Marshaller.java index aaa3198025a1..ba540fc24270 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/Marshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/Unmarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/Unmarshaller.java index e1534f3f2f08..6c0d05084803 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/Unmarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/Unmarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java index dfea7ac536d6..6deb47194d75 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java @@ -92,7 +92,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing private String encoding = DEFAULT_ENCODING; - private Class[] targetClasses; + private Class[] targetClasses; private String[] targetPackages; @@ -163,7 +163,7 @@ public void setMappingLocations(Resource[] mappingLocations) { * Set the Castor target class. Alternative means of configuring CastorMarshaller for unmarshalling * multiple classes include use of mapping files, and specifying packages with Castor descriptor classes. */ - public void setTargetClass(Class targetClass) { + public void setTargetClass(Class targetClass) { this.targetClasses = new Class[]{targetClass}; } @@ -171,7 +171,7 @@ public void setTargetClass(Class targetClass) { * Set the Castor target classes. Alternative means of configuring CastorMarshaller for unmarshalling * multiple classes include use of mapping files, and specifying packages with Castor descriptor classes. */ - public void setTargetClasses(Class[] targetClasses) { + public void setTargetClasses(Class[] targetClasses) { this.targetClasses = targetClasses; } @@ -181,7 +181,7 @@ public void setTargetClasses(Class[] targetClasses) { public void setTargetPackage(String targetPackage) { this.targetPackages = new String[] {targetPackage}; } - + /** * Set the names of packages with the Castor descriptor classes. */ @@ -425,7 +425,7 @@ public final void afterPropertiesSet() throws CastorMappingException, IOExceptio * @see XMLContext#addMapping(org.exolab.castor.mapping.Mapping) * @see XMLContext#addClass(Class) */ - protected XMLContext createXMLContext(Resource[] mappingLocations, Class[] targetClasses, String[] targetPackages) + protected XMLContext createXMLContext(Resource[] mappingLocations, Class[] targetClasses, String[] targetPackages) throws MappingException, ResolverException, IOException { XMLContext context = new XMLContext(); diff --git a/spring-oxm/src/main/java/org/springframework/oxm/config/CastorMarshallerBeanDefinitionParser.java b/spring-oxm/src/main/java/org/springframework/oxm/config/CastorMarshallerBeanDefinitionParser.java index 60fdf715d3c2..dfdfadaa27b4 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/config/CastorMarshallerBeanDefinitionParser.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/config/CastorMarshallerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,5 +33,5 @@ public class CastorMarshallerBeanDefinitionParser extends AbstractSimpleBeanDefi @Override protected String getBeanClassName(Element element) { return CASTOR_MARSHALLER_CLASS_NAME; - } + } } diff --git a/spring-oxm/src/main/java/org/springframework/oxm/config/Jaxb2MarshallerBeanDefinitionParser.java b/spring-oxm/src/main/java/org/springframework/oxm/config/Jaxb2MarshallerBeanDefinitionParser.java index 3d60be51c1fd..db04dfa33d75 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/config/Jaxb2MarshallerBeanDefinitionParser.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/config/Jaxb2MarshallerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* -* Copyright 2002-2009 the original author or authors. +* Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.oxm.config; -import java.util.Iterator; import java.util.List; import org.w3c.dom.Element; @@ -49,11 +48,10 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit if (StringUtils.hasText(contextPath)) { beanDefinitionBuilder.addPropertyValue("contextPath", contextPath); } - List classes = DomUtils.getChildElementsByTagName(element, "class-to-be-bound"); + List classes = DomUtils.getChildElementsByTagName(element, "class-to-be-bound"); if (!classes.isEmpty()) { - ManagedList classesToBeBound = new ManagedList(classes.size()); - for (Iterator iterator = classes.iterator(); iterator.hasNext();) { - Element classToBeBound = (Element) iterator.next(); + ManagedList classesToBeBound = new ManagedList(classes.size()); + for (Element classToBeBound : classes) { String className = classToBeBound.getAttribute("name"); classesToBeBound.add(className); } diff --git a/spring-oxm/src/main/java/org/springframework/oxm/config/JibxMarshallerBeanDefinitionParser.java b/spring-oxm/src/main/java/org/springframework/oxm/config/JibxMarshallerBeanDefinitionParser.java index b3a0773f27ac..29ab3da59787 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/config/JibxMarshallerBeanDefinitionParser.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/config/JibxMarshallerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,4 +35,4 @@ protected String getBeanClassName(Element element) { return JIBX_MARSHALLER_CLASS_NAME; } -} \ No newline at end of file +} diff --git a/spring-oxm/src/main/java/org/springframework/oxm/config/XmlBeansMarshallerBeanDefinitionParser.java b/spring-oxm/src/main/java/org/springframework/oxm/config/XmlBeansMarshallerBeanDefinitionParser.java index a27fec56bd04..b9d83993f0d8 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/config/XmlBeansMarshallerBeanDefinitionParser.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/config/XmlBeansMarshallerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java index a53bddf3f0dd..65ec8cceedb0 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java @@ -132,7 +132,7 @@ public class Jaxb2Marshaller private String contextPath; private Class[] classesToBeBound; - + private String[] packagesToScan; private Map jaxbContextProperties; diff --git a/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeMarshaller.java index d66c321d15d3..ce09f45caf81 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeMarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeUnmarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeUnmarshaller.java index 1ad90e182c74..9766a75c0b07 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeUnmarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/mime/MimeUnmarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java index cee37bb9b46f..54c7cf26f982 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java b/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java index 9ebc45ba0984..cfd49d6dde07 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/support/SaxResourceUtils.java b/spring-oxm/src/main/java/org/springframework/oxm/support/SaxResourceUtils.java index 6f653024d637..a6e899787cf0 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/support/SaxResourceUtils.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/support/SaxResourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller.java index eb5a6e6c1d6c..39cc939cbbfa 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.io.OutputStream; import java.io.Reader; import java.io.Writer; -import java.io.FilterInputStream; import java.util.ArrayList; import java.util.List; import java.lang.ref.WeakReference; @@ -38,8 +37,6 @@ import org.apache.xmlbeans.XmlOptions; import org.apache.xmlbeans.XmlSaxHandler; import org.apache.xmlbeans.XmlValidationError; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -270,7 +267,7 @@ protected void validate(XmlObject object) throws ValidationFailureException { if (isValidating() && object != null) { // create a temporary xmlOptions just for validation XmlOptions validateOptions = getXmlOptions() != null ? getXmlOptions() : new XmlOptions(); - List errorsList = new ArrayList(); + List errorsList = new ArrayList(); validateOptions.setErrorListener(errorsList); if (!object.validate(validateOptions)) { StringBuilder builder = new StringBuilder("Could not validate XmlObject :"); @@ -328,7 +325,7 @@ private NonClosingInputStream(InputStream in) { private InputStream getInputStream() { return this.in.get(); } - + @Override public int read() throws IOException { InputStream in = getInputStream(); diff --git a/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBean.java b/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBean.java index 2c90c53fd4a8..5c09e3a9f3d3 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBean.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java index 6a33cf2c5fbe..dc6e639a9efe 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java @@ -106,7 +106,7 @@ public class XStreamMarshaller extends AbstractMarshaller implements Initializin private String encoding = DEFAULT_ENCODING; - private Class[] supportedClasses; + private Class[] supportedClasses; private ClassLoader classLoader; @@ -181,9 +181,9 @@ private Map> toClassMap(Map map) throws ClassNotFoun for (Map.Entry entry : map.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); - Class type; + Class type; if (value instanceof Class) { - type = (Class) value; + type = (Class) value; } else if (value instanceof String) { String s = (String) value; @@ -211,7 +211,7 @@ public void setFieldAliases(Map aliases) throws ClassNotFoundExc int idx = field.lastIndexOf('.'); if (idx != -1) { String className = field.substring(0, idx); - Class clazz = ClassUtils.forName(className, classLoader); + Class clazz = ClassUtils.forName(className, classLoader); String fieldName = field.substring(idx + 1); this.getXStream().aliasField(alias, clazz, fieldName); } else { @@ -224,8 +224,8 @@ public void setFieldAliases(Map aliases) throws ClassNotFoundExc * Set types to use XML attributes for. * @see XStream#useAttributeFor(Class) */ - public void setUseAttributeForTypes(Class[] types) { - for (Class type : types) { + public void setUseAttributeForTypes(Class[] types) { + for (Class type : types) { this.getXStream().useAttributeFor(type); } } @@ -242,7 +242,7 @@ public void setUseAttributeFor(Map attributes) { for (Map.Entry entry : attributes.entrySet()) { if (entry.getKey() instanceof String) { if (entry.getValue() instanceof Class) { - this.getXStream().useAttributeFor((String) entry.getKey(), (Class) entry.getValue()); + this.getXStream().useAttributeFor((String) entry.getKey(), (Class) entry.getValue()); } else { throw new IllegalArgumentException( @@ -256,7 +256,7 @@ else if (entry.getKey() instanceof Class) { this.getXStream().useAttributeFor(key, (String) entry.getValue()); } else if (entry.getValue() instanceof List) { - List list = (List) entry.getValue(); + List list = (List) entry.getValue(); for (Object o : list) { if (o instanceof String) { @@ -353,7 +353,7 @@ public void setEncoding(String encoding) { *

      If this property is empty (the default), all classes are supported. * @see #supports(Class) */ - public void setSupportedClasses(Class[] supportedClasses) { + public void setSupportedClasses(Class[] supportedClasses) { this.supportedClasses = supportedClasses; } @@ -375,12 +375,12 @@ protected void customizeXStream(XStream xstream) { } - public boolean supports(Class clazz) { + public boolean supports(Class clazz) { if (ObjectUtils.isEmpty(this.supportedClasses)) { return true; } else { - for (Class supportedClass : this.supportedClasses) { + for (Class supportedClass : this.supportedClasses) { if (supportedClass.isAssignableFrom(clazz)) { return true; } diff --git a/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamUtils.java b/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamUtils.java index 1750cb5c752e..a094bdcfbcab 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamUtils.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java index a214f2a27f23..ce21a02d931a 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java index d92510e45544..82a1d19d0805 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/AbstractUnmarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java index ea3b9e3c8cf8..8a7f1f82f1f4 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ import org.custommonkey.xmlunit.XMLUnit; import org.custommonkey.xmlunit.XpathEngine; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.NodeList; diff --git a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorObject.java b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorObject.java index be52bd791c60..417f5e807ae3 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorObject.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorObject.java @@ -42,4 +42,4 @@ public Integer getValue() { public void setValue(Integer value) { this.value = value; } -} \ No newline at end of file +} diff --git a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorUnmarshallerTests.java index 4cd57b33bec2..25d494436060 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorUnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorUnmarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ protected void testFlights(Object o) { protected void testFlight(Object o) { Flight flight = (Flight) o; assertNotNull("Flight is null", flight); - assertEquals("Number is invalid", 42L, (long) flight.getNumber()); + assertEquals("Number is invalid", 42L, flight.getNumber()); } @Override @@ -104,10 +104,10 @@ public void testSetBothTargetClassesAndMapping() throws IOException { assertEquals("Invalid amount of items", 2, order.getOrderItemCount()); OrderItem item = order.getOrderItem(0); assertEquals("Invalid items", "1", item.getId()); - assertEquals("Invalid items", 15, (int)item.getQuantity()); + assertEquals("Invalid items", 15, item.getQuantity()); item = order.getOrderItem(1); assertEquals("Invalid items", "3", item.getId()); - assertEquals("Invalid items", 20, (int)item.getQuantity()); + assertEquals("Invalid items", 20, item.getQuantity()); } @Test diff --git a/spring-oxm/src/test/java/org/springframework/oxm/config/OxmNamespaceHandlerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/config/OxmNamespaceHandlerTests.java index f9dd3eeb240d..fcc577b16895 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/config/OxmNamespaceHandlerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/config/OxmNamespaceHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ /** * Tests the {@link OxmNamespaceHandler} class. - * + * * @author Arjen Poustma * @author Jakub Narloch */ @@ -87,4 +87,4 @@ public void castorMappingLocationMarshaller() throws Exception { CastorMarshaller castorMarshaller = applicationContext.getBean("castorMappingLocationMarshaller", CastorMarshaller.class); assertNotNull(castorMarshaller); } -} \ No newline at end of file +} diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index a9a749dc0f71..a550a4daedb5 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java @@ -52,7 +52,6 @@ import static org.custommonkey.xmlunit.XMLAssert.assertFalse; import static org.custommonkey.xmlunit.XMLAssert.*; -import static org.custommonkey.xmlunit.XMLAssert.fail; import static org.easymock.EasyMock.*; import static org.junit.Assert.assertTrue; @@ -163,7 +162,7 @@ public void supportsClassesToBeBound() throws Exception { marshaller.afterPropertiesSet(); testSupports(); } - + @Test public void supportsPackagesToScan() throws Exception { marshaller = new Jaxb2Marshaller(); @@ -261,7 +260,7 @@ public void supportsXmlRootElement() throws Exception { assertFalse("Jaxb2Marshaller supports DummyType class", marshaller.supports(DummyType.class)); assertFalse("Jaxb2Marshaller supports DummyType type", marshaller.supports((Type)DummyType.class)); } - + @Test public void marshalAttachments() throws Exception { @@ -307,5 +306,5 @@ private JAXBElement createDummyRootElement() { private JAXBElement createDummyType() { return null; } - + } diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java index 8b4ce76a802e..04eaa44a9fe2 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Primitives.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Primitives.java index 1a5c65809337..92e98b4d060f 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Primitives.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Primitives.java @@ -52,7 +52,7 @@ public JAXBElement primitiveLong() { public JAXBElement primitiveDouble() { return new JAXBElement(NAME, Double.class, 42D); } - + public JAXBElement primitiveByteArray() { return new JAXBElement(NAME, byte[].class, new byte[]{42}); } diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/StandardClasses.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/StandardClasses.java index bd98d9df1a85..00daa798f459 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/StandardClasses.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/StandardClasses.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,7 +103,7 @@ public JAXBElement standardClassDuration() { Duration duration = factory.newDuration(42000); return new JAXBElement(NAME, Duration.class, duration); } - + public JAXBElement standardClassImage() throws IOException { Image image = ImageIO.read(getClass().getResourceAsStream("spring-ws.png")); return new JAXBElement(NAME, Image.class, image); diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java index 42c25f9b316e..c3fa914e1bf8 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshallerTests.java index 257238252983..655b20195bdf 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansUnmarshallerTests.java index 695518e1d015..82c028d8034f 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansUnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansUnmarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBeanTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBeanTests.java index 70bd44b5d173..d82017682bd0 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBeanTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xstream/Flight.java b/spring-oxm/src/test/java/org/springframework/oxm/xstream/Flight.java index 8152f1e2d2de..4b98479ca4c7 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xstream/Flight.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xstream/Flight.java @@ -31,4 +31,4 @@ public long getFlightNumber() { public void setFlightNumber(long number) { this.flightNumber = number; } -} \ No newline at end of file +} diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java index 49821ece292d..7979e4d5c523 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,7 +216,7 @@ public void useAttributesForClassStringMap() throws Exception { String expected = ""; assertXMLEqual("Marshaller does not use attributes", expected, writer.toString()); } - + @Test public void useAttributesForClassStringListMap() throws Exception { marshaller @@ -278,7 +278,7 @@ public void implicitCollections() throws Exception { Flights flights = new Flights(); flights.getFlights().add(flight); flights.getStrings().add("42"); - + Map aliases = new HashMap(); aliases.put("flight", Flight.class); aliases.put("flights", Flights.class); diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java index 8c9bcd51d702..d5304e235bb6 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamUnmarshallerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/ComponentControllerSupport.java b/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/ComponentControllerSupport.java index 45274b8a600c..a575cc1973b6 100644 --- a/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/ComponentControllerSupport.java +++ b/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/ComponentControllerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesConfigurer.java b/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesConfigurer.java index 3ac220ce339d..7af39ada7518 100644 --- a/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesConfigurer.java +++ b/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ public class TilesConfigurer extends WebApplicationObjectSupport implements Init private boolean validateDefinitions = true; /** Factory class for Tiles */ - private Class factoryClass = I18nFactorySet.class; + private Class factoryClass = I18nFactorySet.class; /** @@ -100,7 +100,7 @@ public void setValidateDefinitions(boolean validateDefinitions) { * Set the factory class for Tiles. Default is I18nFactorySet. * @see org.apache.struts.tiles.xmlDefinition.I18nFactorySet */ - public void setFactoryClass(Class factoryClass) { + public void setFactoryClass(Class factoryClass) { this.factoryClass = factoryClass; } diff --git a/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesView.java b/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesView.java index 2ec68703757b..7f137554fde8 100644 --- a/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesView.java +++ b/spring-struts/src/main/java/org/springframework/web/servlet/view/tiles/TilesView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/ActionServletAwareProcessor.java b/spring-struts/src/main/java/org/springframework/web/struts/ActionServletAwareProcessor.java index e49b12be6d78..fafcffa15869 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/ActionServletAwareProcessor.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/ActionServletAwareProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/ActionSupport.java b/spring-struts/src/main/java/org/springframework/web/struts/ActionSupport.java index c12b895766ef..b87823a83640 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/ActionSupport.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/ActionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/AutowiringRequestProcessor.java b/spring-struts/src/main/java/org/springframework/web/struts/AutowiringRequestProcessor.java index f14091729d94..27a5368ca35c 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/AutowiringRequestProcessor.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/AutowiringRequestProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/AutowiringTilesRequestProcessor.java b/spring-struts/src/main/java/org/springframework/web/struts/AutowiringTilesRequestProcessor.java index 96a24c8c6e80..c9df6c849217 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/AutowiringTilesRequestProcessor.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/AutowiringTilesRequestProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/ContextLoaderPlugIn.java b/spring-struts/src/main/java/org/springframework/web/struts/ContextLoaderPlugIn.java index ba316fd3bc21..afa20824bd49 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/ContextLoaderPlugIn.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/ContextLoaderPlugIn.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -114,7 +114,7 @@ public class ContextLoaderPlugIn implements PlugIn { * Default context class for ContextLoaderPlugIn. * @see org.springframework.web.context.support.XmlWebApplicationContext */ - public static final Class DEFAULT_CONTEXT_CLASS = XmlWebApplicationContext.class; + public static final Class DEFAULT_CONTEXT_CLASS = XmlWebApplicationContext.class; /** * Prefix for the ServletContext attribute for the WebApplicationContext. @@ -126,7 +126,7 @@ public class ContextLoaderPlugIn implements PlugIn { protected final Log logger = LogFactory.getLog(getClass()); /** Custom WebApplicationContext class */ - private Class contextClass = DEFAULT_CONTEXT_CLASS; + private Class contextClass = DEFAULT_CONTEXT_CLASS; /** Namespace for this servlet */ private String namespace; @@ -160,14 +160,14 @@ public void setContextClassName(String contextClassName) throws ClassNotFoundExc * must also implement ConfigurableWebApplicationContext. * @see #createWebApplicationContext */ - public void setContextClass(Class contextClass) { + public void setContextClass(Class contextClass) { this.contextClass = contextClass; } /** * Return the custom context class. */ - public Class getContextClass() { + public Class getContextClass() { return this.contextClass; } @@ -305,7 +305,7 @@ protected WebApplicationContext initWebApplicationContext() throws BeansExceptio logger.debug("Published WebApplicationContext of Struts ActionServlet '" + getServletName() + "', module '" + getModulePrefix() + "' as ServletContext attribute with name [" + attrName + "]"); } - + return wac; } diff --git a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionProxy.java b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionProxy.java index 7070cf089fd0..213617ee90e2 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionProxy.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -127,7 +127,7 @@ public ActionForward execute( protected Action getDelegateAction(ActionMapping mapping) throws BeansException { WebApplicationContext wac = getWebApplicationContext(getServlet(), mapping.getModuleConfig()); String beanName = determineActionBeanName(mapping); - return (Action) wac.getBean(beanName, Action.class); + return wac.getBean(beanName, Action.class); } /** diff --git a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionUtils.java b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionUtils.java index 0fc85b091f81..3457194f9db1 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionUtils.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingActionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingRequestProcessor.java b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingRequestProcessor.java index 9f8d647b8c6d..575cebff9855 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingRequestProcessor.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingRequestProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public class DelegatingRequestProcessor extends RequestProcessor { private WebApplicationContext webApplicationContext; - + @Override public void init(ActionServlet actionServlet, ModuleConfig moduleConfig) throws ServletException { @@ -177,7 +177,7 @@ protected Action getDelegateAction(ActionMapping mapping) throws BeansException if (!getWebApplicationContext().containsBean(beanName)) { return null; } - return (Action) getWebApplicationContext().getBean(beanName, Action.class); + return getWebApplicationContext().getBean(beanName, Action.class); } /** diff --git a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingTilesRequestProcessor.java b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingTilesRequestProcessor.java index 9749ad53b01a..7e6ba096fb7f 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/DelegatingTilesRequestProcessor.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/DelegatingTilesRequestProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public class DelegatingTilesRequestProcessor extends TilesRequestProcessor { private WebApplicationContext webApplicationContext; - + @Override public void init(ActionServlet actionServlet, ModuleConfig moduleConfig) throws ServletException { @@ -126,7 +126,7 @@ protected Action getDelegateAction(ActionMapping mapping) throws BeansException if (!getWebApplicationContext().containsBean(beanName)) { return null; } - return (Action) getWebApplicationContext().getBean(beanName, Action.class); + return getWebApplicationContext().getBean(beanName, Action.class); } /** diff --git a/spring-struts/src/main/java/org/springframework/web/struts/DispatchActionSupport.java b/spring-struts/src/main/java/org/springframework/web/struts/DispatchActionSupport.java index ff18cff838a1..b9a0b186dede 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/DispatchActionSupport.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/DispatchActionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/LookupDispatchActionSupport.java b/spring-struts/src/main/java/org/springframework/web/struts/LookupDispatchActionSupport.java index 1533d81a1020..a6cb4ed10926 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/LookupDispatchActionSupport.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/LookupDispatchActionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/MappingDispatchActionSupport.java b/spring-struts/src/main/java/org/springframework/web/struts/MappingDispatchActionSupport.java index b67b34f481d3..1187c84f9a29 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/MappingDispatchActionSupport.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/MappingDispatchActionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-struts/src/main/java/org/springframework/web/struts/SpringBindingActionForm.java b/spring-struts/src/main/java/org/springframework/web/struts/SpringBindingActionForm.java index c16f719c6264..ff0564969b65 100644 --- a/spring-struts/src/main/java/org/springframework/web/struts/SpringBindingActionForm.java +++ b/spring-struts/src/main/java/org/springframework/web/struts/SpringBindingActionForm.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.web.struts; import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; import java.util.Locale; import javax.servlet.http.HttpServletRequest; @@ -62,7 +61,7 @@ * <form-beans> * <form-bean name="actionForm" type="org.springframework.web.struts.SpringBindingActionForm"/> * </form-beans> - * + * * Example code in a custom Struts Action: * *

      @@ -162,9 +161,7 @@ public void expose(Errors errors, HttpServletRequest request) {
       	 */
       	private ActionMessages getActionMessages() {
       		ActionMessages actionMessages = new ActionMessages();
      -		Iterator it = this.errors.getAllErrors().iterator();
      -		while (it.hasNext()) {
      -			ObjectError objectError = (ObjectError) it.next();
      +		for (ObjectError objectError : this.errors.getAllErrors()) {
       			String effectiveMessageKey = findEffectiveMessageKey(objectError);
       			if (effectiveMessageKey == null && !defaultActionMessageAvailable) {
       				// Need to specify default code despite it not being resolvable:
      diff --git a/spring-struts/src/main/java/org/springframework/web/struts/package-info.java b/spring-struts/src/main/java/org/springframework/web/struts/package-info.java
      index b299f31263d4..33fe62fa5298 100644
      --- a/spring-struts/src/main/java/org/springframework/web/struts/package-info.java
      +++ b/spring-struts/src/main/java/org/springframework/web/struts/package-info.java
      @@ -25,4 +25,4 @@
        * 
        */
       @Deprecated
      -package org.springframework.web.struts;
      \ No newline at end of file
      +package org.springframework.web.struts;
      diff --git a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java
      index d65b6c7a4dc9..941dd59517e1 100644
      --- a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java
      +++ b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java
      @@ -1,12 +1,12 @@
       /*
        * Copyright 2002-2005 the original author or authors.
      - * 
      + *
        * Licensed under the Apache License, Version 2.0 (the "License");
        * you may not use this file except in compliance with the License.
        * You may obtain a copy of the License at
      - * 
      + *
        *      http://www.apache.org/licenses/LICENSE-2.0
      - * 
      + *
        * Unless required by applicable law or agreed to in writing, software
        * distributed under the License is distributed on an "AS IS" BASIS,
        * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      diff --git a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java
      index 389c18f9b37b..34a09a170f70 100644
      --- a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java
      +++ b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright 2002-2008 the original author or authors.
      + * Copyright 2002-2012 the original author or authors.
        *
        * Licensed under the Apache License, Version 2.0 (the "License");
        * you may not use this file except in compliance with the License.
      diff --git a/spring-struts/src/test/java/org/springframework/web/struts/StrutsSupportTests.java b/spring-struts/src/test/java/org/springframework/web/struts/StrutsSupportTests.java
      index 93394707022d..3fc807b2f989 100644
      --- a/spring-struts/src/test/java/org/springframework/web/struts/StrutsSupportTests.java
      +++ b/spring-struts/src/test/java/org/springframework/web/struts/StrutsSupportTests.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright 2002-2005 the original author or authors.
      + * Copyright 2002-2012 the original author or authors.
        *
        * Licensed under the Apache License, Version 2.0 (the "License");
        * you may not use this file except in compliance with the License.
      diff --git a/spring-struts/src/test/java/org/springframework/web/struts/TestAction.java b/spring-struts/src/test/java/org/springframework/web/struts/TestAction.java
      index 68dda908f51d..5553d5f79aa6 100644
      --- a/spring-struts/src/test/java/org/springframework/web/struts/TestAction.java
      +++ b/spring-struts/src/test/java/org/springframework/web/struts/TestAction.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright 2002-2006 the original author or authors.
      + * Copyright 2002-2012 the original author or authors.
        *
        * Licensed under the Apache License, Version 2.0 (the "License");
        * you may not use this file except in compliance with the License.
      diff --git a/spring-test/src/main/java/org/springframework/mock/env/MockEnvironment.java b/spring-test/src/main/java/org/springframework/mock/env/MockEnvironment.java
      index a68925583213..8042e6d1f608 100644
      --- a/spring-test/src/main/java/org/springframework/mock/env/MockEnvironment.java
      +++ b/spring-test/src/main/java/org/springframework/mock/env/MockEnvironment.java
      @@ -23,7 +23,7 @@
        * Simple {@link ConfigurableEnvironment} implementation exposing
        * {@link #setProperty(String, String)} and {@link #withProperty(String, String)}
        * methods for testing purposes.
      - * 
      + *
        * @author Chris Beams
        * @author Sam Brannen
        * @since 3.2
      diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java
      index 2d23fd9cfa61..b3ed5611ad85 100644
      --- a/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java
      +++ b/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java
      @@ -23,9 +23,8 @@
       import org.springframework.jndi.JndiTemplate;
       
       /**
      - * Simple extension of the JndiTemplate class that always returns a given object.
      - *
      - * 

      Very useful for testing. Effectively a mock object. + * Simple extension of the JndiTemplate class that always returns a given + * object. Very useful for testing. Effectively a mock object. * * @author Rod Johnson * @author Juergen Hoeller @@ -38,6 +37,7 @@ public class ExpectedLookupTemplate extends JndiTemplate { /** * Construct a new JndiTemplate that will always return given objects for * given names. To be populated through addObject calls. + * * @see #addObject(String, Object) */ public ExpectedLookupTemplate() { @@ -46,6 +46,7 @@ public ExpectedLookupTemplate() { /** * Construct a new JndiTemplate that will always return the given object, * but honour only requests for the given name. + * * @param name the name the client is expected to look up * @param object the object that will be returned */ @@ -54,7 +55,9 @@ public ExpectedLookupTemplate(String name, Object object) { } /** - * Add the given object to the list of JNDI objects that this template will expose. + * Add the given object to the list of JNDI objects that this template will + * expose. + * * @param name the name the client is expected to look up * @param object the object that will be returned */ diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java index b6489e42029f..fd67ca3d5d0d 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java index 8b816b45d0d6..e3084b889585 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ * DataSource ds = new DriverManagerDataSource(...); * builder.bind("java:comp/env/jdbc/myds", ds); * builder.activate();

      - * + * * Note that it's impossible to activate multiple builders within the same JVM, * due to JNDI restrictions. Thus to configure a fresh builder repeatedly, use * the following code to get a reference to either an already activated builder diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java b/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java index 4ee7055afd63..992e2369c361 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java @@ -2,7 +2,7 @@ /** * * The simplest implementation of the JNDI SPI that could possibly work. - * + * *

      Useful for setting up a simple JNDI environment for test suites * or stand-alone applications. If, for example, JDBC DataSources get bound to the * same JNDI names as within a Java EE container, both application code and diff --git a/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletInputStream.java b/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletInputStream.java index b083e95b27e4..00892f40f34d 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletInputStream.java +++ b/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletOutputStream.java b/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletOutputStream.java index 66fca5df2f91..af0974faabb3 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletOutputStream.java +++ b/spring-test/src/main/java/org/springframework/mock/web/DelegatingServletOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockBodyContent.java b/spring-test/src/main/java/org/springframework/mock/web/MockBodyContent.java index 3fb6ca770307..0e6449bcb057 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockBodyContent.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockBodyContent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockExpressionEvaluator.java b/spring-test/src/main/java/org/springframework/mock/web/MockExpressionEvaluator.java index 6748f5e7e04f..4894fe4eb9b7 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockExpressionEvaluator.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockExpressionEvaluator.java @@ -36,7 +36,7 @@ *

      * Note that the Jakarta JSTL implementation (jstl.jar, standard.jar) has to be * available on the class path to use this expression evaluator. - * + * * @author Juergen Hoeller * @since 1.1.5 * @see org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager @@ -49,7 +49,7 @@ public class MockExpressionEvaluator extends ExpressionEvaluator { /** * Create a new MockExpressionEvaluator for the given PageContext. - * + * * @param pageContext the JSP PageContext to run in */ public MockExpressionEvaluator(PageContext pageContext) { diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockFilterConfig.java b/spring-test/src/main/java/org/springframework/mock/web/MockFilterConfig.java index 34cafd55fc1f..49e5beb45a7b 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockFilterConfig.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockFilterConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java index 973db4189fc6..ab3ae980ca76 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java @@ -97,6 +97,8 @@ public class MockHttpServletRequest implements HttpServletRequest { private static final String CHARSET_PREFIX = "charset="; + private static final String CHARSET_PREFIX = "charset="; + private boolean active = true; // --------------------------------------------------------------------- diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java index 3e2701c576b7..88f3dbab08ec 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java @@ -51,7 +51,7 @@ public class MockHttpServletResponse implements HttpServletResponse { private static final String CHARSET_PREFIX = "charset="; private static final String CONTENT_TYPE_HEADER = "Content-Type"; - + private static final String CONTENT_LENGTH_HEADER = "Content-Length"; private static final String LOCATION_HEADER = "Location"; @@ -65,7 +65,7 @@ public class MockHttpServletResponse implements HttpServletResponse { private boolean writerAccessAllowed = true; private String characterEncoding = WebUtils.DEFAULT_CHARACTER_ENCODING; - + private boolean charset = false; private final ByteArrayOutputStream content = new ByteArrayOutputStream(); @@ -141,7 +141,7 @@ public void setCharacterEncoding(String characterEncoding) { this.charset = true; updateContentTypeHeader(); } - + private void updateContentTypeHeader() { if (this.contentType != null) { StringBuilder sb = new StringBuilder(this.contentType); @@ -151,7 +151,7 @@ private void updateContentTypeHeader() { doAddHeaderValue(CONTENT_TYPE_HEADER, sb.toString(), true); } } - + public String getCharacterEncoding() { return this.characterEncoding; } @@ -457,7 +457,7 @@ private void addHeaderValue(String name, Object value) { } doAddHeaderValue(name, value, false); } - + private boolean setSpecialHeader(String name, Object value) { if (CONTENT_TYPE_HEADER.equalsIgnoreCase(name)) { setContentType((String) value); diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpSession.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpSession.java index bc08077830fa..1855230d2c57 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpSession.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpSession.java @@ -71,7 +71,7 @@ public class MockHttpSession implements HttpSession { /** * Create a new MockHttpSession with a default {@link MockServletContext}. - * + * * @see MockServletContext */ public MockHttpSession() { @@ -80,7 +80,7 @@ public MockHttpSession() { /** * Create a new MockHttpSession. - * + * * @param servletContext the ServletContext that the session runs in */ public MockHttpSession(ServletContext servletContext) { @@ -89,7 +89,7 @@ public MockHttpSession(ServletContext servletContext) { /** * Create a new MockHttpSession. - * + * * @param servletContext the ServletContext that the session runs in * @param id a unique identifier for this session */ @@ -222,7 +222,7 @@ public boolean isNew() { /** * Serialize the attributes of this session into an object that can be * turned into a byte array with standard Java serialization. - * + * * @return a representation of this session's serialized state */ public Serializable serializeState() { @@ -249,7 +249,7 @@ public Serializable serializeState() { /** * Deserialize the attributes of this session from a state object created by * {@link #serializeState()}. - * + * * @param state a representation of this session's serialized state */ @SuppressWarnings("unchecked") diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockJspWriter.java b/spring-test/src/main/java/org/springframework/mock/web/MockJspWriter.java index 1d5bf928bf82..0dfb31b007dc 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockJspWriter.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockJspWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockPageContext.java b/spring-test/src/main/java/org/springframework/mock/web/MockPageContext.java index 0bfccf326dfe..5e355c50a6ca 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockPageContext.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockPageContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockServletConfig.java b/spring-test/src/main/java/org/springframework/mock/web/MockServletConfig.java index c62ec1520d05..90e9dea3b6f5 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockServletConfig.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockServletConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/PassThroughFilterChain.java b/spring-test/src/main/java/org/springframework/mock/web/PassThroughFilterChain.java index b3484a0a83a2..c2de4d2fccf9 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/PassThroughFilterChain.java +++ b/spring-test/src/main/java/org/springframework/mock/web/PassThroughFilterChain.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/package-info.java b/spring-test/src/main/java/org/springframework/mock/web/package-info.java index b97ebd68a84d..be8cb8601c87 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/package-info.java +++ b/spring-test/src/main/java/org/springframework/mock/web/package-info.java @@ -4,7 +4,7 @@ * A comprehensive set of Servlet API 2.5 mock objects, * targeted at usage with Spring's web MVC framework. * Useful for testing web contexts and controllers. - * + * *

      More convenient to use than dynamic mock objects * (EasyMock) or * existing Servlet API mock objects diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockActionResponse.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockActionResponse.java index bec6687887c5..2ca21a472b19 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockActionResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockActionResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockBaseURL.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockBaseURL.java index aad992058b9e..5072ede8bb4a 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockBaseURL.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockBaseURL.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockClientDataRequest.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockClientDataRequest.java index 8f36c3a76405..f6a850c7aa30 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockClientDataRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockClientDataRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,4 +125,4 @@ public String getMethod() { return this.method; } -} \ No newline at end of file +} diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEvent.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEvent.java index 0dc7efaba8dd..7f5ad3fe9627 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEvent.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,4 +85,4 @@ public Serializable getValue() { return this.value; } -} \ No newline at end of file +} diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEventRequest.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEventRequest.java index 2406f18d01ca..a2850e3c1f7f 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEventRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockEventRequest.java @@ -85,4 +85,4 @@ public String getMethod() { return this.method; } -} \ No newline at end of file +} diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockMimeResponse.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockMimeResponse.java index e606fc808d29..0d2bab32e370 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockMimeResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockMimeResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortalContext.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortalContext.java index 949d077b9a26..2895914662b0 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortalContext.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortalContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletConfig.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletConfig.java index d69e75d0c111..9d3a878026ab 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletConfig.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,15 +95,15 @@ public MockPortletConfig(PortletContext portletContext, String portletName) { this.portletName = portletName; } - + public String getPortletName() { return this.portletName; } - + public PortletContext getPortletContext() { return this.portletContext; } - + public void setResourceBundle(Locale locale, ResourceBundle resourceBundle) { Assert.notNull(locale, "Locale must not be null"); this.resourceBundles.put(locale, resourceBundle); diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletContext.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletContext.java index 45db454d8b25..b1193ff5e1ed 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletContext.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public class MockPortletContext implements PortletContext { private final Log logger = LogFactory.getLog(getClass()); private final String resourceBasePath; - + private final ResourceLoader resourceLoader; private final Map attributes = new LinkedHashMap(); @@ -70,7 +70,7 @@ public class MockPortletContext implements PortletContext { /** - * Create a new MockPortletContext with no base path and a + * Create a new MockPortletContext with no base path and a * DefaultResourceLoader (i.e. the classpath root as WAR root). * @see org.springframework.core.io.DefaultResourceLoader */ @@ -125,7 +125,7 @@ protected String getResourceLocation(String path) { return this.resourceBasePath + path; } - + public String getServerInfo() { return "MockPortal/1.0"; } @@ -160,7 +160,7 @@ public int getMajorVersion() { public int getMinorVersion() { return 0; } - + public String getMimeType(String filePath) { return MimeTypeResolver.getMimeType(filePath); } diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletPreferences.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletPreferences.java index 92ee6c0a4650..7c5fef116b03 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletPreferences.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequest.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequest.java index e302a86e77ad..7281894d5135 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequest.java @@ -42,7 +42,7 @@ /** * Mock implementation of the {@link javax.portlet.PortletRequest} interface. - * + * * @author John A. Lewis * @author Juergen Hoeller * @since 2.0 @@ -103,7 +103,7 @@ public class MockPortletRequest implements PortletRequest { /** * Create a new MockPortletRequest with a default {@link MockPortalContext} * and a default {@link MockPortletContext}. - * + * * @see MockPortalContext * @see MockPortletContext */ @@ -113,7 +113,7 @@ public MockPortletRequest() { /** * Create a new MockPortletRequest with a default {@link MockPortalContext}. - * + * * @param portletContext the PortletContext that the request runs in * @see MockPortalContext */ @@ -123,7 +123,7 @@ public MockPortletRequest(PortletContext portletContext) { /** * Create a new MockPortletRequest. - * + * * @param portalContext the PortalContext that the request runs in * @param portletContext the PortletContext that the request runs in */ diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java index ca8695f90e26..70fd67c1b139 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletResponse.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletResponse.java index b556209fcd37..8adc809fcfcc 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletSession.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletSession.java index d2c84be7ea07..93800340b857 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletSession.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public MockPortletSession(PortletContext portletContext) { this.portletContext = (portletContext != null ? portletContext : new MockPortletContext()); } - + public Object getAttribute(String name) { return this.portletAttributes.get(name); } diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletURL.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletURL.java index 12abdf57c931..d8c5dd3ec9b3 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletURL.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockPortletURL.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockRenderResponse.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockRenderResponse.java index a2feeb3726df..464b889467e9 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockRenderResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockRenderResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceRequest.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceRequest.java index 7cce4ba3c6d0..2148bd3e91d3 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceURL.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceURL.java index cce36b18d552..d9a42c8dce84 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceURL.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockResourceURL.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java index 685365844719..8fe1e42cdcca 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,4 +151,4 @@ public Serializable getEvent(String name) { return this.events.get(new QName(name)); } -} \ No newline at end of file +} diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java index 8a88066c9352..75d52b5e4cf2 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/mock/web/portlet/package-info.java b/spring-test/src/main/java/org/springframework/mock/web/portlet/package-info.java index db777eec2859..3c28fee42b43 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/portlet/package-info.java +++ b/spring-test/src/main/java/org/springframework/mock/web/portlet/package-info.java @@ -4,7 +4,7 @@ * A comprehensive set of Portlet API 2.0 mock objects, * targeted at usage with Spring's web MVC framework. * Useful for testing web contexts and controllers. - * + * *

      More convenient to use than dynamic mock objects * (EasyMock) or * existing Portlet API mock objects. diff --git a/spring-test/src/main/java/org/springframework/test/AssertThrows.java b/spring-test/src/main/java/org/springframework/test/AssertThrows.java index 0224a26e6e92..35a275f2f9ca 100644 --- a/spring-test/src/main/java/org/springframework/test/AssertThrows.java +++ b/spring-test/src/main/java/org/springframework/test/AssertThrows.java @@ -166,7 +166,7 @@ protected String getFailureMessage() { * {@link #test() test logic} and the * {@link #checkExceptionExpectations(Exception) checking} of the * resulting (expected) {@link java.lang.Exception}. - * @see #test() + * @see #test() * @see #doFail() * @see #checkExceptionExpectations(Exception) */ diff --git a/spring-test/src/main/java/org/springframework/test/ConditionalTestCase.java b/spring-test/src/main/java/org/springframework/test/ConditionalTestCase.java index a8448f228c8e..2869f258b78c 100644 --- a/spring-test/src/main/java/org/springframework/test/ConditionalTestCase.java +++ b/spring-test/src/main/java/org/springframework/test/ConditionalTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java b/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java index e129e49428ce..c9e9921ba630 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/DirtiesContext.java @@ -49,7 +49,7 @@ * AFTER_EACH_TEST_METHOD}, the context will be marked dirty after each test * method in the class. *

      - * + * * @author Sam Brannen * @author Rod Johnson * @since 2.0 diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java b/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java index b5f8584dfec0..91962ee82731 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ExpectedException.java @@ -25,12 +25,12 @@ /** * Test annotation to indicate that a test method is required to throw the * specified exception. - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 * @deprecated as of Spring 3.1 in favor of using built-in support for declaring - * expected exceptions in the underlying testing framework (e.g., JUnit, TestNG, etc.) + * expected exceptions in the underlying testing framework (e.g., JUnit, TestNG, etc.) */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java b/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java index 47d6f57628ac..8eb649d291f6 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/IfProfileValue.java @@ -41,7 +41,7 @@ * {@link ProfileValueSource} implementation, you can configure a test method to * run only on Java VMs from Sun Microsystems as follows: *

      - * + * *
        * @IfProfileValue(name = "java.vendor", value = "Sun Microsystems Inc.")
        * public void testSomething() {
      @@ -54,14 +54,14 @@
        * (assuming a {@link ProfileValueSource} has been appropriately configured for
        * the "test-groups" name):
        * 

      - * + * *
        * @IfProfileValue(name = "test-groups", values = { "unit-tests", "integration-tests" })
        * public void testWhichRunsForUnitOrIntegrationTestGroups() {
        * 	// ...
        * }
        * 
      - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 diff --git a/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java b/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java index ade7b71fb71c..76983acf7287 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/NotTransactional.java @@ -24,7 +24,7 @@ /** * Test annotation to indicate that a method is not transactional. - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java index 5c195c85e8e4..e21ace4ce784 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueSourceConfiguration.java @@ -30,7 +30,7 @@ * profile values configured via the {@link IfProfileValue * @IfProfileValue} annotation. *

      - * + * * @author Sam Brannen * @since 2.5 * @see ProfileValueSource @@ -48,7 +48,7 @@ * The type of {@link ProfileValueSource} to use when retrieving * profile values. *

      - * + * * @see SystemProfileValueSource */ Class value() default SystemProfileValueSource.class; diff --git a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java index f43ea26f8c61..fc912a798c1c 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/ProfileValueUtils.java @@ -27,7 +27,7 @@ /** * General utility methods for working with profile values. - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 @@ -51,7 +51,7 @@ public abstract class ProfileValueUtils { * @ProfileValueSourceConfiguration} is not present on the specified * class or if a custom {@link ProfileValueSource} is not declared, the * default {@link SystemProfileValueSource} will be returned instead. - * + * * @param testClass The test class for which the ProfileValueSource should * be retrieved * @return the configured (or default) ProfileValueSource for the specified @@ -108,7 +108,7 @@ public static ProfileValueSource retrieveProfileValueSource(Class testClass) *

      * Defaults to true if no {@link IfProfileValue * @IfProfileValue} annotation is declared. - * + * * @param testClass the test class * @return true if the test is enabled in the current * environment @@ -127,7 +127,7 @@ public static boolean isTestEnabledInThisEnvironment(Class testClass) { *

      * Defaults to true if no {@link IfProfileValue * @IfProfileValue} annotation is declared. - * + * * @param testMethod the test method * @param testClass the test class * @return true if the test is enabled in the current @@ -146,7 +146,7 @@ public static boolean isTestEnabledInThisEnvironment(Method testMethod, Class *

      * Defaults to true if no {@link IfProfileValue * @IfProfileValue} annotation is declared. - * + * * @param profileValueSource the ProfileValueSource to use to determine if * the test is enabled * @param testMethod the test method @@ -172,7 +172,7 @@ public static boolean isTestEnabledInThisEnvironment(ProfileValueSource profileV * Determine if the value (or one of the values) * in the supplied {@link IfProfileValue @IfProfileValue} annotation is * enabled in the current environment. - * + * * @param profileValueSource the ProfileValueSource to use to determine if * the test is enabled * @param ifProfileValue the annotation to introspect; may be diff --git a/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java b/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java index f0c7591ac8b8..7ab790681379 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/Repeat.java @@ -28,7 +28,7 @@ * Note that the scope of execution to be repeated includes execution of the * test method itself as well as any set up or tear down of * the test fixture. - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 diff --git a/spring-test/src/main/java/org/springframework/test/annotation/Rollback.java b/spring-test/src/main/java/org/springframework/test/annotation/Rollback.java index 052b419f95d6..56c29482a075 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/Rollback.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/Rollback.java @@ -27,7 +27,7 @@ * test method should be rolled back after the test method has * completed. If true, the transaction will be rolled back; * otherwise, the transaction will be committed. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/main/java/org/springframework/test/annotation/Timed.java b/spring-test/src/main/java/org/springframework/test/annotation/Timed.java index 94f7d0df148f..96729e409e4c 100644 --- a/spring-test/src/main/java/org/springframework/test/annotation/Timed.java +++ b/spring-test/src/main/java/org/springframework/test/annotation/Timed.java @@ -36,7 +36,7 @@ * {@link Repeat repetitions} of the test, and any set up or * tear down of the test fixture. *

      - * + * * @author Rod Johnson * @author Sam Brannen * @since 2.0 diff --git a/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java b/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java index b0bff1db9a4c..628e665745b4 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java +++ b/spring-test/src/main/java/org/springframework/test/context/ActiveProfiles.java @@ -45,7 +45,7 @@ /** * Alias for {@link #profiles}. - * + * *

      This attribute may not be used in conjunction * with {@link #profiles}, but it may be used instead of * {@link #profiles}. @@ -54,7 +54,7 @@ /** * The bean definition profiles to activate. - * + * *

      This attribute may not be used in conjunction * with {@link #value}, but it may be used instead of * {@link #value}. @@ -88,7 +88,7 @@ * public class BaseTest { * // ... * } - * + * * @ActiveProfiles("extended") * @ContextConfiguration * public class ExtendedTest extends BaseTest { @@ -96,7 +96,7 @@ * } *

      * - *

      Note: {@code @ActiveProfiles} can be used when loading an + *

      Note: {@code @ActiveProfiles} can be used when loading an * {@code ApplicationContext} from path-based resource locations or * annotated classes. * diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java index 4710ee7af978..9358a8b953b6 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java @@ -81,7 +81,7 @@ /** * Alias for {@link #locations}. - * + * *

      This attribute may not be used in conjunction * with {@link #locations} or {@link #classes}, but it may be used * instead of {@link #locations}. @@ -93,7 +93,7 @@ /** * The resource locations to use for loading an * {@link org.springframework.context.ApplicationContext ApplicationContext}. - * + * *

      Check out the Javadoc for * {@link org.springframework.test.context.support.AbstractContextLoader#modifyLocations * AbstractContextLoader.modifyLocations()} for details on how a location @@ -102,7 +102,7 @@ * {@link org.springframework.test.context.support.AbstractContextLoader#generateDefaultLocations * AbstractContextLoader.generateDefaultLocations()} for details on the default * locations that are going to be used if none are specified. - * + * *

      Note that the above-mentioned default rules only apply for a standard * {@link org.springframework.test.context.support.AbstractContextLoader * AbstractContextLoader} subclass such as @@ -111,7 +111,7 @@ * used at runtime if locations are configured. See the * documentation for {@link #loader} for further details regarding default * loaders. - * + * *

      This attribute may not be used in conjunction with * {@link #value} or {@link #classes}, but it may be used instead of * {@link #value}. @@ -123,14 +123,14 @@ /** * The annotated classes to use for loading an * {@link org.springframework.context.ApplicationContext ApplicationContext}. - * + * *

      Check out the Javadoc for * {@link org.springframework.test.context.support.AnnotationConfigContextLoader#detectDefaultConfigurationClasses * AnnotationConfigContextLoader.detectDefaultConfigurationClasses()} for details * on how default configuration classes will be detected if no * annotated classes are specified. See the documentation for * {@link #loader} for further details regarding default loaders. - * + * *

      This attribute may not be used in conjunction with * {@link #locations} or {@link #value}. * @@ -173,12 +173,12 @@ * resource locations or annotated classes defined by test superclasses. * Thus, subclasses have the option of extending the list of resource * locations or annotated classes. - * + * *

      If inheritLocations is set to false, the * resource locations or annotated classes for the annotated class - * will shadow and effectively replace any resource locations + * will shadow and effectively replace any resource locations * or annotated classes defined by superclasses. - * + * *

      In the following example that uses path-based resource locations, the * {@link org.springframework.context.ApplicationContext ApplicationContext} * for {@code ExtendedTest} will be loaded from @@ -191,18 +191,18 @@ * public class BaseTest { * // ... * } - * + * * @ContextConfiguration("extended-context.xml") * public class ExtendedTest extends BaseTest { * // ... * } * - * + * *

      Similarly, in the following example that uses annotated * classes, the * {@link org.springframework.context.ApplicationContext ApplicationContext} * for {@code ExtendedTest} will be loaded from the - * {@code BaseConfig} and {@code ExtendedConfig} + * {@code BaseConfig} and {@code ExtendedConfig} * configuration classes, in that order. Beans defined in * {@code ExtendedConfig} may therefore override those defined in * {@code BaseConfig}. @@ -211,7 +211,7 @@ * public class BaseTest { * // ... * } - * + * * @ContextConfiguration(classes=ExtendedConfig.class) * public class ExtendedTest extends BaseTest { * // ... @@ -263,12 +263,12 @@ * The type of {@link SmartContextLoader} (or {@link ContextLoader}) to use * for loading an {@link org.springframework.context.ApplicationContext * ApplicationContext}. - * + * *

      If not specified, the loader will be inherited from the first superclass * that is annotated with {@code @ContextConfiguration} and specifies an * explicit loader. If no class in the hierarchy specifies an explicit * loader, a default loader will be used instead. - * + * *

      The default concrete implementation chosen at runtime will be * {@link org.springframework.test.context.support.DelegatingSmartContextLoader * DelegatingSmartContextLoader}. For further details on the default behavior diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/ContextLoader.java index f28364a9b4b3..2db039ad32c7 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextLoader.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextLoader.java @@ -21,7 +21,7 @@ /** * Strategy interface for loading an {@link ApplicationContext application context} * for an integration test managed by the Spring TestContext Framework. - * + * *

      Note: as of Spring 3.1, implement {@link SmartContextLoader} instead * of this interface in order to provide support for annotated classes, active * bean definition profiles, and application context initializers. diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java b/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java index 01f368c0113b..7c57b5e1baa9 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java @@ -42,7 +42,7 @@ * Utility methods for working with {@link ContextLoader ContextLoaders} and * {@link SmartContextLoader SmartContextLoaders} and resolving resource locations, * annotated classes, and active bean definition profiles. - * + * * @author Sam Brannen * @since 3.1 * @see ContextLoader @@ -137,9 +137,9 @@ static ContextLoader resolveContextLoader(Class testClass, * {@code ContextLoader} class to use; must not be {@code null} or empty * @return the {@code ContextLoader} class to use for the supplied test class * @throws IllegalArgumentException if {@code @ContextConfiguration} is not - * present on the supplied test class + * present on the supplied test class * @throws IllegalStateException if the default {@code ContextLoader} class - * could not be loaded + * could not be loaded */ @SuppressWarnings("unchecked") static Class resolveContextLoaderClass(Class testClass, diff --git a/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java index 6fc402e92ffb..393306728600 100644 --- a/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java @@ -41,15 +41,15 @@ * {@link ContextConfiguration#inheritLocations inheritLocations} and * {@link ActiveProfiles#inheritProfiles inheritProfiles} flags in * {@code @ContextConfiguration} and {@code @ActiveProfiles}, respectively. - * + * *

      A {@link SmartContextLoader} uses {@code MergedContextConfiguration} * to load an {@link org.springframework.context.ApplicationContext ApplicationContext}. - * + * *

      {@code MergedContextConfiguration} is also used by the {@link TestContext} * as the context cache key for caching an * {@link org.springframework.context.ApplicationContext ApplicationContext} * that was loaded using properties of this {@code MergedContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 * @see ContextConfiguration @@ -118,7 +118,7 @@ protected static String nullSafeToString(ContextLoader contextLoader) { * classes, or activeProfiles an empty array will * be stored instead. Furthermore, active profiles will be sorted, and duplicate * profiles will be removed. - * + * * @param testClass the test class for which the configuration was merged * @param locations the merged resource locations * @param classes the merged annotated classes diff --git a/spring-test/src/main/java/org/springframework/test/context/SmartContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/SmartContextLoader.java index ba5f22bd66b1..54a44174fefa 100644 --- a/spring-test/src/main/java/org/springframework/test/context/SmartContextLoader.java +++ b/spring-test/src/main/java/org/springframework/test/context/SmartContextLoader.java @@ -32,7 +32,7 @@ *

      See the Javadoc for * {@link org.springframework.test.context.ContextConfiguration @ContextConfiguration} * for a definition of annotated class. - * + * *

      Clients of a {@code SmartContextLoader} should call * {@link #processContextConfiguration(ContextConfigurationAttributes) * processContextConfiguration()} prior to calling diff --git a/spring-test/src/main/java/org/springframework/test/context/TestContext.java b/spring-test/src/main/java/org/springframework/test/context/TestContext.java index 6d3a90c663d0..02ac2bfe5694 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestContext.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestContext.java @@ -28,7 +28,7 @@ /** * TestContext encapsulates the context in which a test is executed, * agnostic of the actual testing framework in use. - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 diff --git a/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java b/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java index 088d8867a3e3..89d3aa5fbf51 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java @@ -64,7 +64,7 @@ * after class methods of a particular testing framework (e.g., JUnit * 4's {@link org.junit.AfterClass @AfterClass}) * - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 @@ -448,4 +448,4 @@ public void afterTestClass() throws Exception { } } -} \ No newline at end of file +} diff --git a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java index 2b67223d9385..a76134c23f8f 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java @@ -41,7 +41,7 @@ * {@link org.springframework.test.context.transaction.TransactionalTestExecutionListener * TransactionalTestExecutionListener} * - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 @@ -58,7 +58,7 @@ public interface TestExecutionListener { * If a given testing framework (e.g., JUnit 3.8) does not support * before class lifecycle callbacks, this method will not be called * for that framework. - * + * * @param testContext the test context for the test; never null * @throws Exception allows any exception to propagate */ @@ -70,7 +70,7 @@ public interface TestExecutionListener { *

      * This method should be called immediately after instantiation of the test * instance but prior to any framework-specific lifecycle callbacks. - * + * * @param testContext the test context for the test; never null * @throws Exception allows any exception to propagate */ @@ -84,7 +84,7 @@ public interface TestExecutionListener { *

      * This method should be called immediately prior to framework-specific * before lifecycle callbacks. - * + * * @param testContext the test context in which the test method will be * executed; never null * @throws Exception allows any exception to propagate @@ -99,7 +99,7 @@ public interface TestExecutionListener { *

      * This method should be called immediately after framework-specific * after lifecycle callbacks. - * + * * @param testContext the test context in which the test method was * executed; never null * @throws Exception allows any exception to propagate @@ -116,7 +116,7 @@ public interface TestExecutionListener { * If a given testing framework (e.g., JUnit 3.8) does not support * after class lifecycle callbacks, this method will not be called * for that framework. - * + * * @param testContext the test context for the test; never null * @throws Exception allows any exception to propagate */ diff --git a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java index a7517418ffe2..86d1d8dc437b 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestExecutionListeners.java @@ -29,7 +29,7 @@ * be registered with a {@link TestContextManager}. Typically, * @TestExecutionListeners will be used in conjunction with * {@link ContextConfiguration @ContextConfiguration}. - * + * * @author Sam Brannen * @since 2.5 * @see TestExecutionListener @@ -47,7 +47,7 @@ * The {@link TestExecutionListener TestExecutionListeners} to register with * a {@link TestContextManager}. *

      - * + * * @see org.springframework.test.context.support.DependencyInjectionTestExecutionListener * @see org.springframework.test.context.support.DirtiesContextTestExecutionListener * @see org.springframework.test.context.transaction.TransactionalTestExecutionListener @@ -78,14 +78,14 @@ * DirtiesContextTestExecutionListener, and * TransactionalTestExecutionListener, in that order. *

      - * + * *
       	 * @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class,
            *    DirtiesContextTestExecutionListener.class })
       	 * public abstract class AbstractBaseTest {
       	 * 	// ...
       	 * }
      -	 * 
      +	 *
       	 * @TestExecutionListeners(TransactionalTestExecutionListener.class)
       	 * public class TransactionalTest extends AbstractBaseTest {
       	 * 	// ...
      diff --git a/spring-test/src/main/java/org/springframework/test/context/junit38/AbstractJUnit38SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit38/AbstractJUnit38SpringContextTests.java
      index f4766354161b..958904e2d087 100644
      --- a/spring-test/src/main/java/org/springframework/test/context/junit38/AbstractJUnit38SpringContextTests.java
      +++ b/spring-test/src/main/java/org/springframework/test/context/junit38/AbstractJUnit38SpringContextTests.java
      @@ -99,7 +99,7 @@
        * {@link org.springframework.test.context.TestExecutionListener#afterTestClass(org.springframework.test.context.TestContext)
        * afterTestClass()}
        * 
      - * 
      + *
        * @author Sam Brannen
        * @author Juergen Hoeller
        * @since 2.5
      @@ -164,7 +164,7 @@ public AbstractJUnit38SpringContextTests() {
       	 * supplied name; initializes the internal
       	 * {@link TestContextManager} for the current test; and retrieves the
       	 * configured (or default) {@link ProfileValueSource}.
      -	 * 
      +	 *
       	 * @param name the name of the current test to execute
       	 */
       	public AbstractJUnit38SpringContextTests(String name) {
      @@ -200,7 +200,7 @@ public final void setApplicationContext(final ApplicationContext applicationCont
       	 * 
    • Provides support for {@link ExpectedException * @ExpectedException}.
    • * - * + * * @see ProfileValueUtils#isTestEnabledInThisEnvironment */ @Override @@ -242,7 +242,7 @@ private Method getTestMethod() { /** * Runs a timed test via the supplied {@link TestExecutionCallback} * , providing support for the {@link Timed @Timed} annotation. - * + * * @param tec the test execution callback to run * @param testMethod the actual test method: used to retrieve the * timeout @@ -273,7 +273,7 @@ private void runTestTimed(TestExecutionCallback tec, Method testMethod) throws T * Runs a test via the supplied {@link TestExecutionCallback}, providing * support for the {@link ExpectedException @ExpectedException} and * {@link Repeat @Repeat} annotations. - * + * * @param tec the test execution callback to run * @param testMethod the actual test method: used to retrieve the * {@link ExpectedException @ExpectedException} and {@link Repeat @@ -320,7 +320,7 @@ private void runTest(TestExecutionCallback tec, Method testMethod) throws Throwa * Calls {@link TestContextManager#beforeTestMethod(Object,Method)} and * {@link TestContextManager#afterTestMethod(Object,Method,Throwable)} at * the appropriate test execution points. - * + * * @param testMethod the test method to run * @throws Throwable if any exception is thrown * @see #runBare() @@ -374,7 +374,7 @@ private void runManaged(Method testMethod) throws Throwable { * Records the supplied test method as disabled in the current * environment by incrementing the total number of disabled tests and * logging a debug message. - * + * * @param testMethod the test method that is disabled. * @see #getDisabledTestCount() */ diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java index 19806cd16324..286c00958782 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractJUnit4SpringContextTests.java @@ -51,7 +51,8 @@ * {@link SpringJUnit4ClassRunner}, {@link ContextConfiguration * @ContextConfiguration}, {@link TestExecutionListeners * @TestExecutionListeners}, etc. - * + *

      + * * @author Sam Brannen * @since 2.5 * @see ContextConfiguration diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java index a0cef632898a..a206e4dc3024 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.java @@ -56,7 +56,8 @@ * @ContextConfiguration}, {@link TestExecutionListeners * @TestExecutionListeners}, {@link Transactional @Transactional}, * etc. - * + *

      + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java b/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java index 2d184156ee76..9351f2f9085c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunner.java @@ -79,7 +79,7 @@ * NOTE: As of Spring 3.0, SpringJUnit4ClassRunner requires * JUnit 4.5+. *

      - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java index b0ca874ca363..61d721ebf9be 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestClassCallbacks.java @@ -29,7 +29,7 @@ * be plugged into the JUnit execution chain by calling * {@link TestContextManager#afterTestClass() afterTestClass()} on the supplied * {@link TestContextManager}. - * + * * @see #evaluate() * @see RunBeforeTestMethodCallbacks * @author Sam Brannen @@ -45,7 +45,7 @@ public class RunAfterTestClassCallbacks extends Statement { /** * Constructs a new RunAfterTestClassCallbacks statement. - * + * * @param next the next Statement in the execution chain * @param testContextManager the TestContextManager upon which to call * afterTestClass() diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java index 6e06239a122c..af2f1c23a0c2 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestClassCallbacks.java @@ -25,7 +25,7 @@ * be plugged into the JUnit execution chain by calling * {@link TestContextManager#beforeTestClass() beforeTestClass()} on the * supplied {@link TestContextManager}. - * + * * @see #evaluate() * @see RunAfterTestMethodCallbacks * @author Sam Brannen @@ -40,7 +40,7 @@ public class RunBeforeTestClassCallbacks extends Statement { /** * Constructs a new RunBeforeTestClassCallbacks statement. - * + * * @param next the next Statement in the execution chain * @param testContextManager the TestContextManager upon which to call * beforeTestClass() diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java index 8833c390b16a..1c5e59be6f5a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunBeforeTestMethodCallbacks.java @@ -27,7 +27,7 @@ * be plugged into the JUnit execution chain by calling * {@link TestContextManager#beforeTestMethod(Object, Method) * beforeTestMethod()} on the supplied {@link TestContextManager}. - * + * * @see #evaluate() * @see RunAfterTestMethodCallbacks * @author Sam Brannen @@ -46,7 +46,7 @@ public class RunBeforeTestMethodCallbacks extends Statement { /** * Constructs a new RunBeforeTestMethodCallbacks statement. - * + * * @param next the next Statement in the execution chain * @param testInstance the current test instance (never null) * @param testMethod the test method which is about to be executed on the diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java index 62aee02728f0..a9a10b8b8010 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringFailOnTimeout.java @@ -26,7 +26,7 @@ * which adds support for Spring's {@link Timed @Timed} annotation by throwing * an exception if the next statement in the execution chain takes more than the * specified number of milliseconds. - * + * * @see #evaluate() * @author Sam Brannen * @since 3.0 @@ -40,7 +40,7 @@ public class SpringFailOnTimeout extends Statement { /** * Constructs a new SpringFailOnTimeout statement. - * + * * @param next the next Statement in the execution chain * @param timeout the configured timeout for the current test * @see Timed#millis() diff --git a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java index f2c79a9f3b7e..541b4ab6d69e 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit4/statements/SpringRepeat.java @@ -28,7 +28,7 @@ * SpringRepeat is a custom JUnit 4.5+ {@link Statement} which adds * support for Spring's {@link Repeat @Repeat} annotation by repeating the * test for the specified number of times. - * + * * @see #evaluate() * @author Sam Brannen * @since 3.0 @@ -46,7 +46,7 @@ public class SpringRepeat extends Statement { /** * Constructs a new SpringRepeat statement. - * + * * @param next the next Statement in the execution chain * @param testMethod the current test method * @param repeat the configured repeat count for the current test method diff --git a/spring-test/src/main/java/org/springframework/test/context/package-info.java b/spring-test/src/main/java/org/springframework/test/context/package-info.java index f549babc39d7..b02e0b447b23 100644 --- a/spring-test/src/main/java/org/springframework/test/context/package-info.java +++ b/spring-test/src/main/java/org/springframework/test/context/package-info.java @@ -4,7 +4,7 @@ * agnostic of the actual testing framework in use. The same techniques and * annotation-based configuration used in, for example, a JUnit 4.5+ environment * can also be applied to tests written with TestNG, etc. - * + * *

      In addition to providing generic and extensible testing infrastructure, * the Spring TestContext Framework provides out-of-the-box support for * Spring-specific integration testing functionality such as context management diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestExecutionListener.java index e57d1a1dafcf..beaa77ca1a1e 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestExecutionListener.java @@ -23,7 +23,7 @@ * Abstract implementation of the {@link TestExecutionListener} interface which * provides empty method stubs. Subclasses can extend this class and override * only those methods suitable for the task at hand. - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java index 749f08cca57a..c8ba660fbfe5 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java @@ -28,11 +28,11 @@ /** * Concrete implementation of {@link AbstractGenericContextLoader} that loads * bean definitions from annotated classes. - * + * *

      See the Javadoc for * {@link org.springframework.test.context.ContextConfiguration @ContextConfiguration} * for a definition of annotated class. - * + * *

      Note: AnnotationConfigContextLoader supports annotated classes * rather than the String-based resource locations defined by the legacy * {@link org.springframework.test.context.ContextLoader ContextLoader} API. Thus, @@ -68,7 +68,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader * {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the * supplied configuration attributes. Otherwise, properties in the supplied * configuration attributes will not be modified. - * + * * @param configAttributes the context configuration attributes to process * @see org.springframework.test.context.SmartContextLoader#processContextConfiguration(ContextConfigurationAttributes) * @see #isGenerateDefaultLocations() diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java b/spring-test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java index 4d2d7c324aef..39e70ab2e52b 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/DelegatingSmartContextLoader.java @@ -19,10 +19,25 @@ import org.springframework.test.context.SmartContextLoader; /** - * {@code DelegatingSmartContextLoader} is a concrete implementation of - * {@link AbstractDelegatingSmartContextLoader} that delegates to a - * {@link GenericXmlContextLoader} and an {@link AnnotationConfigContextLoader}. - * + * {@code DelegatingSmartContextLoader} is an implementation of the {@link SmartContextLoader} + * SPI that delegates to a set of candidate SmartContextLoaders (i.e., + * {@link GenericXmlContextLoader} and {@link AnnotationConfigContextLoader}) to + * determine which context loader is appropriate for a given test class's configuration. + * Each candidate is given a chance to {@link #processContextConfiguration process} the + * {@link ContextConfigurationAttributes} for each class in the test class hierarchy that + * is annotated with {@link ContextConfiguration @ContextConfiguration}, and the candidate + * that supports the merged, processed configuration will be used to actually + * {@link #loadContext load} the context. + * + *

      Placing an empty {@code @ContextConfiguration} annotation on a test class signals + * that default resource locations (i.e., XML configuration files) or default + * {@link org.springframework.context.annotation.Configuration configuration classes} + * should be detected. Furthermore, if a specific {@link ContextLoader} or + * {@link SmartContextLoader} is not explicitly declared via + * {@code @ContextConfiguration}, {@code DelegatingSmartContextLoader} will be used as + * the default loader, thus providing automatic support for either XML configuration + * files or annotated classes, but not both simultaneously. + * * @author Sam Brannen * @since 3.1 * @see SmartContextLoader @@ -36,8 +51,187 @@ public class DelegatingSmartContextLoader extends AbstractDelegatingSmartContext private final SmartContextLoader annotationConfigLoader = new AnnotationConfigContextLoader(); - protected SmartContextLoader getXmlLoader() { - return this.xmlLoader; + // --- SmartContextLoader -------------------------------------------------- + + private static String name(SmartContextLoader loader) { + return loader.getClass().getSimpleName(); + } + + private static void delegateProcessing(SmartContextLoader loader, ContextConfigurationAttributes configAttributes) { + if (logger.isDebugEnabled()) { + logger.debug(String.format("Delegating to %s to process context configuration %s.", name(loader), + configAttributes)); + } + loader.processContextConfiguration(configAttributes); + } + + private static boolean supports(SmartContextLoader loader, MergedContextConfiguration mergedConfig) { + if (loader instanceof AnnotationConfigContextLoader) { + return ObjectUtils.isEmpty(mergedConfig.getLocations()) && !ObjectUtils.isEmpty(mergedConfig.getClasses()); + } + else { + return !ObjectUtils.isEmpty(mergedConfig.getLocations()) && ObjectUtils.isEmpty(mergedConfig.getClasses()); + } + } + + /** + * Delegates to candidate {@code SmartContextLoaders} to process the supplied + * {@link ContextConfigurationAttributes}. + * + *

      Delegation is based on explicit knowledge of the implementations of + * {@link GenericXmlContextLoader} and {@link AnnotationConfigContextLoader}. + * Specifically, the delegation algorithm is as follows: + * + *

        + *
      • If the resource locations or annotated classes in the supplied + * {@code ContextConfigurationAttributes} are not empty, the appropriate + * candidate loader will be allowed to process the configuration as is, + * without any checks for detection of defaults.
      • + *
      • Otherwise, {@code GenericXmlContextLoader} will be allowed to process + * the configuration in order to detect default resource locations. If + * {@code GenericXmlContextLoader} detects default resource locations, + * an {@code info} message will be logged.
      • + *
      • Subsequently, {@code AnnotationConfigContextLoader} will be allowed to + * process the configuration in order to detect default configuration classes. + * If {@code AnnotationConfigContextLoader} detects default configuration + * classes, an {@code info} message will be logged.
      • + *
      + * + * @param configAttributes the context configuration attributes to process + * @throws IllegalArgumentException if the supplied configuration attributes are + * null, or if the supplied configuration attributes include both + * resource locations and annotated classes + * @throws IllegalStateException if {@code GenericXmlContextLoader} detects default + * configuration classes; if {@code AnnotationConfigContextLoader} detects default + * resource locations; if neither candidate loader detects defaults for the supplied + * context configuration; or if both candidate loaders detect defaults for the + * supplied context configuration + */ + public void processContextConfiguration(final ContextConfigurationAttributes configAttributes) { + + Assert.notNull(configAttributes, "configAttributes must not be null"); + Assert.isTrue(!(configAttributes.hasLocations() && configAttributes.hasClasses()), String.format( + "Cannot process locations AND classes for context " + + "configuration %s; configure one or the other, but not both.", configAttributes)); + + // If the original locations or classes were not empty, there's no + // need to bother with default detection checks; just let the + // appropriate loader process the configuration. + if (configAttributes.hasLocations()) { + delegateProcessing(xmlLoader, configAttributes); + } + else if (configAttributes.hasClasses()) { + delegateProcessing(annotationConfigLoader, configAttributes); + } + else { + // Else attempt to detect defaults... + + // Let the XML loader process the configuration. + delegateProcessing(xmlLoader, configAttributes); + boolean xmlLoaderDetectedDefaults = configAttributes.hasLocations(); + + if (xmlLoaderDetectedDefaults) { + if (logger.isInfoEnabled()) { + logger.info(String.format("%s detected default locations for context configuration %s.", + name(xmlLoader), configAttributes)); + } + } + + if (configAttributes.hasClasses()) { + throw new IllegalStateException(String.format( + "%s should NOT have detected default configuration classes for context configuration %s.", + name(xmlLoader), configAttributes)); + } + + // Now let the annotation config loader process the configuration. + delegateProcessing(annotationConfigLoader, configAttributes); + + if (configAttributes.hasClasses()) { + if (logger.isInfoEnabled()) { + logger.info(String.format( + "%s detected default configuration classes for context configuration %s.", + name(annotationConfigLoader), configAttributes)); + } + } + + if (!xmlLoaderDetectedDefaults && configAttributes.hasLocations()) { + throw new IllegalStateException(String.format( + "%s should NOT have detected default locations for context configuration %s.", + name(annotationConfigLoader), configAttributes)); + } + + // If neither loader detected defaults, throw an exception. + if (!configAttributes.hasResources()) { + throw new IllegalStateException(String.format( + "Neither %s nor %s was able to detect defaults for context configuration %s.", name(xmlLoader), + name(annotationConfigLoader), configAttributes)); + } + + if (configAttributes.hasLocations() && configAttributes.hasClasses()) { + String message = String.format( + "Configuration error: both default locations AND default configuration classes " + + "were detected for context configuration %s; configure one or the other, but not both.", + configAttributes); + logger.error(message); + throw new IllegalStateException(message); + } + } + } + + /** + * Delegates to an appropriate candidate {@code SmartContextLoader} to load + * an {@link ApplicationContext}. + * + *

      Delegation is based on explicit knowledge of the implementations of + * {@link GenericXmlContextLoader} and {@link AnnotationConfigContextLoader}. + * Specifically, the delegation algorithm is as follows: + * + *

        + *
      • If the resource locations in the supplied {@code MergedContextConfiguration} + * are not empty and the annotated classes are empty, + * {@code GenericXmlContextLoader} will load the {@code ApplicationContext}.
      • + *
      • If the annotated classes in the supplied {@code MergedContextConfiguration} + * are not empty and the resource locations are empty, + * {@code AnnotationConfigContextLoader} will load the {@code ApplicationContext}.
      • + *
      + * + * @param mergedConfig the merged context configuration to use to load the application context + * @throws IllegalArgumentException if the supplied merged configuration is null + * @throws IllegalStateException if neither candidate loader is capable of loading an + * {@code ApplicationContext} from the supplied merged context configuration + */ + public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception { + Assert.notNull(mergedConfig, "mergedConfig must not be null"); + + List candidates = Arrays.asList(xmlLoader, annotationConfigLoader); + + for (SmartContextLoader loader : candidates) { + // Determine if each loader can load a context from the + // mergedConfig. If it can, let it; otherwise, keep iterating. + if (supports(loader, mergedConfig)) { + if (logger.isDebugEnabled()) { + logger.debug(String.format("Delegating to %s to load context from %s.", name(loader), mergedConfig)); + } + return loader.loadContext(mergedConfig); + } + } + + throw new IllegalStateException(String.format( + "Neither %s nor %s was able to load an ApplicationContext from %s.", name(xmlLoader), + name(annotationConfigLoader), mergedConfig)); + } + + // --- ContextLoader ------------------------------------------------------- + + /** + * {@code DelegatingSmartContextLoader} does not support the + * {@link ContextLoader#processLocations(Class, String...)} method. Call + * {@link #processContextConfiguration(ContextConfigurationAttributes)} instead. + * @throws UnsupportedOperationException + */ + public String[] processLocations(Class clazz, String... locations) { + throw new UnsupportedOperationException("DelegatingSmartContextLoader does not support the ContextLoader SPI. " + + "Call processContextConfiguration(ContextConfigurationAttributes) instead."); } protected SmartContextLoader getAnnotationConfigLoader() { diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java index 36a967432208..adc3ca3b1e7a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/DependencyInjectionTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DirtiesContextTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/support/DirtiesContextTestExecutionListener.java index b59b88a93726..b5665228ef1b 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/DirtiesContextTestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/DirtiesContextTestExecutionListener.java @@ -31,7 +31,7 @@ * ApplicationContext associated with a test as dirty for * both test classes and test methods configured with the {@link DirtiesContext * @DirtiesContext} annotation. - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 diff --git a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java index 7f002792f1b9..ee397d1655ca 100644 --- a/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java +++ b/spring-test/src/main/java/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java @@ -58,7 +58,7 @@ *
    • Must have constructors which either implicitly or explicitly delegate to * {@code super();}.
    • * - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 @@ -96,7 +96,7 @@ public AbstractTestNGSpringContextTests() { /** * Set the {@link ApplicationContext} to be used by this test instance, * provided via {@link ApplicationContextAware} semantics. - * + * * @param applicationContext the applicationContext to set */ public final void setApplicationContext(ApplicationContext applicationContext) { @@ -107,7 +107,7 @@ public final void setApplicationContext(ApplicationContext applicationContext) { * Delegates to the configured {@link TestContextManager} to call * {@link TestContextManager#beforeTestClass() 'before test class'} * callbacks. - * + * * @throws Exception if a registered TestExecutionListener throws an * exception */ @@ -121,7 +121,7 @@ protected void springTestContextBeforeTestClass() throws Exception { * {@link TestContextManager#prepareTestInstance(Object) prepare} this test * instance prior to execution of any individual tests, for example for * injecting dependencies, etc. - * + * * @throws Exception if a registered TestExecutionListener throws an * exception */ @@ -134,7 +134,7 @@ protected void springTestContextPrepareTestInstance() throws Exception { * Delegates to the configured {@link TestContextManager} to * {@link TestContextManager#beforeTestMethod(Object,Method) pre-process} * the test method before the actual test is executed. - * + * * @param testMethod the test method which is about to be executed. * @throws Exception allows all exceptions to propagate. */ @@ -147,7 +147,7 @@ protected void springTestContextBeforeTestMethod(Method testMethod) throws Excep * Delegates to the {@link IHookCallBack#runTestMethod(ITestResult) test * method} in the supplied callback to execute the actual test * and then tracks the exception thrown during test execution, if any. - * + * * @see org.testng.IHookable#run(org.testng.IHookCallBack, * org.testng.ITestResult) */ @@ -165,7 +165,7 @@ public void run(IHookCallBack callBack, ITestResult testResult) { * Delegates to the configured {@link TestContextManager} to * {@link TestContextManager#afterTestMethod(Object, Method, Throwable) * post-process} the test method after the actual test has executed. - * + * * @param testMethod the test method which has just been executed on the * test instance * @throws Exception allows all exceptions to propagate @@ -183,7 +183,7 @@ protected void springTestContextAfterTestMethod(Method testMethod) throws Except /** * Delegates to the configured {@link TestContextManager} to call * {@link TestContextManager#afterTestClass() 'after test class'} callbacks. - * + * * @throws Exception if a registered TestExecutionListener throws an * exception */ diff --git a/spring-test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java b/spring-test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java index 7900cf30bfda..6ecbc5d53456 100644 --- a/spring-test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java +++ b/spring-test/src/main/java/org/springframework/test/context/transaction/AfterTransaction.java @@ -33,7 +33,7 @@ * The @AfterTransaction methods of superclasses will be * executed after those of the current class. *

      - * + * * @author Sam Brannen * @since 2.5 * @see org.springframework.transaction.annotation.Transactional diff --git a/spring-test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java b/spring-test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java index 48736b79fddc..ac7e1e62bafc 100644 --- a/spring-test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java +++ b/spring-test/src/main/java/org/springframework/test/context/transaction/BeforeTransaction.java @@ -33,7 +33,7 @@ * The @BeforeTransaction methods of superclasses will be * executed before those of the current class. *

      - * + * * @author Sam Brannen * @since 2.5 * @see org.springframework.transaction.annotation.Transactional diff --git a/spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java b/spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java index 8c2370f7a7e2..997d4c1804f1 100644 --- a/spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java +++ b/spring-test/src/main/java/org/springframework/test/jdbc/JdbcTestUtils.java @@ -34,10 +34,8 @@ import org.springframework.util.StringUtils; /** - * {@code JdbcTestUtils} is a collection of JDBC related utility functions - * intended to simplify standard database testing scenarios. - * - *

      As of Spring 3.1.3, {@code JdbcTestUtils} supersedes {@link SimpleJdbcTestUtils}. + * JdbcTestUtils is a collection of JDBC related utility methods for use in unit + * and integration testing scenarios. * * @author Thomas Risberg * @author Sam Brannen @@ -161,85 +159,13 @@ public static void executeSqlScript(JdbcTemplate jdbcTemplate, Resource resource } /** - * Execute the given SQL script. - *

      The script will typically be loaded from the classpath. There should - * be one statement per line. Any semicolons and line comments will be removed. - *

      Do not use this method to execute DDL if you expect rollback. - * @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations - * @param resource the resource (potentially associated with a specific encoding) - * to load the SQL script from - * @param continueOnError whether or not to continue without throwing an - * exception in the event of an error - * @throws DataAccessException if there is an error executing a statement - * and {@code continueOnError} is {@code false} - * @see ResourceDatabasePopulator - */ - public static void executeSqlScript(JdbcTemplate jdbcTemplate, EncodedResource resource, boolean continueOnError) - throws DataAccessException { - - if (logger.isInfoEnabled()) { - logger.info("Executing SQL script from " + resource); - } - long startTime = System.currentTimeMillis(); - List statements = new LinkedList(); - LineNumberReader reader = null; - try { - reader = new LineNumberReader(resource.getReader()); - String script = readScript(reader); - char delimiter = DEFAULT_STATEMENT_SEPARATOR; - if (!containsSqlScriptDelimiters(script, delimiter)) { - delimiter = '\n'; - } - splitSqlScript(script, delimiter, statements); - int lineNumber = 0; - for (String statement : statements) { - lineNumber++; - try { - int rowsAffected = jdbcTemplate.update(statement); - if (logger.isDebugEnabled()) { - logger.debug(rowsAffected + " rows affected by SQL: " + statement); - } - } - catch (DataAccessException ex) { - if (continueOnError) { - if (logger.isWarnEnabled()) { - logger.warn("Failed to execute SQL script statement at line " + lineNumber - + " of resource " + resource + ": " + statement, ex); - } - } - else { - throw ex; - } - } - } - long elapsedTime = System.currentTimeMillis() - startTime; - if (logger.isInfoEnabled()) { - logger.info(String.format("Executed SQL script from %s in %s ms.", resource, elapsedTime)); - } - } - catch (IOException ex) { - throw new DataAccessResourceFailureException("Failed to open SQL script from " + resource, ex); - } - finally { - try { - if (reader != null) { - reader.close(); - } - } - catch (IOException ex) { - // ignore - } - } - } - - /** - * Read a script from the provided {@code LineNumberReader}, using - * "{@code --}" as the comment prefix, and build a {@code String} containing - * the lines. - * @param lineNumberReader the {@code LineNumberReader} containing the script - * to be processed - * @return a {@code String} containing the script lines - * @see #readScript(LineNumberReader, String) + * Read a script from the LineNumberReader and build a String containing the + * lines. + * + * @param lineNumberReader the LineNumberReader containing the + * script to be processed + * @return String containing the script lines + * @throws IOException */ public static String readScript(LineNumberReader lineNumberReader) throws IOException { return readScript(lineNumberReader, DEFAULT_COMMENT_PREFIX); @@ -273,7 +199,8 @@ public static String readScript(LineNumberReader lineNumberReader, String commen } /** - * Determine if the provided SQL script contains the specified delimiter. + * Does the provided SQL script contain the specified delimiter? + * * @param script the SQL script * @param delim character delimiting each statement — typically a ';' character * @return {@code true} if the script contains the delimiter; {@code false} otherwise @@ -296,10 +223,7 @@ public static boolean containsSqlScriptDelimiters(String script, char delim) { * Split an SQL script into separate statements delimited by the provided * delimiter character. Each individual statement will be added to the * provided List. - *

      Within a statement, "{@code --}" will be used as the comment prefix; - * any text beginning with the comment prefix and extending to the end of - * the line will be omitted from the statement. In addition, multiple adjacent - * whitespace characters will be collapsed into a single space. + * * @param script the SQL script * @param delim character delimiting each statement — typically a ';' character * @param statements the list that will contain the individual statements diff --git a/spring-test/src/main/java/org/springframework/test/jpa/AbstractAspectjJpaTests.java b/spring-test/src/main/java/org/springframework/test/jpa/AbstractAspectjJpaTests.java index a47c8195eb6c..2237540b1b6e 100644 --- a/spring-test/src/main/java/org/springframework/test/jpa/AbstractAspectjJpaTests.java +++ b/spring-test/src/main/java/org/springframework/test/jpa/AbstractAspectjJpaTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java b/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java index fd18656aa9d4..5e1b0038308c 100644 --- a/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java +++ b/spring-test/src/main/java/org/springframework/test/jpa/AbstractJpaTests.java @@ -59,8 +59,8 @@ * JpaTransactionManager through the superclass. * *

      When using Xerces, make sure a post 2.0.2 version is available on the classpath - * to avoid a critical - * bug + * to avoid a critical + * bug * that leads to StackOverflow. Maven users are likely to encounter this problem since * 2.0.2 is used by default. * @@ -84,7 +84,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactionalTests { private static final String DEFAULT_ORM_XML_LOCATION = "META-INF/orm.xml"; - + /** * Map from String defining unique combination of config locations, to ApplicationContext. * Values are intentionally not strongly typed, to avoid potential class cast exceptions @@ -140,15 +140,15 @@ protected boolean shouldUseShadowLoader() { @Override public void setDirty() { - super.setDirty(); + super.setDirty(); contextCache.remove(cacheKeys()); classLoaderCache.remove(cacheKeys()); - + // If we are a shadow loader, we need to invoke - // the shadow parent to set it dirty, as + // the shadow parent to set it dirty, as // it is the shadow parent that maintains the cache state, // not the child - if (this.shadowParent != null) { + if (this.shadowParent != null) { try { Method m = shadowParent.getClass().getMethod("setDirty", (Class[]) null); m.invoke(shadowParent, (Object[]) null); @@ -159,11 +159,11 @@ public void setDirty() { } } - + @Override @SuppressWarnings({ "rawtypes", "unchecked" }) public void runBare() throws Throwable { - + // getName will return the name of the method being run. if (isDisabledInThisEnvironment(getName())) { // Let superclass log that we didn't run the test. @@ -185,7 +185,7 @@ public void runBare() throws Throwable { return; } - String combinationOfContextLocationsForThisTestClass = cacheKeys(); + String combinationOfContextLocationsForThisTestClass = cacheKeys(); ClassLoader classLoaderForThisTestClass = getClass().getClassLoader(); // save the TCCL ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); @@ -255,7 +255,7 @@ public void runBare() throws Throwable { } // create the shadowed test Class shadowedTestClass = shadowingClassLoader.loadClass(getClass().getName()); - + // So long as JUnit is excluded from shadowing we // can minimize reflective invocation here TestCase shadowedTestCase = (TestCase) BeanUtils.instantiateClass(shadowedTestClass); @@ -295,12 +295,12 @@ protected String cacheKeys() { * class to be loaded eagerly when this test case loads, creating verify errors at runtime. */ protected ClassLoader createShadowingClassLoader(ClassLoader classLoader) { - OrmXmlOverridingShadowingClassLoader orxl = new OrmXmlOverridingShadowingClassLoader(classLoader, - getActualOrmXmlLocation()); + OrmXmlOverridingShadowingClassLoader orxl = new OrmXmlOverridingShadowingClassLoader(classLoader, + getActualOrmXmlLocation()); customizeResourceOverridingShadowingClassLoader(orxl); return orxl; } - + /** * Customize the shadowing class loader. * @param shadowingClassLoader this parameter is actually of type @@ -311,7 +311,7 @@ protected ClassLoader createShadowingClassLoader(ClassLoader classLoader) { protected void customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader) { // empty } - + /** * Subclasses can override this to return the real location path for * orm.xml or null if they do not wish to find any orm.xml @@ -367,7 +367,7 @@ public void addTransformer(ClassFileTransformer transformer) { public ClassLoader getInstrumentableClassLoader() { return this.shadowingClassLoader; } - + public ClassLoader getThrowawayClassLoader() { // Be sure to copy the same resource overrides and same class file transformers: // We want the throwaway class loader to behave like the instrumentable class loader. diff --git a/spring-test/src/main/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java b/spring-test/src/main/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java index a6baeaffcd25..0f2180ebebfa 100644 --- a/spring-test/src/main/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java +++ b/spring-test/src/main/java/org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader.java @@ -31,7 +31,7 @@ * @since 2.0 */ class OrmXmlOverridingShadowingClassLoader extends ResourceOverridingShadowingClassLoader { - + /** * Default location of the orm.xml file in the class path: * "META-INF/orm.xml" diff --git a/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java b/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java index 865c9e3a5ca9..6b54d54797e7 100644 --- a/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java +++ b/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java @@ -30,12 +30,12 @@ /** * {@code ReflectionTestUtils} is a collection of reflection-based utility * methods for use in unit and integration testing scenarios. - * + * *

      There are often times when it would be beneficial to be able to set a * non-{@code public} field, invoke a non-{@code public} setter method, or * invoke a non-{@code public} configuration or lifecycle * callback method when testing code involving, for example: - * + * *

        *
      • ORM frameworks such as JPA and Hibernate which condone the usage of * {@code private} or {@code protected} field access as opposed to @@ -49,7 +49,7 @@ * and {@link javax.annotation.PreDestroy @PreDestroy} for lifecycle callback * methods.
      • *
      - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 @@ -67,12 +67,12 @@ public class ReflectionTestUtils { /** * Set the {@link Field field} with the given {@code name} on the provided * {@link Object target object} to the supplied {@code value}. - * + * *

      This method traverses the class hierarchy in search of the desired field. * In addition, an attempt will be made to make non-{@code public} fields * accessible, thus allowing one to set {@code protected}, * {@code private}, and package-private fields. - * + * * @param target the target object on which to set the field * @param name the name of the field to set * @param value the value to set @@ -87,12 +87,12 @@ public static void setField(Object target, String name, Object value) { /** * Set the {@link Field field} with the given {@code name} on the provided * {@link Object target object} to the supplied {@code value}. - * + * *

      This method traverses the class hierarchy in search of the desired * field. In addition, an attempt will be made to make non-{@code public} * fields accessible, thus allowing one to set {@code protected}, * {@code private}, and package-private fields. - * + * * @param target the target object on which to set the field * @param name the name of the field to set * @param value the value to set @@ -123,12 +123,12 @@ public static void setField(Object target, String name, Object value, Class t /** * Get the field with the given {@code name} from the provided target object. - * + * *

      This method traverses the class hierarchy in search of the desired * field. In addition, an attempt will be made to make non-{@code public} * fields accessible, thus allowing one to get {@code protected}, * {@code private}, and package-private fields. - * + * * @param target the target object on which to set the field * @param name the name of the field to get * @return the field's current value @@ -151,17 +151,17 @@ public static Object getField(Object target, String name) { /** * Invoke the setter method with the given {@code name} on the supplied * target object with the supplied {@code value}. - * + * *

      This method traverses the class hierarchy in search of the desired * method. In addition, an attempt will be made to make non-{@code public} * methods accessible, thus allowing one to invoke {@code protected}, * {@code private}, and package-private setter methods. - * + * *

      In addition, this method supports JavaBean-style property * names. For example, if you wish to set the {@code name} property on the * target object, you may pass either "name" or * "setName" as the method name. - * + * * @param target the target object on which to invoke the specified setter * method * @param name the name of the setter method to invoke or the corresponding @@ -178,17 +178,17 @@ public static void invokeSetterMethod(Object target, String name, Object value) /** * Invoke the setter method with the given {@code name} on the supplied * target object with the supplied {@code value}. - * + * *

      This method traverses the class hierarchy in search of the desired * method. In addition, an attempt will be made to make non-{@code public} * methods accessible, thus allowing one to invoke {@code protected}, * {@code private}, and package-private setter methods. - * + * *

      In addition, this method supports JavaBean-style property * names. For example, if you wish to set the {@code name} property on the * target object, you may pass either "name" or * "setName" as the method name. - * + * * @param target the target object on which to invoke the specified setter * method * @param name the name of the setter method to invoke or the corresponding @@ -226,17 +226,17 @@ public static void invokeSetterMethod(Object target, String name, Object value, /** * Invoke the getter method with the given {@code name} on the supplied * target object with the supplied {@code value}. - * + * *

      This method traverses the class hierarchy in search of the desired * method. In addition, an attempt will be made to make non-{@code public} * methods accessible, thus allowing one to invoke {@code protected}, * {@code private}, and package-private getter methods. - * + * *

      In addition, this method supports JavaBean-style property * names. For example, if you wish to get the {@code name} property on the * target object, you may pass either "name" or * "getName" as the method name. - * + * * @param target the target object on which to invoke the specified getter * method * @param name the name of the getter method to invoke or the corresponding @@ -271,12 +271,12 @@ public static Object invokeGetterMethod(Object target, String name) { /** * Invoke the method with the given {@code name} on the supplied target * object with the supplied arguments. - * + * *

      This method traverses the class hierarchy in search of the desired * method. In addition, an attempt will be made to make non-{@code public} * methods accessible, thus allowing one to invoke {@code protected}, * {@code private}, and package-private methods. - * + * * @param target the target object on which to invoke the specified method * @param name the name of the method to invoke * @param args the arguments to provide to the method diff --git a/spring-test/src/main/java/org/springframework/test/web/AbstractModelAndViewTests.java b/spring-test/src/main/java/org/springframework/test/web/AbstractModelAndViewTests.java index e3392456b4a3..c647bd41dcc5 100644 --- a/spring-test/src/main/java/org/springframework/test/web/AbstractModelAndViewTests.java +++ b/spring-test/src/main/java/org/springframework/test/web/AbstractModelAndViewTests.java @@ -28,11 +28,11 @@ /** * Convenient JUnit 3.8 base class for tests dealing with Spring Web MVC * {@link org.springframework.web.servlet.ModelAndView ModelAndView} objects. - * + * *

      All assert*() methods throw {@link AssertionFailedError}s. - * + * *

      Consider the use of {@link ModelAndViewAssert} with JUnit 4 and TestNG. - * + * * @author Alef Arendsen * @author Bram Smeets * @author Sam Brannen diff --git a/spring-test/src/main/java/org/springframework/test/web/ModelAndViewAssert.java b/spring-test/src/main/java/org/springframework/test/web/ModelAndViewAssert.java index 2d6bf7da09a3..6580149329aa 100644 --- a/spring-test/src/main/java/org/springframework/test/web/ModelAndViewAssert.java +++ b/spring-test/src/main/java/org/springframework/test/web/ModelAndViewAssert.java @@ -35,7 +35,7 @@ *

      * Intended for use with JUnit 4 and TestNG. All assert*() methods * throw {@link AssertionError}s. - * + * * @author Sam Brannen * @author Alef Arendsen * @author Bram Smeets @@ -48,7 +48,7 @@ public abstract class ModelAndViewAssert { * Checks whether the model value under the given modelName * exists and checks it type, based on the expectedType. If the * model entry exists and the type matches, the model value is returned. - * + * * @param mav ModelAndView to test against (never null) * @param modelName name of the object to add to the model (never * null) @@ -68,7 +68,7 @@ public static T assertAndReturnModelAttributeOfType(ModelAndView mav, String /** * Compare each individual entry in a list, without first sorting the lists. - * + * * @param mav ModelAndView to test against (never null) * @param modelName name of the object to add to the model (never * null) @@ -87,7 +87,7 @@ public static void assertCompareListModelAttribute(ModelAndView mav, String mode /** * Assert whether or not a model attribute is available. - * + * * @param mav ModelAndView to test against (never null) * @param modelName name of the object to add to the model (never * null) @@ -102,7 +102,7 @@ public static void assertModelAttributeAvailable(ModelAndView mav, String modelN /** * Compare a given expectedValue to the value from the model * bound under the given modelName. - * + * * @param mav ModelAndView to test against (never null) * @param modelName name of the object to add to the model (never * null) @@ -118,7 +118,7 @@ public static void assertModelAttributeValue(ModelAndView mav, String modelName, /** * Inspect the expectedModel to see if all elements in the * model appear and are equal. - * + * * @param mav ModelAndView to test against (never null) * @param expectedModel the expected model */ @@ -151,7 +151,7 @@ public static void assertModelAttributeValues(ModelAndView mav, Mapnull) * @param modelName name of the object to add to the model (never * null) @@ -187,14 +187,40 @@ public static void assertSortAndCompareListModelAttribute(ModelAndView mav, Stri /** * Check to see if the view name in the ModelAndView matches the given * expectedName. - * + * * @param mav ModelAndView to test against (never null) * @param expectedName the name of the model value */ public static void assertViewName(ModelAndView mav, String expectedName) { - assertTrue("ModelAndView is null", mav != null); - assertTrue("View name is not equal to '" + expectedName + "' but was '" + mav.getViewName() + "'", - ObjectUtils.nullSafeEquals(expectedName, mav.getViewName())); + assertCondition(mav != null, "ModelAndView is null"); + assertCondition(ObjectUtils.nullSafeEquals(expectedName, mav.getViewName()), "View name is not equal to '" + + expectedName + "' but was '" + mav.getViewName() + "'"); + } + + /** + * Fails by throwing an AssertionError with the supplied + * message. + * + * @param message the exception message to use + * @see #assertCondition(boolean,String) + */ + private static void fail(String message) { + throw new AssertionError(message); + } + + /** + * Assert the provided boolean condition, throwing + * AssertionError with the supplied message if the + * test result is false. + * + * @param condition a boolean expression + * @param message the exception message to use if the assertion fails + * @see #fail(String) + */ + private static void assertCondition(boolean condition, String message) { + if (!condition) { + fail(message); + } } private static void appendNonMatchingSetsErrorMessage(Set assertionSet, Set incorrectSet, diff --git a/spring-test/src/test/java/org/springframework/beans/Colour.java b/spring-test/src/test/java/org/springframework/beans/Colour.java index 194e00379737..6cc5d512fa2f 100644 --- a/spring-test/src/test/java/org/springframework/beans/Colour.java +++ b/spring-test/src/test/java/org/springframework/beans/Colour.java @@ -34,4 +34,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/beans/Employee.java b/spring-test/src/test/java/org/springframework/beans/Employee.java index 923c00410871..3a47dfd69031 100644 --- a/spring-test/src/test/java/org/springframework/beans/Employee.java +++ b/spring-test/src/test/java/org/springframework/beans/Employee.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ package org.springframework.beans; public class Employee extends TestBean { - + private String co; /** @@ -27,11 +27,11 @@ public class Employee extends TestBean { public Employee() { super(); } - + public String getCompany() { return co; } - + public void setCompany(String co) { this.co = co; } diff --git a/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-test/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/beans/IOther.java b/spring-test/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-test/src/test/java/org/springframework/beans/IOther.java +++ b/spring-test/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/beans/ITestBean.java b/spring-test/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-test/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-test/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java index cd1724f2645f..81a429a449f1 100644 --- a/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-test/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -143,4 +143,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-test/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/beans/TestBean.java b/spring-test/src/test/java/org/springframework/beans/TestBean.java index a56bab7e33ec..b1a2d4001f3a 100644 --- a/spring-test/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-test/src/test/java/org/springframework/beans/TestBean.java @@ -35,7 +35,7 @@ /** * Simple test bean used for testing bean factories, the AOP framework etc. - * + * * @author Rod Johnson * @author Juergen Hoeller * @since 15 April 2001 @@ -432,4 +432,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java b/spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java index c16f7cab9e31..eda98a539e1b 100644 --- a/spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java +++ b/spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java @@ -61,8 +61,7 @@ public void setContentTypeUTF8() { assertEquals(contentType, response.getHeader("Content-Type")); } - @Test - public void contentTypeHeader() { + public void testContentTypeHeader() { String contentType = "test/plain"; response.addHeader("Content-Type", contentType); assertEquals(contentType, response.getContentType()); @@ -116,13 +115,16 @@ public void contentLength() { assertEquals("66", response.getHeader("Content-Length")); } - @Test - public void contentLengthHeader() { + public void testContentLengthHeader() { + MockHttpServletResponse response = new MockHttpServletResponse(); response.addHeader("Content-Length", "66"); assertEquals(66, response.getContentLength()); assertEquals("66", response.getHeader("Content-Length")); } + public void testHttpHeaderNameCasingIsPreserved() throws Exception { + final String headerName = "Header1"; + @Test public void httpHeaderNameCasingIsPreserved() throws Exception { final String headerName = "Header1"; diff --git a/spring-test/src/test/java/org/springframework/mock/web/MockPageContextTests.java b/spring-test/src/test/java/org/springframework/mock/web/MockPageContextTests.java index 33cde3e87244..1bf822422dfe 100644 --- a/spring-test/src/test/java/org/springframework/mock/web/MockPageContextTests.java +++ b/spring-test/src/test/java/org/springframework/mock/web/MockPageContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java index c60037cf7495..eb8f362d56d9 100644 --- a/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/AbstractSpr3350SingleSpringContextTests.java @@ -24,7 +24,7 @@ * Abstract JUnit 3.8 based unit test which verifies new functionality requested * in SPR-3350. - * + * * @author Sam Brannen * @since 2.5 */ @@ -51,7 +51,7 @@ public final void setCat(final Pet cat) { * configured * {@link #createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext) * BeanDefinitionReader}. - * + * * @see org.springframework.test.AbstractSingleSpringContextTests#getConfigPath() */ protected abstract String getConfigPath(); diff --git a/spring-test/src/test/java/org/springframework/test/Spr3264DependencyInjectionSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/Spr3264DependencyInjectionSpringContextTests.java index 9636d46a97df..ab6e42dc68c2 100644 --- a/spring-test/src/test/java/org/springframework/test/Spr3264DependencyInjectionSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/Spr3264DependencyInjectionSpringContextTests.java @@ -20,7 +20,7 @@ * JUnit 3.8 based unit test which verifies new functionality requested in SPR-3264. - * + * * @author Sam Brannen * @since 2.5 * @see Spr3264SingleSpringContextTests diff --git a/spring-test/src/test/java/org/springframework/test/Spr3264SingleSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/Spr3264SingleSpringContextTests.java index 6496cdb07e0f..496bbc1b0100 100644 --- a/spring-test/src/test/java/org/springframework/test/Spr3264SingleSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/Spr3264SingleSpringContextTests.java @@ -20,7 +20,7 @@ * JUnit 3.8 based unit test which verifies new functionality requested in SPR-3264. - * + * * @author Sam Brannen * @since 2.5 * @see Spr3264DependencyInjectionSpringContextTests diff --git a/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueAnnotationAwareTransactionalTests.java b/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueAnnotationAwareTransactionalTests.java index e1d77ab5d5a5..580b873b10bf 100644 --- a/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueAnnotationAwareTransactionalTests.java +++ b/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueAnnotationAwareTransactionalTests.java @@ -23,7 +23,7 @@ * Verifies proper handling of {@link IfProfileValue @IfProfileValue} and * {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration} in * conjunction with {@link AbstractAnnotationAwareTransactionalTests}. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java b/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java index 092bc751acc7..7ec007c0160d 100644 --- a/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java +++ b/spring-test/src/test/java/org/springframework/test/annotation/ProfileValueUtilsTests.java @@ -26,7 +26,7 @@ /** * Unit tests for {@link ProfileValueUtils}. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java b/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java index 59d5da748bf8..613dc3acce83 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java @@ -41,7 +41,7 @@ * application context caching} in conjunction with the * {@link SpringJUnit4ClassRunner} and the {@link DirtiesContext * @DirtiesContext} annotation at the class level. - * + * * @author Sam Brannen * @since 3.0 */ @@ -54,7 +54,7 @@ public class ClassLevelDirtiesContextTests { /** * Asserts the statistics of the supplied context cache. - * + * * @param usageScenario the scenario in which the statistics are used * @param expectedSize the expected number of contexts in the cache * @param expectedHitCount the expected hit count diff --git a/spring-test/src/test/java/org/springframework/test/context/ContextLoaderUtilsTests.java b/spring-test/src/test/java/org/springframework/test/context/ContextLoaderUtilsTests.java index 5b386cfc9432..aace2b29a41a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ContextLoaderUtilsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/ContextLoaderUtilsTests.java @@ -37,7 +37,7 @@ /** * Unit tests for {@link ContextLoaderUtils}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java b/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java index 790d5f9ca995..bc36bf72c41a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/MergedContextConfigurationTests.java @@ -31,10 +31,7 @@ /** * Unit tests for {@link MergedContextConfiguration}. - * - *

      These tests primarily exist to ensure that {@code MergedContextConfiguration} - * can safely be used as the cache key for {@link ContextCache}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java b/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java index 2e1b2ef09eaa..8ae941c107ea 100644 --- a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java @@ -40,7 +40,7 @@ * application context caching} in conjunction with the * {@link SpringJUnit4ClassRunner} and the {@link DirtiesContext * @DirtiesContext} annotation at the method level. - * + * * @author Sam Brannen * @author Juergen Hoeller * @since 2.5 @@ -59,7 +59,7 @@ public class SpringRunnerContextCacheTests { /** * Asserts the statistics of the context cache in {@link TestContextManager}. - * + * * @param usageScenario the scenario in which the statistics are used * @param expectedSize the expected number of contexts in the cache * @param expectedHitCount the expected hit count @@ -73,7 +73,7 @@ private static final void assertContextCacheStatistics(String usageScenario, int /** * Asserts the statistics of the supplied context cache. - * + * * @param contextCache the cache to assert against * @param usageScenario the scenario in which the statistics are used * @param expectedSize the expected number of contexts in the cache diff --git a/spring-test/src/test/java/org/springframework/test/context/TestContextCacheKeyTests.java b/spring-test/src/test/java/org/springframework/test/context/TestContextCacheKeyTests.java index c8a21e32b6d1..a504642a928c 100644 --- a/spring-test/src/test/java/org/springframework/test/context/TestContextCacheKeyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/TestContextCacheKeyTests.java @@ -26,9 +26,9 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader; /** - * Unit tests for verifying proper behavior of the {@link ContextCache} in + * Unit tests for verifying proper behavior of the {@link ContextCache} in * conjunction with cache keys used in {@link TestContext}. - * + * * @author Sam Brannen * @since 3.1 * @see SpringRunnerContextCacheTests diff --git a/spring-test/src/test/java/org/springframework/test/context/TestContextManagerTests.java b/spring-test/src/test/java/org/springframework/test/context/TestContextManagerTests.java index 5b76b650bbc1..69c5ba2d433f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/TestContextManagerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/TestContextManagerTests.java @@ -38,7 +38,7 @@ * JUnit 4 based unit test for {@link TestContextManager}, which verifies proper * execution order of registered {@link TestExecutionListener * TestExecutionListeners}. - * + * * @author Sam Brannen * @since 2.5 */ @@ -64,7 +64,7 @@ private Method getTestMethod() throws NoSuchMethodException { * Asserts the execution order of 'before' and 'after' test method * calls on {@link TestExecutionListener listeners} registered for the * configured {@link TestContextManager}. - * + * * @see #beforeTestMethodCalls * @see #afterTestMethodCalls */ @@ -121,7 +121,7 @@ public void setUpTestContextManager() throws Throwable { /** * Verifies the expected {@link TestExecutionListener} * execution order within a test method. - * + * * @see #verifyListenerExecutionOrderAfterClass() */ @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/TestExecutionListenersTests.java b/spring-test/src/test/java/org/springframework/test/context/TestExecutionListenersTests.java index 19919c1ac2ba..6286658faaad 100644 --- a/spring-test/src/test/java/org/springframework/test/context/TestExecutionListenersTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/TestExecutionListenersTests.java @@ -33,7 +33,7 @@ * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3896" * target="_blank">SPR-3896 * - * + * * @author Sam Brannen * @since 2.5 */ @@ -150,4 +150,4 @@ static class QuuxTestExecutionListener extends AbstractTestExecutionListener { static class EnigmaTestExecutionListener extends AbstractTestExecutionListener { } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java index a9b9e3f16f81..a6376dfdf940 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests.java @@ -31,7 +31,7 @@ * be used at all levels within a test class hierarchy when the * loader is inherited (i.e., not explicitly declared) via * {@link ContextConfiguration @ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.0 * @see PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java index 3038750d4118..8c635bdd6a3a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/ContextConfigurationWithPropertiesExtendingPropertiesTests.java @@ -32,7 +32,7 @@ * be used at all levels within a test class hierarchy when the * loader is explicitly declared via {@link ContextConfiguration * @ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.0 * @see PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java index 9235841e498c..b1a0a4e55144 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit38/ConcreteTransactionalJUnit38SpringContextTests.java @@ -41,7 +41,7 @@ /** * Combined integration test for {@link AbstractJUnit38SpringContextTests} and * {@link AbstractTransactionalJUnit38SpringContextTests}. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java b/spring-test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java index 3049204efbea..192702ab2945 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit38/FailingBeforeAndAfterMethodsTests.java @@ -47,7 +47,7 @@ * href="http://opensource.atlassian.com/projects/spring/browse/SPR-3960" * target="_blank">SPR-3960. *

      - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit38/ProfileValueJUnit38SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit38/ProfileValueJUnit38SpringContextTests.java index 1b8e6e6a00cd..39cf8624ad58 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit38/ProfileValueJUnit38SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit38/ProfileValueJUnit38SpringContextTests.java @@ -32,7 +32,7 @@ * Verifies proper handling of {@link IfProfileValue @IfProfileValue} and * {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration} * in conjunction with {@link AbstractJUnit38SpringContextTests}. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit38/RepeatedJUnit38SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit38/RepeatedJUnit38SpringContextTests.java index 8a6f32c512a2..e33f290ac5bf 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit38/RepeatedJUnit38SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit38/RepeatedJUnit38SpringContextTests.java @@ -24,7 +24,7 @@ /** * Unit test for {@link AbstractJUnit38SpringContextTests} which focuses on * proper support of the {@link Repeat @Repeat} annotation. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/AbsolutePathSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/AbsolutePathSpringJUnit4ClassRunnerAppCtxTests.java index 6318814e72b5..419997161eb2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/AbsolutePathSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/AbsolutePathSpringJUnit4ClassRunnerAppCtxTests.java @@ -23,7 +23,7 @@ * Extension of {@link SpringJUnit4ClassRunnerAppCtxTests}, which verifies that * we can specify an explicit, absolute path location for our * application context. - * + * * @author Sam Brannen * @since 2.5 * @see SpringJUnit4ClassRunnerAppCtxTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java index 4b36e3ed3756..ebe40daa0acd 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/AbstractTransactionalSpringRunnerTests.java @@ -26,7 +26,7 @@ * Abstract base class for verifying support of Spring's {@link Transactional * @Transactional} and {@link NotTransactional @NotTransactional} * annotations. - * + * * @author Sam Brannen * @since 2.5 * @see ClassLevelTransactionalSpringRunnerTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java index a4c5c81ab408..9069dc59bd07 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelTransactionalSpringRunnerTests.java @@ -55,7 +55,7 @@ * This class specifically tests usage of @Transactional * defined at the class level. *

      - * + * * @author Sam Brannen * @since 2.5 * @see MethodLevelTransactionalSpringRunnerTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassPathResourceSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassPathResourceSpringJUnit4ClassRunnerAppCtxTests.java index 4e9ebb7496c1..eec2e03fbfbf 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassPathResourceSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassPathResourceSpringJUnit4ClassRunnerAppCtxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java index 8348e5aad7a3..01ec43a2fd17 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ConcreteTransactionalJUnit4SpringContextTests.java @@ -45,7 +45,7 @@ /** * Combined integration test for {@link AbstractJUnit4SpringContextTests} and * {@link AbstractTransactionalJUnit4SpringContextTests}. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java index 59f59ff21d10..ad7de4f27012 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/CustomDefaultContextLoaderClassSpringRunnerTests.java @@ -31,7 +31,7 @@ * Integration tests which verify that a subclass of {@link SpringJUnit4ClassRunner} * can specify a custom default ContextLoader class name that overrides * the standard default class name. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java index b9c6c811a30c..80366aed5aa2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java @@ -39,7 +39,7 @@ * Note that {@link TestExecutionListeners @TestExecutionListeners} is * explicitly configured with an empty list, thus disabling all default * listeners. - * + * * @author Sam Brannen * @since 2.5 * @see HardCodedProfileValueSourceSpringRunnerTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java index cedbc1912108..d94035194c9c 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ExpectedExceptionSpringRunnerTests.java @@ -35,7 +35,7 @@ *
    • JUnit's {@link Test#expected() @Test(expected=...)}
    • *
    • Spring's {@link ExpectedException @ExpectedException}
    • * - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java index 4bdf5837e3cf..0f4fb93641f8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTests.java @@ -55,7 +55,7 @@ * and {@link TestExecutionListener#afterTestClass(TestContext) * afterTestClass()} lifecycle callback methods. *

      - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java index 62118b48df6c..8e422e1c0cd2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java @@ -29,7 +29,7 @@ * explicit, custom defined {@link ProfileValueSource}) annotations in * conjunction with the {@link SpringJUnit4ClassRunner}. *

      - * + * * @author Sam Brannen * @since 2.5 * @see EnabledAndIgnoredSpringRunnerTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java index b553904583c7..f2664d8ec0ec 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/MethodLevelTransactionalSpringRunnerTests.java @@ -55,7 +55,7 @@ * {@link ClassLevelTransactionalSpringRunnerTests}, this class omits usage of * @NotTransactional. *

      - * + * * @author Sam Brannen * @since 2.5 * @see ClassLevelTransactionalSpringRunnerTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests.java index 3790fc2188db..306eb98310a9 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/MultipleResourcesSpringJUnit4ClassRunnerAppCtxTests.java @@ -30,7 +30,7 @@ * to verify support for the new value attribute alias for * @ContextConfiguration's locations attribute. *

      - * + * * @author Sam Brannen * @since 2.5 * @see SpringJUnit4ClassRunnerAppCtxTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java index 45f122006399..d001b2cd01a3 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/PropertiesBasedSpringJUnit4ClassRunnerAppCtxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/RelativePathSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/RelativePathSpringJUnit4ClassRunnerAppCtxTests.java index 478874a74730..12b3a8061579 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/RelativePathSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/RelativePathSpringJUnit4ClassRunnerAppCtxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java index 5b02643ea663..49d5ad5e7a4b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/RepeatedSpringRunnerTests.java @@ -40,7 +40,7 @@ *
    • Spring's {@link Repeat @Repeat}
    • *
    • Spring's {@link Timed @Timed}
    • * - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java index 215e410469d8..61059c36399e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java @@ -28,7 +28,7 @@ * Verifies support for JUnit 4.7 {@link Rule Rules} in conjunction with the * {@link SpringJUnit4ClassRunner}. The body of this test class is taken from * the JUnit 4.7 release notes. - * + * * @author JUnit 4.7 Team * @author Sam Brannen * @since 3.0 diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java index af1389b879d4..8429b36d1a8d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests.java @@ -69,11 +69,11 @@ * dependencies will be injected via {@link Autowired @Autowired}, * {@link Inject @Inject}, and {@link Resource @Resource} from beans defined in * the {@link ApplicationContext} loaded from the default classpath resource: - * + * * "/org/springframework/test/context/junit/SpringJUnit4ClassRunnerAppCtxTests-context.xml" * . *

      - * + * * @author Sam Brannen * @since 2.5 * @see AbsolutePathSpringJUnit4ClassRunnerAppCtxTests @@ -88,7 +88,7 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa /** * Default resource path for the application context configuration for * {@link SpringJUnit4ClassRunnerAppCtxTests}: - * + * * "/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml" */ public static final String DEFAULT_CONTEXT_RESOURCE_PATH = "/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerAppCtxTests-context.xml"; @@ -235,4 +235,4 @@ public final void verifyResourceAnnotationInjectedMethods() { assertEquals("The bar method should have been wired via @Resource.", "Bar", this.bar); } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java index aedd5ad46668..90aee2e97595 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4ClassRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java index f9096ab5f067..d8446ea57910 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit4SuiteTests.java @@ -43,15 +43,15 @@ /** * JUnit test suite for tests involving {@link SpringJUnit4ClassRunner} and the * Spring TestContext Framework. - * + * *

      This test suite serves a dual purpose of verifying that tests run with * {@link SpringJUnit4ClassRunner} can be used in conjunction with JUnit's * {@link Suite} runner. - * + * *

      Note that tests included in this suite will be executed at least twice if * run from an automated build process, test runner, etc. that is configured to * run tests based on a "*Tests.class" pattern match. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java index 4dd270ca7c8f..0373d147aa11 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java index 4d7eb155da40..a3679ba75e1d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java @@ -33,7 +33,7 @@ *

    • JUnit's {@link Test#timeout() @Test(timeout=...)}
    • *
    • Spring's {@link Timed @Timed}
    • * - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java index 1dd4494dd695..ad6090ab612b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TimedTransactionalSpringRunnerTests.java @@ -31,7 +31,7 @@ * {@link Transactional @Transactional} and {@link NotTransactional * @NotTransactional} annotations in conjunction with {@link Timed * @Timed} and JUnit 4's {@link Test#timeout() timeout} attribute. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java b/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java index 6a8edd857ca0..2b3875208274 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/TrackingRunListener.java @@ -25,7 +25,7 @@ /** * Simple {@link RunListener} which tracks how many times certain JUnit callback * methods were called: only intended for the integration test suite. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java index e83eaddd33d0..e8a92ab0ef0c 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/AnnotationConfigSpringJUnit4ClassRunnerAppCtxTests.java @@ -22,14 +22,14 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Furthermore, by extending {@link SpringJUnit4ClassRunnerAppCtxTests}, * this class also verifies support for several basic features of the * Spring TestContext Framework. See JavaDoc in * SpringJUnit4ClassRunnerAppCtxTests for details. - * + * *

      Configuration will be loaded from {@link PojoAndStringConfig}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java index 61a033f3cb94..70e1a8dd5c0f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingDefaultConfigClassesInheritedTests.java @@ -28,10 +28,10 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration} * and {@link BeanOverridingDefaultConfigClassesInheritedTests.ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java index 537e46ead0e0..223c5a6f5923 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/BeanOverridingExplicitConfigClassesInheritedTests.java @@ -25,10 +25,10 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration} * and {@link BeanOverridingDefaultConfigClassesInheritedTests.ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java index e6a1d67b311b..87738909689f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java @@ -32,9 +32,9 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 * @see DefaultLoaderDefaultConfigClassesBaseTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java index 281c8f3f266b..aed661d8385f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesInheritedTests.java @@ -29,10 +29,10 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration} * and {@link DefaultConfigClassesInheritedTests.ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java index c61562127f50..db1c4bca19da 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingDefaultConfigClassesInheritedTests.java @@ -30,7 +30,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework in conjunction with the * {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java index cdf4207a0161..cfc0a5fd5330 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderBeanOverridingExplicitConfigClassesInheritedTests.java @@ -27,7 +27,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework in conjunction with the * {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java index 68a1d37603e8..f2b001e10d12 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesBaseTests.java @@ -33,7 +33,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework in conjunction with the * {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 * @see DefaultConfigClassesBaseTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java index a5706a1517d6..6ba03e1bc4a9 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderDefaultConfigClassesInheritedTests.java @@ -31,7 +31,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework in conjunction with the * {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java index 46b72595814b..b2e4fedb24f3 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesBaseTests.java @@ -31,7 +31,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework in conjunction with the * {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java index 69a2c846b53d..f769cb1a1339 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultLoaderExplicitConfigClassesInheritedTests.java @@ -31,7 +31,7 @@ * Integration tests that verify support for configuration classes in * the Spring TestContext Framework in conjunction with the * {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java index cd351bdfc01b..da02bb82281f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesBaseTests.java @@ -30,9 +30,9 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java index 642d2d67e75d..6a384d8c6ac8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/ExplicitConfigClassesInheritedTests.java @@ -30,10 +30,10 @@ /** * Integration tests that verify support for configuration classes in * the Spring TestContext Framework. - * + * *

      Configuration will be loaded from {@link DefaultConfigClassesInheritedTests.ContextConfiguration} * and {@link DefaultConfigClassesBaseTests.ContextConfiguration}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java index e04c1c07378f..6a169ebf2b22 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/annotation/PojoAndStringConfig.java @@ -23,12 +23,12 @@ /** * ApplicationContext configuration class for various integration tests. - * + * *

      The beans defined in this configuration class map directly to the * beans defined in SpringJUnit4ClassRunnerAppCtxTests-context.xml. * Consequently, the application contexts loaded from these two sources * should be identical with regard to bean definitions. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java index 3c32c47b82d3..69aecb723b70 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java @@ -37,7 +37,7 @@ /** * Transactional integration tests regarding manual session flushing with * Hibernate. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/DriversLicense.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/DriversLicense.java index cdb2b0f884d7..464ff84af014 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/DriversLicense.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/DriversLicense.java @@ -18,7 +18,7 @@ /** * DriversLicense POJO. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/Person.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/Person.java index e264f66e8e57..882578a189b2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/Person.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/domain/Person.java @@ -18,7 +18,7 @@ /** * Person POJO. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/PersonRepository.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/PersonRepository.java index a0b7730d31cb..56bd29873937 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/PersonRepository.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/PersonRepository.java @@ -20,7 +20,7 @@ /** * Person Repository API. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/hibernate/HibernatePersonRepository.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/hibernate/HibernatePersonRepository.java index 702dfcae7e49..994b886b30eb 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/hibernate/HibernatePersonRepository.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/repository/hibernate/HibernatePersonRepository.java @@ -24,7 +24,7 @@ /** * Hibernate implementation of the {@link PersonRepository} API. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/PersonService.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/PersonService.java index 73aa29a5c317..e8a7c2f5a563 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/PersonService.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/PersonService.java @@ -20,7 +20,7 @@ /** * Person Service API. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/impl/StandardPersonService.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/impl/StandardPersonService.java index dbd7fe6c22b9..039faa6894f2 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/impl/StandardPersonService.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/service/impl/StandardPersonService.java @@ -25,7 +25,7 @@ /** * Standard implementation of the {@link PersonService} API. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/Jsr250LifecycleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/Jsr250LifecycleTests.java index 45af06fb2164..440c79a1834e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/Jsr250LifecycleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/Jsr250LifecycleTests.java @@ -38,12 +38,12 @@ /** * Integration tests that investigate the applicability of JSR-250 lifecycle * annotations in test classes. - * + * *

      This class does not really contain actual tests per se. Rather it * can be used to empirically verify the expected log output (see below). In - * order to see the log output, one would naturally need to ensure that the + * order to see the log output, one would naturally need to ensure that the * logger category for this class is enabled at {@code INFO} level. - * + * *

      Expected Log Output

      *
        * INFO : org.springframework.test.context.junit4.spr4868.LifecycleBean - initializing
      @@ -57,7 +57,7 @@
        * INFO : org.springframework.test.context.junit4.spr4868.ExampleTest - tearDown()
        * INFO : org.springframework.test.context.junit4.spr4868.LifecycleBean - destroying
        * 
      - * + * * @author Sam Brannen * @since 3.2 */ @@ -115,4 +115,4 @@ public void test2() { assertNotNull(lifecycleBean); } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/LifecycleBean.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/LifecycleBean.java index 1b8dda709d82..dbccd5bdbae6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/LifecycleBean.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr4868/LifecycleBean.java @@ -41,4 +41,4 @@ public void destroy() { logger.info("destroying"); } -} \ No newline at end of file +} diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java index f0012c412ce1..47d7dab773b9 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java @@ -30,7 +30,7 @@ * Integration tests to verify claims made in SPR-6128. - * + * * @author Sam Brannen * @author Chris Beams * @since 3.0 diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java index cb00d7af8160..d8b7fcacf3f4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AbstractTransactionalAnnotatedConfigClassTests.java @@ -42,7 +42,7 @@ * This set of tests (i.e., all concrete subclasses) investigates the claims made in * SPR-9051 * with regard to transactional tests. - * + * * @author Sam Brannen * @since 3.2 * @see org.springframework.test.context.testng.AnnotationConfigTransactionalTestNGSpringContextTests diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AtBeanLiteModeScopeTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AtBeanLiteModeScopeTests.java index 9a1fe08c37d2..035bc9f23d60 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AtBeanLiteModeScopeTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/AtBeanLiteModeScopeTests.java @@ -35,7 +35,7 @@ /** * Integration tests that verify proper scoping of beans created in * {@code @Bean} Lite Mode. - * + * * @author Sam Brannen * @since 3.2 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/LifecycleBean.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/LifecycleBean.java index 0d08f3d93ac4..07c0550c2d9d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/LifecycleBean.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/LifecycleBean.java @@ -20,7 +20,7 @@ /** * Simple POJO that contains lifecycle callbacks. - * + * * @author Sam Brannen * @since 3.2 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java index 3b5a579d8a23..373166d9b41e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassWithAtConfigurationTests.java @@ -32,7 +32,7 @@ /** * Concrete implementation of {@link AbstractTransactionalAnnotatedConfigClassTests} * that uses a true {@link Configuration @Configuration class}. - * + * * @author Sam Brannen * @since 3.2 * @see TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests @@ -43,7 +43,7 @@ public class TransactionalAnnotatedConfigClassWithAtConfigurationTests extends /** * This is intentionally annotated with {@code @Configuration}. - * + * *

      Consequently, this class contains standard singleton bean methods * instead of annotated factory bean methods. */ diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java index 63c6ef5849e6..3f6a054ecb06 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr9051/TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests.java @@ -38,7 +38,7 @@ * that does not use a true {@link Configuration @Configuration class} but * rather a lite mode configuration class (see the Javadoc for {@link Bean @Bean} * for details). - * + * * @author Sam Brannen * @since 3.2 * @see Bean @@ -50,7 +50,7 @@ public class TransactionalAnnotatedConfigClassesWithoutAtConfigurationTests exte /** * This is intentionally not annotated with {@code @Configuration}. - * + * *

      Consequently, this class contains annotated factory bean methods * instead of standard singleton bean methods. */ @@ -74,10 +74,10 @@ public PlatformTransactionManager transactionManager() { /** * Since this method does not reside in a true {@code @Configuration class}, * it acts as a factory method when invoked directly (e.g., from - * {@link #transactionManager()}) and as a singleton bean when retrieved + * {@link #transactionManager()}) and as a singleton bean when retrieved * through the application context (e.g., when injected into the test * instance). The result is that this method will be called twice: - * + * *

        *
      1. once indirectly by the {@link TransactionalTestExecutionListener} * when it retrieves the {@link PlatformTransactionManager} from the @@ -110,8 +110,8 @@ public void compareDataSources() throws Exception { } /** - * Overrides {@code afterTransaction()} in order to assert a different result. - * + * Overrides {@code afterTransaction()} in order to assert a different result. + * *

        See in-line comments for details. * * @see AbstractTransactionalAnnotatedConfigClassTests#afterTransaction() diff --git a/spring-test/src/test/java/org/springframework/test/context/support/AnnotatedFooConfigInnerClassTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/AnnotatedFooConfigInnerClassTestCase.java index d44ce27d960e..85da86b3f55d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/AnnotatedFooConfigInnerClassTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/AnnotatedFooConfigInnerClassTestCase.java @@ -21,7 +21,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/support/AnnotationConfigContextLoaderTests.java b/spring-test/src/test/java/org/springframework/test/context/support/AnnotationConfigContextLoaderTests.java index 8cc52762862c..d56c24f5e5da 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/AnnotationConfigContextLoaderTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/AnnotationConfigContextLoaderTests.java @@ -23,7 +23,7 @@ /** * Unit tests for {@link AnnotationConfigContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/support/ContextConfigurationInnerClassTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/ContextConfigurationInnerClassTestCase.java index 5d2432000333..adaff61eb02e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/ContextConfigurationInnerClassTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/ContextConfigurationInnerClassTestCase.java @@ -20,7 +20,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/support/CustomizedGenericXmlContextLoaderTests.java b/spring-test/src/test/java/org/springframework/test/context/support/CustomizedGenericXmlContextLoaderTests.java index a07d1d30aa25..941cf227ebc8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/CustomizedGenericXmlContextLoaderTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/CustomizedGenericXmlContextLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-test/src/test/java/org/springframework/test/context/support/DelegatingSmartContextLoaderTests.java b/spring-test/src/test/java/org/springframework/test/context/support/DelegatingSmartContextLoaderTests.java index 21a32e371435..20355683bc7f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/DelegatingSmartContextLoaderTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/DelegatingSmartContextLoaderTests.java @@ -33,7 +33,7 @@ /** * Unit tests for {@link DelegatingSmartContextLoader}. - * + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/support/FinalConfigInnerClassTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/FinalConfigInnerClassTestCase.java index 89a1653b09fa..7cde8c0190b4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/FinalConfigInnerClassTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/FinalConfigInnerClassTestCase.java @@ -20,7 +20,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/support/MultipleStaticConfigurationClassesTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/MultipleStaticConfigurationClassesTestCase.java index a07dc16cfa5e..e9e69e1a19bd 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/MultipleStaticConfigurationClassesTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/MultipleStaticConfigurationClassesTestCase.java @@ -20,7 +20,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/support/NonStaticConfigInnerClassesTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/NonStaticConfigInnerClassesTestCase.java index a7118532417d..a8ae4fcc8bcd 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/NonStaticConfigInnerClassesTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/NonStaticConfigInnerClassesTestCase.java @@ -20,7 +20,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/support/PlainVanillaFooConfigInnerClassTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/PlainVanillaFooConfigInnerClassTestCase.java index 98858425fa16..a56931355595 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/PlainVanillaFooConfigInnerClassTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/PlainVanillaFooConfigInnerClassTestCase.java @@ -18,7 +18,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/support/PrivateConfigInnerClassTestCase.java b/spring-test/src/test/java/org/springframework/test/context/support/PrivateConfigInnerClassTestCase.java index d6e387be0506..5432f578a1bf 100644 --- a/spring-test/src/test/java/org/springframework/test/context/support/PrivateConfigInnerClassTestCase.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/PrivateConfigInnerClassTestCase.java @@ -20,7 +20,7 @@ /** * Not an actual test case. - * + * * @author Sam Brannen * @since 3.1 * @see AnnotationConfigContextLoaderTests diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java index dfabc22d7d7d..bb26e44a622a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java @@ -45,10 +45,10 @@ * Integration tests that verify support for * {@link import org.springframework.context.annotation.Configuration @Configuration} * classes with TestNG-based tests. - * + * *

        Configuration will be loaded from - * {@link AnnotationConfigTransactionalTestNGSpringContextTests.ContextConfiguration}. - * + * {@link AnnotationConfigTransactionalTestNGSpringContextTestsConfig}. + * * @author Sam Brannen * @since 3.1 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java index 5f6840f495bf..27a08c054c20 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java @@ -43,7 +43,7 @@ /** * Combined integration test for {@link AbstractTestNGSpringContextTests} and * {@link AbstractTransactionalTestNGSpringContextTests}. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java index ab61dc2bc5d5..82fb19287b7f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java @@ -43,7 +43,7 @@ * individual tests. DirtiesContextTransactionalTestNGSpringContextTests * therefore verifies the expected behavior and correct semantics. *

        - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java index ab76d69d4728..66318987d005 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java @@ -57,7 +57,7 @@ * and {@link TestExecutionListener#afterTestClass(TestContext) * afterTestClass()} lifecycle callback methods. *

        - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java index f7bc81107e43..cdc23e35bf36 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java @@ -26,7 +26,7 @@ * {@link AbstractTransactionalTestNGSpringContextTests}; used to verify claim * raised in SPR-6124. - * + * * @author Sam Brannen * @since 3.0 */ diff --git a/spring-test/src/test/java/org/springframework/test/jdbc/JdbcTestUtilsTests.java b/spring-test/src/test/java/org/springframework/test/jdbc/JdbcTestUtilsTests.java index 9651d2bcdef8..d5fd1b68e4b7 100644 --- a/spring-test/src/test/java/org/springframework/test/jdbc/JdbcTestUtilsTests.java +++ b/spring-test/src/test/java/org/springframework/test/jdbc/JdbcTestUtilsTests.java @@ -28,7 +28,7 @@ /** * Unit tests for {@link JdbcTestUtils}. - * + * * @author Thomas Risberg * @author Sam Brannen * @since 2.5.4 diff --git a/spring-test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java b/spring-test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java index 0634161c3b7f..5b64657360dc 100644 --- a/spring-test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java +++ b/spring-test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java @@ -29,7 +29,7 @@ /** * Unit tests for {@link ReflectionTestUtils}. - * + * * @author Sam Brannen * @author Juergen Hoeller */ diff --git a/spring-test/src/test/java/org/springframework/test/util/subpackage/Person.java b/spring-test/src/test/java/org/springframework/test/util/subpackage/Person.java index 4eb84791f529..eac5e7b76f53 100644 --- a/spring-test/src/test/java/org/springframework/test/util/subpackage/Person.java +++ b/spring-test/src/test/java/org/springframework/test/util/subpackage/Person.java @@ -21,7 +21,7 @@ /** * Concrete subclass of {@link PersistentEntity} representing a person * entity; intended for use in unit tests. - * + * * @author Sam Brannen * @since 2.5 */ diff --git a/spring-tx/src/main/java/org/springframework/dao/DataRetrievalFailureException.java b/spring-tx/src/main/java/org/springframework/dao/DataRetrievalFailureException.java index 68467df26a2b..c9d7a93f60fc 100644 --- a/spring-tx/src/main/java/org/springframework/dao/DataRetrievalFailureException.java +++ b/spring-tx/src/main/java/org/springframework/dao/DataRetrievalFailureException.java @@ -42,5 +42,5 @@ public DataRetrievalFailureException(String msg) { public DataRetrievalFailureException(String msg, Throwable cause) { super(msg, cause); } - + } diff --git a/spring-tx/src/main/java/org/springframework/dao/DuplicateKeyException.java b/spring-tx/src/main/java/org/springframework/dao/DuplicateKeyException.java index 5267f2ec3c88..a5ec2ecf175f 100644 --- a/spring-tx/src/main/java/org/springframework/dao/DuplicateKeyException.java +++ b/spring-tx/src/main/java/org/springframework/dao/DuplicateKeyException.java @@ -43,4 +43,4 @@ public DuplicateKeyException(String msg, Throwable cause) { super(msg, cause); } -} \ No newline at end of file +} diff --git a/spring-tx/src/main/java/org/springframework/dao/IncorrectUpdateSemanticsDataAccessException.java b/spring-tx/src/main/java/org/springframework/dao/IncorrectUpdateSemanticsDataAccessException.java index d4a2d1957be6..57ddae537951 100644 --- a/spring-tx/src/main/java/org/springframework/dao/IncorrectUpdateSemanticsDataAccessException.java +++ b/spring-tx/src/main/java/org/springframework/dao/IncorrectUpdateSemanticsDataAccessException.java @@ -42,7 +42,7 @@ public IncorrectUpdateSemanticsDataAccessException(String msg) { public IncorrectUpdateSemanticsDataAccessException(String msg, Throwable cause) { super(msg, cause); } - + /** * Return whether data was updated. * If this method returns false, there's nothing to roll back. diff --git a/spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessResourceUsageException.java b/spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessResourceUsageException.java index 0537b27dbed5..735acdc34827 100644 --- a/spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessResourceUsageException.java +++ b/spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessResourceUsageException.java @@ -24,7 +24,7 @@ * @author Rod Johnson */ public class InvalidDataAccessResourceUsageException extends NonTransientDataAccessException { - + /** * Constructor for InvalidDataAccessResourceUsageException. * @param msg the detail message @@ -32,7 +32,7 @@ public class InvalidDataAccessResourceUsageException extends NonTransientDataAcc public InvalidDataAccessResourceUsageException(String msg) { super(msg); } - + /** * Constructor for InvalidDataAccessResourceUsageException. * @param msg the detail message diff --git a/spring-tx/src/main/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisor.java b/spring-tx/src/main/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisor.java index 90c35fc6cc5d..ecd3347a0b70 100644 --- a/spring-tx/src/main/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisor.java +++ b/spring-tx/src/main/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/dao/package-info.java b/spring-tx/src/main/java/org/springframework/dao/package-info.java index 725797c63abd..dd36227a3578 100644 --- a/spring-tx/src/main/java/org/springframework/dao/package-info.java +++ b/spring-tx/src/main/java/org/springframework/dao/package-info.java @@ -7,10 +7,10 @@ * subclasses), calling code can detect and handle common problems such * as deadlocks without being tied to a particular data access strategy, * such as JDBC. - * + * *

        All these exceptions are unchecked, meaning that calling code can * leave them uncaught and treat all data access exceptions as fatal. - * + * *

        The classes in this package are discussed in Chapter 9 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-tx/src/main/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslator.java b/spring-tx/src/main/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslator.java index 5c0e6e783189..b5946c404ed9 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslator.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslator.java @@ -32,7 +32,7 @@ * @since 2.0 */ public class ChainedPersistenceExceptionTranslator implements PersistenceExceptionTranslator { - + /** List of PersistenceExceptionTranslators */ private final List delegates = new ArrayList(4); diff --git a/spring-tx/src/main/java/org/springframework/dao/support/DaoSupport.java b/spring-tx/src/main/java/org/springframework/dao/support/DaoSupport.java index ab1f17d8ff89..9b1774eb4a20 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/DaoSupport.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/DaoSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java index 6e7e07608aa1..f4a2c467b700 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -172,7 +172,7 @@ else if (Number.class.isAssignableFrom(requiredType) && Number.class.isInstance( * @throws TypeMismatchDataAccessException if the unique object * in the collection is not convertable to an int */ - public static int intResult(Collection results) + public static int intResult(Collection results) throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException { return objectResult(results, Number.class).intValue(); @@ -191,13 +191,13 @@ public static int intResult(Collection results) * @throws TypeMismatchDataAccessException if the unique object * in the collection is not convertable to a long */ - public static long longResult(Collection results) + public static long longResult(Collection results) throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException { return objectResult(results, Number.class).longValue(); } - - + + /** * Return a translated exception if this is appropriate, * otherwise return the input exception. diff --git a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java index ea41668838ba..8e6a37e1c927 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslator.java b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslator.java index e17732f11b9c..21300ae57e0e 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslator.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslator.java @@ -31,7 +31,7 @@ * @since 2.0 */ public interface PersistenceExceptionTranslator { - + /** * Translate the given runtime exception thrown by a persistence framework to a * corresponding exception from Spring's generic DataAccessException hierarchy, diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/CannotGetCciConnectionException.java b/spring-tx/src/main/java/org/springframework/jca/cci/CannotGetCciConnectionException.java index e2f5761a6344..f35273b6277b 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/CannotGetCciConnectionException.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/CannotGetCciConnectionException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/InvalidResultSetAccessException.java b/spring-tx/src/main/java/org/springframework/jca/cci/InvalidResultSetAccessException.java index 6492bc72174c..b7959a6079f0 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/InvalidResultSetAccessException.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/InvalidResultSetAccessException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,7 @@ * @see javax.resource.cci.ResultSet */ public class InvalidResultSetAccessException extends InvalidDataAccessResourceUsageException { - + /** * Constructor for InvalidResultSetAccessException. * @param msg message diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/connection/CciLocalTransactionManager.java b/spring-tx/src/main/java/org/springframework/jca/cci/connection/CciLocalTransactionManager.java index f8e46ea6a52f..3281c74cc5b7 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/connection/CciLocalTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/connection/CciLocalTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionFactoryUtils.java b/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionFactoryUtils.java index 3fd28fc9cf0d..63775ea37ce0 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionFactoryUtils.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionFactoryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionHolder.java b/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionHolder.java index 864107863979..693345dc629e 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionHolder.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionHolder.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/connection/SingleConnectionFactory.java b/spring-tx/src/main/java/org/springframework/jca/cci/connection/SingleConnectionFactory.java index 69829646f48c..c3eb2d5c4b4f 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/connection/SingleConnectionFactory.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/connection/SingleConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/core/CciTemplate.java b/spring-tx/src/main/java/org/springframework/jca/cci/core/CciTemplate.java index c072dcb9ad07..880b50a6f249 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/core/CciTemplate.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/core/CciTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/core/ConnectionCallback.java b/spring-tx/src/main/java/org/springframework/jca/cci/core/ConnectionCallback.java index f7dd0edae58f..54a8a1f4997b 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/core/ConnectionCallback.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/core/ConnectionCallback.java @@ -28,7 +28,7 @@ * Generic callback interface for code that operates on a CCI Connection. * Allows to execute any number of operations on a single Connection, * using any type and number of Interaction. - * + * *

        This is particularly useful for delegating to existing data access code * that expects a Connection to work on and throws ResourceException. For newly * written code, it is strongly recommended to use CciTemplate's more specific @@ -47,7 +47,7 @@ public interface ConnectionCallback { * Gets called by CciTemplate.execute with an active CCI Connection. * Does not need to care about activating or closing the Connection, or handling * transactions. - * + * *

        If called without a thread-bound CCI transaction (initiated by * CciLocalTransactionManager), the code will simply get executed on the CCI * Connection with its transactional semantics. If CciTemplate is configured diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/core/InteractionCallback.java b/spring-tx/src/main/java/org/springframework/jca/cci/core/InteractionCallback.java index 9de2bfce86e1..5ed18fb36113 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/core/InteractionCallback.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/core/InteractionCallback.java @@ -29,7 +29,7 @@ * Allows to execute any number of operations on a single Interaction, for * example a single execute call or repeated execute calls with varying * parameters. - * + * *

        This is particularly useful for delegating to existing data access code * that expects an Interaction to work on and throws ResourceException. For newly * written code, it is strongly recommended to use CciTemplate's more specific @@ -48,7 +48,7 @@ public interface InteractionCallback { * Gets called by CciTemplate.execute with an active CCI Interaction. * Does not need to care about activating or closing the Interaction, or * handling transactions. - * + * *

        If called without a thread-bound CCI transaction (initiated by * CciLocalTransactionManager), the code will simply get executed on the CCI * Interaction with its transactional semantics. If CciTemplate is configured diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordCreator.java b/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordCreator.java index 4458dfb9bfa3..956403b511bf 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordCreator.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordCreator.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordExtractor.java b/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordExtractor.java index 6cdb87532624..539a7b9eaf93 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordExtractor.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/core/RecordExtractor.java @@ -23,7 +23,7 @@ import org.springframework.dao.DataAccessException; -/** +/** * Callback interface for extracting a result object from a CCI Record instance. * *

        Used for output object creation in CciTemplate. Alternatively, output @@ -44,8 +44,8 @@ * @see javax.resource.cci.ResultSet */ public interface RecordExtractor { - - /** + + /** * Process the data in the given Record, creating a corresponding result object. * @param record the Record to extract data from * (possibly a CCI ResultSet) diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/core/support/CommAreaRecord.java b/spring-tx/src/main/java/org/springframework/jca/cci/core/support/CommAreaRecord.java index 52d9d7ef6d98..223f5daf5f6a 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/core/support/CommAreaRecord.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/core/support/CommAreaRecord.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingCommAreaOperation.java b/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingCommAreaOperation.java index bbbd94bd6f31..638ae9d23aaf 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingCommAreaOperation.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingCommAreaOperation.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingRecordOperation.java b/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingRecordOperation.java index 8c9915b796f5..974bf1ced5fe 100644 --- a/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingRecordOperation.java +++ b/spring-tx/src/main/java/org/springframework/jca/cci/object/MappingRecordOperation.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -139,7 +139,7 @@ public Record createRecord(RecordFactory recordFactory) throws ResourceException * Implementation of RecordExtractor that calls the enclosing * class's extractOutputData method. */ - protected class RecordExtractorImpl implements RecordExtractor { + protected class RecordExtractorImpl implements RecordExtractor { public Object extractData(Record record) throws ResourceException, SQLException, DataAccessException { return extractOutputData(record); diff --git a/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java b/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java index 418bcc4cec0f..007c42759d8f 100644 --- a/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java +++ b/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/endpoint/AbstractMessageEndpointFactory.java b/spring-tx/src/main/java/org/springframework/jca/endpoint/AbstractMessageEndpointFactory.java index 3fce257000b2..79118300c8f9 100644 --- a/spring-tx/src/main/java/org/springframework/jca/endpoint/AbstractMessageEndpointFactory.java +++ b/spring-tx/src/main/java/org/springframework/jca/endpoint/AbstractMessageEndpointFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointFactory.java b/spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointFactory.java index eec90acca598..1cffbf0247f9 100644 --- a/spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointFactory.java +++ b/spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/jca/support/ResourceAdapterFactoryBean.java b/spring-tx/src/main/java/org/springframework/jca/support/ResourceAdapterFactoryBean.java index ed1c3372f46c..3b16b14c3ea9 100644 --- a/spring-tx/src/main/java/org/springframework/jca/support/ResourceAdapterFactoryBean.java +++ b/spring-tx/src/main/java/org/springframework/jca/support/ResourceAdapterFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public class ResourceAdapterFactoryBean implements FactoryBean, * through the "resourceAdapter" property. * @see #setResourceAdapter */ - public void setResourceAdapterClass(Class resourceAdapterClass) { + public void setResourceAdapterClass(Class resourceAdapterClass) { Assert.isAssignable(ResourceAdapter.class, resourceAdapterClass); this.resourceAdapter = (ResourceAdapter) BeanUtils.instantiateClass(resourceAdapterClass); } diff --git a/spring-tx/src/main/java/org/springframework/jca/work/glassfish/GlassFishWorkManagerTaskExecutor.java b/spring-tx/src/main/java/org/springframework/jca/work/glassfish/GlassFishWorkManagerTaskExecutor.java index 431884514db0..77931ebf7754 100644 --- a/spring-tx/src/main/java/org/springframework/jca/work/glassfish/GlassFishWorkManagerTaskExecutor.java +++ b/spring-tx/src/main/java/org/springframework/jca/work/glassfish/GlassFishWorkManagerTaskExecutor.java @@ -43,7 +43,7 @@ public class GlassFishWorkManagerTaskExecutor extends WorkManagerTaskExecutor { public GlassFishWorkManagerTaskExecutor() { try { - Class wmf = getClass().getClassLoader().loadClass(WORK_MANAGER_FACTORY_CLASS); + Class wmf = getClass().getClassLoader().loadClass(WORK_MANAGER_FACTORY_CLASS); this.getWorkManagerMethod = wmf.getMethod("getWorkManager", new Class[] {String.class}); } catch (Exception ex) { diff --git a/spring-tx/src/main/java/org/springframework/jca/work/jboss/JBossWorkManagerUtils.java b/spring-tx/src/main/java/org/springframework/jca/work/jboss/JBossWorkManagerUtils.java index 7c2757b600ce..b6a70c056fd5 100644 --- a/spring-tx/src/main/java/org/springframework/jca/work/jboss/JBossWorkManagerUtils.java +++ b/spring-tx/src/main/java/org/springframework/jca/work/jboss/JBossWorkManagerUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/TransactionDefinition.java b/spring-tx/src/main/java/org/springframework/transaction/TransactionDefinition.java index 0382efa2f243..5645c336a6ba 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/TransactionDefinition.java +++ b/spring-tx/src/main/java/org/springframework/transaction/TransactionDefinition.java @@ -186,7 +186,7 @@ public interface TransactionDefinition { /** * Use the default timeout of the underlying transaction system, - * or none if timeouts are not supported. + * or none if timeouts are not supported. */ int TIMEOUT_DEFAULT = -1; @@ -237,7 +237,7 @@ public interface TransactionDefinition { * it will not necessarily cause failure of write access attempts. * A transaction manager which cannot interpret the read-only hint will * not throw an exception when asked for a read-only transaction. - * @return true if the transaction is to be optimized as read-only + * @return true if the transaction is to be optimized as read-only * @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit(boolean) * @see org.springframework.transaction.support.TransactionSynchronizationManager#isCurrentTransactionReadOnly() */ diff --git a/spring-tx/src/main/java/org/springframework/transaction/TransactionSystemException.java b/spring-tx/src/main/java/org/springframework/transaction/TransactionSystemException.java index 62b7780abab3..0b8ff84761ef 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/TransactionSystemException.java +++ b/spring-tx/src/main/java/org/springframework/transaction/TransactionSystemException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public Throwable getOriginalException() { } @Override - public boolean contains(Class exType) { + public boolean contains(Class exType) { return super.contains(exType) || (exType != null && exType.isInstance(this.applicationException)); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/TransactionUsageException.java b/spring-tx/src/main/java/org/springframework/transaction/TransactionUsageException.java index 28c4f859ba59..ef28675b743b 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/TransactionUsageException.java +++ b/spring-tx/src/main/java/org/springframework/transaction/TransactionUsageException.java @@ -17,7 +17,7 @@ package org.springframework.transaction; /** - * Superclass for exceptions caused by inappropriate usage of + * Superclass for exceptions caused by inappropriate usage of * a Spring transaction API. * * @author Rod Johnson diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/Isolation.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/Isolation.java index 03e569991f72..597afcc58c13 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/Isolation.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/Isolation.java @@ -28,7 +28,7 @@ * @since 1.2 */ public enum Isolation { - + /** * Use the default isolation level of the underlying datastore. * All other levels correspond to the JDBC isolation levels. @@ -82,7 +82,7 @@ public enum Isolation { Isolation(int value) { this.value = value; } - + public int value() { return this.value; } - + } diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java index 5e0a79645048..a1d4bcebedd3 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ * @since 1.2 */ public enum Propagation { - + /** * Support a current transaction, create a new one if none exists. * Analogous to EJB transaction attribute of the same name. @@ -99,7 +99,7 @@ public enum Propagation { Propagation(int value) { this.value = value; } - + public int value() { return this.value; } - + } diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java index 4e9db4f3f7a6..69c1ada5809d 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/SpringTransactionAnnotationParser.java @@ -52,8 +52,8 @@ public TransactionAttribute parseTransactionAnnotation(Transactional ann) { rbta.setReadOnly(ann.readOnly()); rbta.setQualifier(ann.value()); ArrayList rollBackRules = new ArrayList(); - Class[] rbf = ann.rollbackFor(); - for (Class rbRule : rbf) { + Class[] rbf = ann.rollbackFor(); + for (Class rbRule : rbf) { RollbackRuleAttribute rule = new RollbackRuleAttribute(rbRule); rollBackRules.add(rule); } @@ -62,8 +62,8 @@ public TransactionAttribute parseTransactionAnnotation(Transactional ann) { RollbackRuleAttribute rule = new RollbackRuleAttribute(rbRule); rollBackRules.add(rule); } - Class[] nrbf = ann.noRollbackFor(); - for (Class rbRule : nrbf) { + Class[] nrbf = ann.noRollbackFor(); + for (Class rbRule : nrbf) { NoRollbackRuleAttribute rule = new NoRollbackRuleAttribute(rbRule); rollBackRules.add(rule); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/config/AnnotationDrivenBeanDefinitionParser.java b/spring-tx/src/main/java/org/springframework/transaction/config/AnnotationDrivenBeanDefinitionParser.java index 8ba614d79839..78141b764ab1 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/config/AnnotationDrivenBeanDefinitionParser.java +++ b/spring-tx/src/main/java/org/springframework/transaction/config/AnnotationDrivenBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/config/JtaTransactionManagerBeanDefinitionParser.java b/spring-tx/src/main/java/org/springframework/transaction/config/JtaTransactionManagerBeanDefinitionParser.java index f90ca8b6b77a..0dd4efa55fbc 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/config/JtaTransactionManagerBeanDefinitionParser.java +++ b/spring-tx/src/main/java/org/springframework/transaction/config/JtaTransactionManagerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/config/TxAdviceBeanDefinitionParser.java b/spring-tx/src/main/java/org/springframework/transaction/config/TxAdviceBeanDefinitionParser.java index 7883b719e9d3..46a363b7edb6 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/config/TxAdviceBeanDefinitionParser.java +++ b/spring-tx/src/main/java/org/springframework/transaction/config/TxAdviceBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/config/TxNamespaceHandler.java b/spring-tx/src/main/java/org/springframework/transaction/config/TxNamespaceHandler.java index ac6578983046..7de5c03f91e9 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/config/TxNamespaceHandler.java +++ b/spring-tx/src/main/java/org/springframework/transaction/config/TxNamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java index dd144cfcb2f6..e4679dcb7787 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java @@ -202,9 +202,9 @@ private static class DefaultCacheKey { private final Method method; - private final Class targetClass; + private final Class targetClass; - public DefaultCacheKey(Method method, Class targetClass) { + public DefaultCacheKey(Method method, Class targetClass) { this.method = method; this.targetClass = targetClass; } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/MatchAlwaysTransactionAttributeSource.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/MatchAlwaysTransactionAttributeSource.java index 42767a7ea421..c807119f761a 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/MatchAlwaysTransactionAttributeSource.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/MatchAlwaysTransactionAttributeSource.java @@ -34,7 +34,7 @@ * @see org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator */ public class MatchAlwaysTransactionAttributeSource implements TransactionAttributeSource, Serializable { - + private TransactionAttribute transactionAttribute = new DefaultTransactionAttribute(); diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/MethodMapTransactionAttributeSource.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/MethodMapTransactionAttributeSource.java index 0181a5efa5df..3e8293a87d4b 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/MethodMapTransactionAttributeSource.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/MethodMapTransactionAttributeSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ /** * Simple {@link TransactionAttributeSource} implementation that * allows attributes to be stored per method in a {@link Map}. - * + * * @author Rod Johnson * @author Juergen Hoeller * @since 24.04.2003 @@ -126,7 +126,7 @@ public void addTransactionalMethod(String name, TransactionAttribute attr) { } String className = name.substring(0, lastDotIndex); String methodName = name.substring(lastDotIndex + 1); - Class clazz = ClassUtils.resolveClassName(className, this.beanClassLoader); + Class clazz = ClassUtils.resolveClassName(className, this.beanClassLoader); addTransactionalMethod(clazz, methodName, attr); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java index 8a69517e0bea..1bfa352e15ce 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public void setNameMap(Map nameMap) { */ public void setProperties(Properties transactionAttributes) { TransactionAttributeEditor tae = new TransactionAttributeEditor(); - Enumeration propNames = transactionAttributes.propertyNames(); + Enumeration propNames = transactionAttributes.propertyNames(); while (propNames.hasMoreElements()) { String methodName = (String) propNames.nextElement(); String value = transactionAttributes.getProperty(methodName); diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/NoRollbackRuleAttribute.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/NoRollbackRuleAttribute.java index da4f0006ddb8..959ab21413d5 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/NoRollbackRuleAttribute.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/NoRollbackRuleAttribute.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2007 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ public class NoRollbackRuleAttribute extends RollbackRuleAttribute { * @param clazz the Throwable class * @see RollbackRuleAttribute#RollbackRuleAttribute(Class) */ - public NoRollbackRuleAttribute(Class clazz) { + public NoRollbackRuleAttribute(Class clazz) { super(clazz); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java index c1d7e41359a4..0a0fe62265ed 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RollbackRuleAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public class RollbackRuleAttribute implements Serializable{ * @throws IllegalArgumentException if the supplied clazz is * not a Throwable type or is null */ - public RollbackRuleAttribute(Class clazz) { + public RollbackRuleAttribute(Class clazz) { Assert.notNull(clazz, "'clazz' cannot be null."); if (!Throwable.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException( @@ -109,7 +109,7 @@ public int getDepth(Throwable ex) { } - private int getDepth(Class exceptionClass, int depth) { + private int getDepth(Class exceptionClass, int depth) { if (exceptionClass.getName().indexOf(this.exceptionName) != -1) { // Found it! return depth; @@ -133,7 +133,7 @@ public boolean equals(Object other) { RollbackRuleAttribute rhs = (RollbackRuleAttribute) other; return this.exceptionName.equals(rhs.exceptionName); } - + @Override public int hashCode() { return this.exceptionName.hashCode(); diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java index d67368843f36..d1f7b1665eb5 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java @@ -152,7 +152,7 @@ public boolean rollbackOn(Throwable ex) { logger.trace("No relevant rollback rule found: applying default rules"); return super.rollbackOn(ex); } - + return !(winner instanceof NoRollbackRuleAttribute); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java index 995c4bcbd5c2..85873bd7bbc2 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java @@ -266,7 +266,7 @@ else if (this.beanFactory instanceof ListableBeanFactory) { * tell if there was a transaction created. * @see #getTransactionAttributeSource() */ - protected TransactionInfo createTransactionIfNecessary(Method method, Class targetClass) { + protected TransactionInfo createTransactionIfNecessary(Method method, Class targetClass) { // If the transaction attribute is null, the method is non-transactional. TransactionAttribute txAttr = getTransactionAttributeSource().getTransactionAttribute(method, targetClass); PlatformTransactionManager tm = determineTransactionManager(txAttr); @@ -282,7 +282,7 @@ protected TransactionInfo createTransactionIfNecessary(Method method, Class targ * @return a String representation identifying this method * @see org.springframework.util.ClassUtils#getQualifiedMethodName */ - protected String methodIdentification(Method method, Class targetClass) { + protected String methodIdentification(Method method, Class targetClass) { String simpleMethodId = methodIdentification(method); if (simpleMethodId != null) { return simpleMethodId; diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttribute.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttribute.java index e208008cb66e..3e02fef6d559 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttribute.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttribute.java @@ -44,5 +44,5 @@ public interface TransactionAttribute extends TransactionDefinition { * @return whether to perform a rollback or not */ boolean rollbackOn(Throwable ex); - + } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisor.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisor.java index 941c2b7336ee..5b35ee0a27a8 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisor.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ * @see TransactionProxyFactoryBean */ public class TransactionAttributeSourceAdvisor extends AbstractPointcutAdvisor { - + private TransactionInterceptor transactionInterceptor; private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut() { diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditor.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditor.java index 5d6870718c98..5cf8d96d6a72 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditor.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public void setAsText(String text) throws IllegalArgumentException { // Now we have properties, process each one individually. TransactionAttributeEditor tae = new TransactionAttributeEditor(); - Enumeration propNames = props.propertyNames(); + Enumeration propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String name = (String) propNames.nextElement(); String value = props.getProperty(name); diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java index 6d4c3ff11a80..01c9787bdfad 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeSourcePointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ */ abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut implements Serializable { - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { TransactionAttributeSource tas = getTransactionAttributeSource(); return (tas == null || tas.getTransactionAttribute(method, targetClass) != null); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java index 6db3ef8169ac..c3e06844ebf3 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/package-info.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/package-info.java index 18f5282cd18b..1a88634aa5b1 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/package-info.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/package-info.java @@ -4,10 +4,10 @@ * AOP-based solution for declarative transaction demarcation. * Builds on the AOP infrastructure in org.springframework.aop.framework. * Any POJO can be transactionally advised with Spring. - * + * *

        The TransactionFactoryProxyBean can be used to create transactional * AOP proxies transparently to code that uses them. - * + * *

        The TransactionInterceptor is the AOP Alliance MethodInterceptor that * delivers transactional advice, based on the Spring transaction abstraction. * This allows declarative transaction management in any environment, diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/JtaAfterCompletionSynchronization.java b/spring-tx/src/main/java/org/springframework/transaction/jta/JtaAfterCompletionSynchronization.java index f2801c2b9c27..ca96aebc64ce 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/JtaAfterCompletionSynchronization.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/JtaAfterCompletionSynchronization.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java index 6929ef5aeeba..27d9d0b89ebd 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/OC4JJtaTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/jta/OC4JJtaTransactionManager.java index 64bffd7801bb..a62253df1083 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/OC4JJtaTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/OC4JJtaTransactionManager.java @@ -97,7 +97,7 @@ public void afterPropertiesSet() throws TransactionSystemException { @Override protected UserTransaction retrieveUserTransaction() throws TransactionSystemException { try { - Class transactionUtilityClass = getClass().getClassLoader().loadClass(TRANSACTION_UTILITY_CLASS_NAME); + Class transactionUtilityClass = getClass().getClassLoader().loadClass(TRANSACTION_UTILITY_CLASS_NAME); Method getInstanceMethod = transactionUtilityClass.getMethod("getInstance"); Object transactionUtility = getInstanceMethod.invoke(null); logger.debug("Retrieving JTA UserTransaction from OC4J TransactionUtility"); @@ -123,8 +123,8 @@ protected UserTransaction retrieveUserTransaction() throws TransactionSystemExce private void loadOC4JTransactionClasses() throws TransactionSystemException { // Find available OC4J API (in "oracle.j2ee.transaction" or "com.evermind.server") - Class transactionManagerClass = null; - Class transactionClass = null; + Class transactionManagerClass = null; + Class transactionClass = null; try { transactionManagerClass = getClass().getClassLoader().loadClass(TRANSACTION_MANAGER_CLASS_NAME); transactionClass = getClass().getClassLoader().loadClass(TRANSACTION_CLASS_NAME); diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/SpringJtaSynchronizationAdapter.java b/spring-tx/src/main/java/org/springframework/transaction/jta/SpringJtaSynchronizationAdapter.java index 44e1d5ad41cf..ffc7e9992833 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/SpringJtaSynchronizationAdapter.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/SpringJtaSynchronizationAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/WebLogicJtaTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/jta/WebLogicJtaTransactionManager.java index b9f994d27aa5..42b6ba8d6c7b 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/WebLogicJtaTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/WebLogicJtaTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -139,7 +139,7 @@ protected TransactionManager retrieveTransactionManager() throws TransactionSyst private void loadWebLogicTransactionHelper() throws TransactionSystemException { if (this.transactionHelper == null) { try { - Class transactionHelperClass = getClass().getClassLoader().loadClass(TRANSACTION_HELPER_CLASS_NAME); + Class transactionHelperClass = getClass().getClassLoader().loadClass(TRANSACTION_HELPER_CLASS_NAME); Method getTransactionHelperMethod = transactionHelperClass.getMethod("getTransactionHelper"); this.transactionHelper = getTransactionHelperMethod.invoke(null); logger.debug("WebLogic TransactionHelper found"); @@ -158,7 +158,7 @@ private void loadWebLogicTransactionHelper() throws TransactionSystemException { private void loadWebLogicTransactionClasses() throws TransactionSystemException { try { - Class userTransactionClass = getClass().getClassLoader().loadClass(USER_TRANSACTION_CLASS_NAME); + Class userTransactionClass = getClass().getClassLoader().loadClass(USER_TRANSACTION_CLASS_NAME); this.weblogicUserTransactionAvailable = userTransactionClass.isInstance(getUserTransaction()); if (this.weblogicUserTransactionAvailable) { this.beginWithNameMethod = userTransactionClass.getMethod("begin", String.class); @@ -170,13 +170,13 @@ private void loadWebLogicTransactionClasses() throws TransactionSystemException } // Obtain WebLogic ClientTransactionManager interface. - Class transactionManagerClass = + Class transactionManagerClass = getClass().getClassLoader().loadClass(CLIENT_TRANSACTION_MANAGER_CLASS_NAME); logger.debug("WebLogic ClientTransactionManager found"); this.weblogicTransactionManagerAvailable = transactionManagerClass.isInstance(getTransactionManager()); if (this.weblogicTransactionManagerAvailable) { - Class transactionClass = getClass().getClassLoader().loadClass(TRANSACTION_CLASS_NAME); + Class transactionClass = getClass().getClassLoader().loadClass(TRANSACTION_CLASS_NAME); this.forceResumeMethod = transactionManagerClass.getMethod("forceResume", Transaction.class); this.setPropertyMethod = transactionClass.getMethod("setProperty", String.class, Serializable.class); logger.debug("Support for WebLogic forceResume available"); diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java index e2349a4f56c9..99bd2080f110 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java index dbb9f85fb4c3..46ead299a642 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ * transaction for closing at transaction completion time, allowing e.g. for reuse * of the same Hibernate Session within the transaction. The same mechanism can * also be leveraged for custom synchronization needs in an application. - * + * *

        The state of this class is serializable, to allow for serializing the * transaction strategy along with proxies that carry a transaction interceptor. * It is up to subclasses if they wish to make their state to be serializable too. diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/SimpleTransactionStatus.java b/spring-tx/src/main/java/org/springframework/transaction/support/SimpleTransactionStatus.java index 0018fc1f4759..6ad3318a1d15 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/SimpleTransactionStatus.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/SimpleTransactionStatus.java @@ -19,7 +19,7 @@ /** * A simple {@link org.springframework.transaction.TransactionStatus} * implementation. - * + * *

        Derives from {@link AbstractTransactionStatus} and adds an explicit * {@link #isNewTransaction() "newTransaction"} flag. * diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronization.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronization.java index a152f94698e0..ccf5109c58ef 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronization.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronization.java @@ -44,7 +44,7 @@ public interface TransactionSynchronization { /** Completion status in case of heuristic mixed completion or system errors */ int STATUS_UNKNOWN = 2; - + /** * Suspend this synchronization. diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java index 93aafbdabd77..651892bd65d0 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ public static Map getResourceMap() { * Check if there is a resource for the given key bound to the current thread. * @param key the key to check (usually the resource factory) * @return if there is a value bound to the current thread - * @see ResourceTransactionManager#getResourceFactory() + * @see ResourceTransactionManager#getResourceFactory() */ public static boolean hasResource(Object key) { Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key); diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java index 3e174132d527..ed4d70bc573b 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionTemplate.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionTemplate.java index 18097552cf7f..63c8f8977fac 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionTemplate.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/beans/Colour.java b/spring-tx/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..4db722187d9d 100644 --- a/spring-tx/src/test/java/org/springframework/beans/Colour.java +++ b/spring-tx/src/test/java/org/springframework/beans/Colour.java @@ -32,4 +32,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java index 2bb41a9d5b68..db326041c361 100644 --- a/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java +++ b/spring-tx/src/test/java/org/springframework/beans/DerivedTestBean.java @@ -82,4 +82,4 @@ public boolean wasDestroyed() { return destroyed; } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-tx/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/IOther.java b/spring-tx/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-tx/src/test/java/org/springframework/beans/IOther.java +++ b/spring-tx/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/ITestBean.java b/spring-tx/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-tx/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-tx/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..4f3012666eac 100644 --- a/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-tx/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-tx/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/TestBean.java b/spring-tx/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..4cd145c9bb7e 100644 --- a/spring-tx/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-tx/src/test/java/org/springframework/beans/TestBean.java @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java index e2bfda3f1d6c..74d6b48540ec 100644 --- a/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java +++ b/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java @@ -83,4 +83,4 @@ public List getImports() { return Collections.unmodifiableList(this.imports); } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java index 8099156006c1..350f48c8c780 100644 --- a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java +++ b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationAdvisorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java index 3b759466a576..e902a491b630 100644 --- a/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java +++ b/spring-tx/src/test/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java b/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java index 010da75e8f5b..5cd19f8f02d3 100644 --- a/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java +++ b/spring-tx/src/test/java/org/springframework/dao/support/ChainedPersistenceExceptionTranslatorTests.java @@ -27,39 +27,39 @@ * @since 2.0 */ public class ChainedPersistenceExceptionTranslatorTests extends TestCase { - + public void testEmpty() { ChainedPersistenceExceptionTranslator pet = new ChainedPersistenceExceptionTranslator(); //MapPersistenceExceptionTranslator mpet = new MapPersistenceExceptionTranslator(); RuntimeException in = new RuntimeException("in"); assertSame(in, DataAccessUtils.translateIfNecessary(in, pet)); } - + public void testExceptionTranslationWithTranslation() { MapPersistenceExceptionTranslator mpet1 = new MapPersistenceExceptionTranslator(); RuntimeException in1 = new RuntimeException("in"); InvalidDataAccessApiUsageException out1 = new InvalidDataAccessApiUsageException("out"); InvalidDataAccessApiUsageException out2 = new InvalidDataAccessApiUsageException("out"); mpet1.addTranslation(in1, out1); - + ChainedPersistenceExceptionTranslator chainedPet1 = new ChainedPersistenceExceptionTranslator(); assertSame("Should not translate yet", in1, DataAccessUtils.translateIfNecessary(in1, chainedPet1)); chainedPet1.addDelegate(mpet1); assertSame("Should now translate", out1, DataAccessUtils.translateIfNecessary(in1, chainedPet1)); - + // Now add a new translator and verify it wins MapPersistenceExceptionTranslator mpet2 = new MapPersistenceExceptionTranslator(); mpet2.addTranslation(in1, out2); chainedPet1.addDelegate(mpet2); - assertSame("Should still translate the same due to ordering", + assertSame("Should still translate the same due to ordering", out1, DataAccessUtils.translateIfNecessary(in1, chainedPet1)); - + ChainedPersistenceExceptionTranslator chainedPet2 = new ChainedPersistenceExceptionTranslator(); chainedPet2.addDelegate(mpet2); chainedPet2.addDelegate(mpet1); - assertSame("Should translate differently due to ordering", + assertSame("Should translate differently due to ordering", out2, DataAccessUtils.translateIfNecessary(in1, chainedPet2)); - + RuntimeException in2 = new RuntimeException("in2"); OptimisticLockingFailureException out3 = new OptimisticLockingFailureException("out2"); assertNull(chainedPet2.translateExceptionIfPossible(in2)); diff --git a/spring-tx/src/test/java/org/springframework/jca/cci/CciLocalTransactionTests.java b/spring-tx/src/test/java/org/springframework/jca/cci/CciLocalTransactionTests.java index dc38fb5e8e2d..460fd516defc 100644 --- a/spring-tx/src/test/java/org/springframework/jca/cci/CciLocalTransactionTests.java +++ b/spring-tx/src/test/java/org/springframework/jca/cci/CciLocalTransactionTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -104,7 +104,7 @@ public void testLocalTransactionRollback() throws ResourceException { LocalTransaction localTransaction = createMock(LocalTransaction.class); final Record record = createMock(Record.class); final InteractionSpec interactionSpec = createMock(InteractionSpec.class); - + expect(connectionFactory.getConnection()).andReturn(connection); expect(connection.getLocalTransaction()).andReturn(localTransaction); @@ -122,7 +122,7 @@ public void testLocalTransactionRollback() throws ResourceException { localTransaction.rollback(); connection.close(); - + replay(connectionFactory, connection, localTransaction, interaction, record); org.springframework.jca.cci.connection.CciLocalTransactionManager tm = new org.springframework.jca.cci.connection.CciLocalTransactionManager(); diff --git a/spring-tx/src/test/java/org/springframework/jca/cci/CciTemplateTests.java b/spring-tx/src/test/java/org/springframework/jca/cci/CciTemplateTests.java index d724b77190ce..50bdd4c2de7d 100644 --- a/spring-tx/src/test/java/org/springframework/jca/cci/CciTemplateTests.java +++ b/spring-tx/src/test/java/org/springframework/jca/cci/CciTemplateTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -699,7 +699,7 @@ public void testTemplateExecuteInputFalseTrue() throws ResourceException { replay(connectionFactory, connection, interaction); CciTemplate ct = new CciTemplate(connectionFactory); - Record tmpOutputRecord = (Record) ct.execute(interactionSpec, + Record tmpOutputRecord = ct.execute(interactionSpec, inputOutputRecord); assertNull(tmpOutputRecord); diff --git a/spring-tx/src/test/java/org/springframework/jca/cci/EisOperationTests.java b/spring-tx/src/test/java/org/springframework/jca/cci/EisOperationTests.java index 0fa0b63d4bd0..be76b59fd983 100644 --- a/spring-tx/src/test/java/org/springframework/jca/cci/EisOperationTests.java +++ b/spring-tx/src/test/java/org/springframework/jca/cci/EisOperationTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -80,7 +80,7 @@ public void testSimpleRecordOperationWithExplicitOutputRecord() throws ResourceE InteractionSpec interactionSpec = createMock(InteractionSpec.class); SimpleRecordOperation operation = new SimpleRecordOperation(connectionFactory, interactionSpec); - + expect(connectionFactory.getConnection()).andReturn(connection); expect(connection.createInteraction()).andReturn(interaction); diff --git a/spring-tx/src/test/java/org/springframework/jca/support/LocalConnectionFactoryBeanTests.java b/spring-tx/src/test/java/org/springframework/jca/support/LocalConnectionFactoryBeanTests.java index c19efddd551a..3a4a1add626d 100644 --- a/spring-tx/src/test/java/org/springframework/jca/support/LocalConnectionFactoryBeanTests.java +++ b/spring-tx/src/test/java/org/springframework/jca/support/LocalConnectionFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java index 28670fd43837..3dd9166cb526 100644 --- a/spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java +++ b/spring-tx/src/test/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import javax.naming.NamingException; -import org.springframework.core.CollectionFactory; import org.springframework.jndi.JndiTemplate; /** diff --git a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java index b6489e42029f..fd67ca3d5d0d 100644 --- a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ b/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java index 8b816b45d0d6..e3084b889585 100644 --- a/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ b/spring-tx/src/test/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ * DataSource ds = new DriverManagerDataSource(...); * builder.bind("java:comp/env/jdbc/myds", ds); * builder.activate(); - * + * * Note that it's impossible to activate multiple builders within the same JVM, * due to JNDI restrictions. Thus to configure a fresh builder repeatedly, use * the following code to get a reference to either an already activated builder diff --git a/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java b/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java index d5c2531fbde5..563d61071495 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java +++ b/spring-tx/src/test/java/org/springframework/transaction/CallCountingTransactionManager.java @@ -50,7 +50,7 @@ protected void doRollback(DefaultTransactionStatus status) { ++rollbacks; --inflight; } - + public void clear() { begun = commits = rollbacks = inflight = 0; } diff --git a/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java b/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java index c78fdcf43cb4..8b0017692130 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java b/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java index 4b6d23d36984..1f4715784b70 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ * @since 12.05.2003 */ public class JtaTransactionManagerTests extends TestCase { - + public void testJtaTransactionManagerWithCommit() throws Exception { MockControl utControl = MockControl.createControl(UserTransaction.class); UserTransaction ut = (UserTransaction) utControl.getMock(); diff --git a/spring-tx/src/test/java/org/springframework/transaction/TestTransactionManager.java b/spring-tx/src/test/java/org/springframework/transaction/TestTransactionManager.java index f64862b93898..1cd39725b04f 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/TestTransactionManager.java +++ b/spring-tx/src/test/java/org/springframework/transaction/TestTransactionManager.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java b/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java index b83f83ebd4b4..cfae77ca56b6 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerTests.java @@ -76,13 +76,13 @@ public void testInvokeTransactional() throws Exception { assertEquals("Should have 1 rolled back transaction", 1, ptm.rollbacks); } } - + public void testRollbackRules() { TransactionInterceptor txInterceptor = (TransactionInterceptor) context.getBean("txRollbackAdvice"); TransactionAttributeSource txAttrSource = txInterceptor.getTransactionAttributeSource(); TransactionAttribute txAttr = txAttrSource.getTransactionAttribute(getAgeMethod,ITestBean.class); assertTrue("should be configured to rollback on Exception",txAttr.rollbackOn(new Exception())); - + txAttr = txAttrSource.getTransactionAttribute(setAgeMethod, ITestBean.class); assertFalse("should not rollback on RuntimeException",txAttr.rollbackOn(new RuntimeException())); } diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java index 9bd446fc87c1..ac125cb288c4 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ * @author Juergen Hoeller */ public class AnnotationTransactionAttributeSourceTests { - + @Test public void testSerializable() throws Exception { TestBean1 tb = new TestBean1(); @@ -71,10 +71,10 @@ public void testSerializable() throws Exception { @Test public void testNullOrEmpty() throws Exception { Method method = Empty.class.getMethod("getAge", (Class[]) null); - + AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource(); assertNull(atas.getTransactionAttribute(method, null)); - + // Try again in case of caching assertNull(atas.getTransactionAttribute(method, null)); } @@ -86,10 +86,10 @@ public void testNullOrEmpty() throws Exception { @Test public void testTransactionAttributeDeclaredOnClassMethod() throws Exception { Method classMethod = ITestBean.class.getMethod("getAge", (Class[]) null); - + AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource(); TransactionAttribute actual = atas.getTransactionAttribute(classMethod, TestBean1.class); - + RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute(); rbta.getRollbackRules().add(new RollbackRuleAttribute(Exception.class)); assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules()); @@ -124,7 +124,7 @@ public void testTransactionAttributeDeclaredOnInterfaceMethodOnly() throws Excep AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource(); TransactionAttribute actual = atas.getTransactionAttribute(interfaceMethod, TestBean2.class); - + RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute(); assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules()); } @@ -152,11 +152,11 @@ public void testTransactionAttributeOnTargetClassMethodOverridesAttributeOnInter TransactionAttribute actual2 = atas.getTransactionAttribute(interfaceMethod2, TestBean3.class); assertEquals(TransactionAttribute.PROPAGATION_REQUIRED, actual2.getPropagationBehavior()); } - + @Test public void testRollbackRulesAreApplied() throws Exception { Method method = TestBean3.class.getMethod("getAge", (Class[]) null); - + AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource(); TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean3.class); @@ -167,13 +167,13 @@ public void testRollbackRulesAreApplied() throws Exception { assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules()); assertTrue(actual.rollbackOn(new Exception())); assertFalse(actual.rollbackOn(new IOException())); - + actual = atas.getTransactionAttribute(method, method.getDeclaringClass()); rbta = new RuleBasedTransactionAttribute(); rbta.getRollbackRules().add(new RollbackRuleAttribute("java.lang.Exception")); rbta.getRollbackRules().add(new NoRollbackRuleAttribute(IOException.class)); - + assertEquals(rbta.getRollbackRules(), ((RuleBasedTransactionAttribute) actual).getRollbackRules()); assertTrue(actual.rollbackOn(new Exception())); assertFalse(actual.rollbackOn(new IOException())); @@ -189,7 +189,7 @@ public void testDefaultsToClassTransactionAttribute() throws Exception { AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource(); TransactionAttribute actual = atas.getTransactionAttribute(method, TestBean4.class); - + RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute(); rbta.getRollbackRules().add(new RollbackRuleAttribute(Exception.class)); rbta.getRollbackRules().add(new NoRollbackRuleAttribute(IOException.class)); @@ -265,7 +265,7 @@ public interface ITestBean { void setAge(int age); - String getName(); + String getName(); void setName(String name); } @@ -278,7 +278,7 @@ public interface ITestBean2 { void setAge(int age); - String getName(); + String getName(); void setName(String name); } @@ -291,12 +291,12 @@ public interface ITestBean3 { void setAge(int age); - String getName(); + String getName(); void setName(String name); } - + public static class Empty implements ITestBean { private String name; diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java index 2b813663196d..36c076ce521f 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionNamespaceHandlerTests.java @@ -82,14 +82,14 @@ public void testInvokeTransactional() throws Exception { } } - + public void testNonPublicMethodsNotAdvised() { TransactionalTestBean testBean = getTestBean(); CallCountingTransactionManager ptm = (CallCountingTransactionManager) context.getBean("transactionManager"); assertEquals("Should not have any started transactions", 0, ptm.begun); testBean.annotationsOnProtectedAreIgnored(); - assertEquals("Should not have any started transactions", 0, ptm.begun); + assertEquals("Should not have any started transactions", 0, ptm.begun); } public void testMBeanExportAlsoWorks() throws Exception { @@ -125,7 +125,7 @@ public void exceptional(Throwable t) throws Throwable { public String doSomething() { return "done"; } - + @Transactional protected void annotationsOnProtectedAreIgnored() { } diff --git a/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java b/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java index f72e3bd4abbe..5c68603d6f4d 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java index 790c0ee53cfe..42f826e687e2 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/AbstractTransactionAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,11 +47,11 @@ * @since 16.03.2003 */ public abstract class AbstractTransactionAspectTests extends TestCase { - + protected Method exceptionalMethod; - + protected Method getNameMethod; - + protected Method setNameMethod; @@ -246,7 +246,7 @@ public void testEnclosingTransactionWithNonTransactionMethodOnAdvisedInside() th ptm.commit(status); ptmControl.setVoidCallable(1); ptmControl.replay(); - + final String spouseName = "innerName"; TestBean outer = new TestBean() { @@ -264,7 +264,7 @@ public String getName() { return spouseName; } }; - + ITestBean outerProxy = (ITestBean) advised(outer, ptm, tas); ITestBean innerProxy = (ITestBean) advised(inner, ptm, tas); outer.setSpouse(innerProxy); @@ -272,13 +272,13 @@ public String getName() { checkTransactionStatus(false); // Will invoke inner.getName, which is non-transactional - outerProxy.exceptional(null); - + outerProxy.exceptional(null); + checkTransactionStatus(false); ptmControl.verify(); } - + public void testEnclosingTransactionWithNestedTransactionOnAdvisedInside() throws Throwable { final TransactionAttribute outerTxatt = new DefaultTransactionAttribute(); final TransactionAttribute innerTxatt = new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_NESTED); @@ -291,23 +291,23 @@ public void testEnclosingTransactionWithNestedTransactionOnAdvisedInside() throw TransactionStatus outerStatus = transactionStatusForNewTransaction(); TransactionStatus innerStatus = transactionStatusForNewTransaction(); - + MockControl ptmControl = MockControl.createControl(PlatformTransactionManager.class); PlatformTransactionManager ptm = (PlatformTransactionManager) ptmControl.getMock(); // Expect a transaction ptm.getTransaction(outerTxatt); ptmControl.setReturnValue(outerStatus, 1); - + ptm.getTransaction(innerTxatt); ptmControl.setReturnValue(innerStatus, 1); - + ptm.commit(innerStatus); ptmControl.setVoidCallable(1); - + ptm.commit(outerStatus); ptmControl.setVoidCallable(1); ptmControl.replay(); - + final String spouseName = "innerName"; TestBean outer = new TestBean() { @@ -328,7 +328,7 @@ public String getName() { return spouseName; } }; - + ITestBean outerProxy = (ITestBean) advised(outer, ptm, tas); ITestBean innerProxy = (ITestBean) advised(inner, ptm, tas); outer.setSpouse(innerProxy); @@ -336,13 +336,13 @@ public String getName() { checkTransactionStatus(false); // Will invoke inner.getName, which is non-transactional - outerProxy.exceptional(null); - + outerProxy.exceptional(null); + checkTransactionStatus(false); ptmControl.verify(); } - + public void testRollbackOnCheckedException() throws Throwable { doTestRollbackOnException(new Exception(), true, false); } @@ -419,7 +419,7 @@ public boolean rollbackOn(Throwable t) { } ptmControl.replay(); - TestBean tb = new TestBean(); + TestBean tb = new TestBean(); ITestBean itb = (ITestBean) advised(tb, ptm, tas); try { @@ -437,7 +437,7 @@ public boolean rollbackOn(Throwable t) { ptmControl.verify(); } - + /** * Test that TransactionStatus.setRollbackOnly works. */ @@ -466,7 +466,7 @@ public String getName() { return name; } }; - + ITestBean itb = (ITestBean) advised(tb, ptm, tas); // verification!? @@ -474,7 +474,7 @@ public String getName() { ptmControl.verify(); } - + /** * @return a TransactionStatus object configured for a new transaction */ @@ -507,7 +507,7 @@ public String getName() { throw new UnsupportedOperationException( "Shouldn't have invoked target method when couldn't create transaction for transactional method"); } - }; + }; ITestBean itb = (ITestBean) advised(tb, ptm, tas); try { @@ -545,7 +545,7 @@ public void testCannotCommitTransaction() throws Exception { ptmControl.setThrowable(ex); ptmControl.replay(); - TestBean tb = new TestBean(); + TestBean tb = new TestBean(); ITestBean itb = (ITestBean) advised(tb, ptm, tas); String name = "new name"; diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java index 09388b1d8120..27d72c2dc4e3 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2012 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -66,13 +66,13 @@ public void testGetsAreNotTransactionalWithProxyFactory2DynamicProxy() throws No assertTrue("testBean is a dynamic proxy", Proxy.isProxyClass(testBean.getClass())); doTestGetsAreNotTransactional(testBean); } - + public void testGetsAreNotTransactionalWithProxyFactory2Cglib() throws NoSuchMethodException { ITestBean testBean = (ITestBean) factory.getBean("proxyFactory2Cglib"); assertTrue("testBean is CGLIB advised", AopUtils.isCglibProxy(testBean)); doTestGetsAreNotTransactional(testBean); } - + public void testProxyFactory2Lazy() throws NoSuchMethodException { ITestBean testBean = (ITestBean) factory.getBean("proxyFactory2Lazy"); assertFalse(factory.containsSingleton("target")); @@ -84,14 +84,14 @@ public void testCglibTransactionProxyImplementsNoInterfaces() throws NoSuchMetho ImplementsNoInterfaces ini = (ImplementsNoInterfaces) factory.getBean("cglibNoInterfaces"); assertTrue("testBean is CGLIB advised", AopUtils.isCglibProxy(ini)); String newName = "Gordon"; - + // Install facade CallCountingTransactionManager ptm = new CallCountingTransactionManager(); PlatformTransactionManagerFacade.delegate = ptm; - + ini.setName(newName); assertEquals(newName, ini.getName()); - assertEquals(2, ptm.commits); + assertEquals(2, ptm.commits); } public void testGetsAreNotTransactionalWithProxyFactory3() throws NoSuchMethodException { @@ -171,7 +171,7 @@ public void testNoTransactionAttributeSource() { // Ok } } - + /** * Test that we can set the target to a dynamic TargetSource. */ @@ -179,13 +179,13 @@ public void testDynamicTargetSource() throws NoSuchMethodException { // Install facade CallCountingTransactionManager txMan = new CallCountingTransactionManager(); PlatformTransactionManagerFacade.delegate = txMan; - + TestBean tb = (TestBean) factory.getBean("hotSwapped"); assertEquals(666, tb.getAge()); int newAge = 557; tb.setAge(newAge); assertEquals(newAge, tb.getAge()); - + TestBean target2 = new TestBean(); target2.setAge(65); HotSwappableTargetSource ts = (HotSwappableTargetSource) factory.getBean("swapper"); @@ -193,7 +193,7 @@ public void testDynamicTargetSource() throws NoSuchMethodException { assertEquals(target2.getAge(), tb.getAge()); tb.setAge(newAge); assertEquals(newAge, target2.getAge()); - + assertEquals(0, txMan.inflight); assertEquals(2, txMan.commits); assertEquals(0, txMan.rollbacks); diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java index 90f0361eed78..75e100602f20 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/ImplementsNoInterfaces.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,17 +25,17 @@ * @author Rod Johnson */ public class ImplementsNoInterfaces { - + private TestBean testBean; - + public void setDependency(TestBean testBean) { this.testBean = testBean; } - + public String getName() { return testBean.getName(); } - + public void setName(String name) { testBean.setName(name); } diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/MyRuntimeException.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/MyRuntimeException.java index bdb09009aa82..1e804de13210 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/MyRuntimeException.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/MyRuntimeException.java @@ -20,7 +20,7 @@ /** * An example {@link RuntimeException} for use in testing rollback rules. - * + * * @author Chris Beams */ @SuppressWarnings("serial") diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/PlatformTransactionManagerFacade.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/PlatformTransactionManagerFacade.java index 78360642277b..7aa4a1e275b0 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/PlatformTransactionManagerFacade.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/PlatformTransactionManagerFacade.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ * @since 26.04.2003 */ public class PlatformTransactionManagerFacade implements PlatformTransactionManager { - + /** * This member can be changed to change behavior class-wide. */ diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java index c9125fc6cd81..d1884954fd7f 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java @@ -39,17 +39,17 @@ public void testFoundImmediatelyWithString() { RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName()); assertTrue(rr.getDepth(new Exception()) == 0); } - + public void testFoundImmediatelyWithClass() { RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class); assertTrue(rr.getDepth(new Exception()) == 0); } - + public void testNotFound() { RollbackRuleAttribute rr = new RollbackRuleAttribute(java.io.IOException.class.getName()); assertTrue(rr.getDepth(new MyRuntimeException("")) == -1); } - + public void testAncestry() { RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName()); // Exception -> Runtime -> NestedRuntime -> MyRuntimeException diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttributeTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttributeTests.java index be7d9c254a96..f6815ec61d47 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttributeTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeEditorTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeEditorTests.java index 19abfc652326..327675aaa24a 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeEditorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeEditorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java index 8911d31bb12a..bfd9071cdc8b 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,15 +23,15 @@ import junit.framework.TestCase; /** - * + * * @author Rod Johnson */ public class TransactionAttributeSourceAdvisorTests extends TestCase { - + public TransactionAttributeSourceAdvisorTests(String s) { super(s); } - + public void testSerializability() throws Exception { TransactionInterceptor ti = new TransactionInterceptor(); ti.setTransactionAttributes(new Properties()); diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditorTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditorTests.java index 1c74ff2e096b..3ed4ebcb35c3 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceEditorTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ import org.springframework.transaction.TransactionDefinition; /** - * Format is + * Format is * FQN.Method=tx attribute representation * * @author Rod Johnson @@ -50,7 +50,7 @@ public void testInvalid() throws Exception { // Ok } } - + public void testMatchesSpecific() throws Exception { TransactionAttributeSourceEditor pe = new TransactionAttributeSourceEditor(); // TODO need FQN? diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceTests.java index b5a7b2c741c5..37f7f37af3b8 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java index fbe4b9f6cee4..5447995f5f6b 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,14 +45,14 @@ protected Object advised(Object target, PlatformTransactionManager ptm, Transact } /** - * Template method to create an advised object given the + * Template method to create an advised object given the * target object and transaction setup. * Creates a TransactionInterceptor and applies it. */ protected Object advised(Object target, PlatformTransactionManager ptm, TransactionAttributeSource tas) { TransactionInterceptor ti = new TransactionInterceptor(); ti.setTransactionManager(ptm); - assertEquals(ptm, ti.getTransactionManager()); + assertEquals(ptm, ti.getTransactionManager()); ti.setTransactionAttributeSource(tas); assertEquals(tas, ti.getTransactionAttributeSource()); @@ -60,9 +60,9 @@ protected Object advised(Object target, PlatformTransactionManager ptm, Transact pf.addAdvice(0, ti); return pf.getProxy(); } - + /** - * A TransactionInterceptor should be serializable if its + * A TransactionInterceptor should be serializable if its * PlatformTransactionManager is. */ public void testSerializableWithAttributeProperties() throws Exception { @@ -121,6 +121,6 @@ public void commit(TransactionStatus status) throws TransactionException { public void rollback(TransactionStatus status) throws TransactionException { throw new UnsupportedOperationException(); } - + } } diff --git a/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java b/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java index b6dbf51348fc..0114092514b2 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java b/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java index cce8a857647b..7f699d8e9098 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java index dbe6421093e4..39a7582e831c 100644 --- a/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java +++ b/spring-tx/src/test/java/org/springframework/util/SerializationTestUtils.java @@ -94,4 +94,4 @@ public void testWithSerializableObject() throws Exception { assertEquals(y, (int) p2.getY()); } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/http/HttpEntity.java b/spring-web/src/main/java/org/springframework/http/HttpEntity.java index c876d8fe7089..2bd3856506c2 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpEntity.java +++ b/spring-web/src/main/java/org/springframework/http/HttpEntity.java @@ -56,7 +56,7 @@ public class HttpEntity { /** * The empty {@code HttpEntity}, with no body or headers. */ - public static final HttpEntity EMPTY = new HttpEntity(); + public static final HttpEntity EMPTY = new HttpEntity(); private final HttpHeaders headers; diff --git a/spring-web/src/main/java/org/springframework/http/MediaType.java b/spring-web/src/main/java/org/springframework/http/MediaType.java index e8853a9b16c4..42383a275e78 100644 --- a/spring-web/src/main/java/org/springframework/http/MediaType.java +++ b/spring-web/src/main/java/org/springframework/http/MediaType.java @@ -830,8 +830,11 @@ public static void sortByQualityValue(List mediaTypes) { public static void sortBySpecificityAndQuality(List mediaTypes) { Assert.notNull(mediaTypes, "'mediaTypes' must not be null"); if (mediaTypes.size() > 1) { - Collections.sort(mediaTypes, new CompoundComparator( - MediaType.SPECIFICITY_COMPARATOR, MediaType.QUALITY_VALUE_COMPARATOR)); + @SuppressWarnings("unchecked") + Comparator[] comparators = new Comparator[2]; + comparators[0] = MediaType.SPECIFICITY_COMPARATOR; + comparators[1] = MediaType.QUALITY_VALUE_COMPARATOR; + Collections.sort(mediaTypes, new CompoundComparator(comparators)); } } diff --git a/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpRequest.java index 65ecf35a1728..a3531a42e042 100644 --- a/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpResponse.java b/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpResponse.java index 7cc8cec6e937..0e3f949da395 100644 --- a/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/client/CommonsClientHttpResponse.java @@ -74,4 +74,4 @@ public void close() { this.httpMethod.releaseConnection(); } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java index 16a5908e4583..0258bbf155d8 100644 --- a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java index 37008ee8cfa3..de141afc41c5 100644 --- a/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java @@ -63,7 +63,7 @@ public URI getURI() { @Override protected final ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException { RequestExecution requestExecution = new RequestExecution(); - + return requestExecution.execute(this, bufferedOutput); } diff --git a/spring-web/src/main/java/org/springframework/http/client/support/HttpAccessor.java b/spring-web/src/main/java/org/springframework/http/client/support/HttpAccessor.java index 1b2ecd2b1b7f..c83350cdd150 100644 --- a/spring-web/src/main/java/org/springframework/http/client/support/HttpAccessor.java +++ b/spring-web/src/main/java/org/springframework/http/client/support/HttpAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/AbstractHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/AbstractHttpMessageConverter.java index c81935be60b8..a143b6b207a6 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/AbstractHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/AbstractHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java index b9392d0d95d2..d9bec7b4773d 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/BufferedImageHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java index 93517ea81e14..f6934eed6e5e 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/ByteArrayHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public boolean supports(Class clazz) { } @Override - public byte[] readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException { + public byte[] readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException { long contentLength = inputMessage.getHeaders().getContentLength(); if (contentLength >= 0) { ByteArrayOutputStream bos = new ByteArrayOutputStream((int) contentLength); diff --git a/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java index 0bbe671083f4..419f4241f05a 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -266,7 +266,7 @@ private void writeParts(OutputStream os, MultiValueMap parts, by String name = entry.getKey(); for (Object part : entry.getValue()) { writeBoundary(boundary, os); - HttpEntity entity = getEntity(part); + HttpEntity entity = getEntity(part); writePart(name, entity, os); writeNewLine(os); } @@ -280,18 +280,17 @@ private void writeBoundary(byte[] boundary, OutputStream os) throws IOException writeNewLine(os); } - @SuppressWarnings("unchecked") - private HttpEntity getEntity(Object part) { + private HttpEntity getEntity(Object part) { if (part instanceof HttpEntity) { - return (HttpEntity) part; + return (HttpEntity) part; } else { - return new HttpEntity(part); + return new HttpEntity(part); } } - @SuppressWarnings("unchecked") - private void writePart(String name, HttpEntity partEntity, OutputStream os) throws IOException { + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void writePart(String name, HttpEntity partEntity, OutputStream os) throws IOException { Object partBody = partEntity.getBody(); Class partType = partBody.getClass(); HttpHeaders partHeaders = partEntity.getHeaders(); diff --git a/spring-web/src/main/java/org/springframework/http/converter/HttpMessageNotWritableException.java b/spring-web/src/main/java/org/springframework/http/converter/HttpMessageNotWritableException.java index 29f8dc4fe9ab..22a86b3da2b1 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/HttpMessageNotWritableException.java +++ b/spring-web/src/main/java/org/springframework/http/converter/HttpMessageNotWritableException.java @@ -44,4 +44,4 @@ public HttpMessageNotWritableException(String msg) { public HttpMessageNotWritableException(String msg, Throwable cause) { super(msg, cause); } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java index 9991fbcc8048..1fe3702a03b1 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java index e8a4e43c7bfc..3a593828e564 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java index 7add4751ba16..cc1cac2e3c2e 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,4 +44,4 @@ protected boolean supports(Class clazz) { } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractJaxb2HttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractJaxb2HttpMessageConverter.java index 3a0bce583abb..88038f1e4f23 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractJaxb2HttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractJaxb2HttpMessageConverter.java @@ -35,8 +35,7 @@ */ public abstract class AbstractJaxb2HttpMessageConverter extends AbstractXmlHttpMessageConverter { - private final ConcurrentMap jaxbContexts = new ConcurrentHashMap(64); - + private final ConcurrentMap, JAXBContext> jaxbContexts = new ConcurrentHashMap, JAXBContext>(); /** * Create a new {@link Marshaller} for the given class. @@ -44,7 +43,7 @@ public abstract class AbstractJaxb2HttpMessageConverter extends AbstractXmlHt * @return the {@code Marshaller} * @throws HttpMessageConversionException in case of JAXB errors */ - protected final Marshaller createMarshaller(Class clazz) { + protected final Marshaller createMarshaller(Class clazz) { try { JAXBContext jaxbContext = getJaxbContext(clazz); return jaxbContext.createMarshaller(); @@ -61,7 +60,7 @@ protected final Marshaller createMarshaller(Class clazz) { * @return the {@code Unmarshaller} * @throws HttpMessageConversionException in case of JAXB errors */ - protected final Unmarshaller createUnmarshaller(Class clazz) throws JAXBException { + protected final Unmarshaller createUnmarshaller(Class clazz) throws JAXBException { try { JAXBContext jaxbContext = getJaxbContext(clazz); return jaxbContext.createUnmarshaller(); @@ -78,7 +77,7 @@ protected final Unmarshaller createUnmarshaller(Class clazz) throws JAXBExceptio * @return the {@code JAXBContext} * @throws HttpMessageConversionException in case of JAXB errors */ - protected final JAXBContext getJaxbContext(Class clazz) { + protected final JAXBContext getJaxbContext(Class clazz) { Assert.notNull(clazz, "'clazz' must not be null"); JAXBContext jaxbContext = this.jaxbContexts.get(clazz); if (jaxbContext == null) { diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractXmlHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractXmlHttpMessageConverter.java index f10f7114eb59..454a7d31cb68 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractXmlHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/AbstractXmlHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java index 89d5bd0bd2f9..af4c43e096f4 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ protected Object readFromSource(Class clazz, HttpHeaders headers, Source sour return unmarshaller.unmarshal(source); } else { - JAXBElement jaxbElement = unmarshaller.unmarshal(source, clazz); + JAXBElement jaxbElement = unmarshaller.unmarshal(source, clazz); return jaxbElement.getValue(); } } @@ -90,7 +90,7 @@ protected Object readFromSource(Class clazz, HttpHeaders headers, Source sour @Override protected void writeToResult(Object o, HttpHeaders headers, Result result) throws IOException { try { - Class clazz = ClassUtils.getUserClass(o); + Class clazz = ClassUtils.getUserClass(o); Marshaller marshaller = createMarshaller(clazz); setCharset(headers.getContentType(), marshaller); marshaller.marshal(o, result); diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverter.java index efb6944ae52d..cb59612af32e 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java index e94950326322..7839dadaf678 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ public boolean supports(Class clazz) { @Override @SuppressWarnings("unchecked") - protected T readFromSource(Class clazz, HttpHeaders headers, Source source) throws IOException { + protected T readFromSource(Class clazz, HttpHeaders headers, Source source) throws IOException { try { if (DOMSource.class.equals(clazz)) { DOMResult domResult = new DOMResult(); diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.java index 83027eabf6fa..ff4d4fa41422 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.http.converter.xml; +import javax.xml.transform.Source; + import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; @@ -31,7 +33,7 @@ public class XmlAwareFormHttpMessageConverter extends FormHttpMessageConverter { public XmlAwareFormHttpMessageConverter() { super(); - addPartConverter(new SourceHttpMessageConverter()); + addPartConverter(new SourceHttpMessageConverter()); } } diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapClientInterceptor.java b/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapClientInterceptor.java index 0529f38206c1..695363bd66ec 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapClientInterceptor.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapExporter.java b/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapExporter.java index 27d4ba86d2a5..eca759bdb7b9 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/BurlapExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/HessianClientInterceptor.java b/spring-web/src/main/java/org/springframework/remoting/caucho/HessianClientInterceptor.java index 712f4bbce085..ec77b1d4486f 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/HessianClientInterceptor.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/HessianClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -223,7 +223,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { } catch (InvocationTargetException ex) { Throwable targetEx = ex.getTargetException(); - // Hessian 4.0 check: another layer of InvocationTargetException. + // Hessian 4.0 check: another layer of InvocationTargetException. if (targetEx instanceof InvocationTargetException) { targetEx = ((InvocationTargetException) targetEx).getTargetException(); } diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java b/spring-web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java index a3a3aeca6c63..aa4259724e27 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java index 9f83c31bec46..4c94d0aa6371 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleBurlapServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleBurlapServiceExporter.java index aed4137c5ad9..6e5471d6ad34 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleBurlapServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleBurlapServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java index d0e49e94a43a..a4e483657d0e 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/caucho/package-info.java b/spring-web/src/main/java/org/springframework/remoting/caucho/package-info.java index 498f58a674ba..68e2b0ee5bff 100644 --- a/spring-web/src/main/java/org/springframework/remoting/caucho/package-info.java +++ b/spring-web/src/main/java/org/springframework/remoting/caucho/package-info.java @@ -4,11 +4,11 @@ * This package provides remoting classes for Caucho's Hessian and Burlap * protocols: a proxy factory for accessing Hessian/Burlap services, * and an exporter for making beans available to Hessian/Burlap clients. - * + * *

        Hessian is a slim, binary RPC protocol over HTTP. * For information on Hessian, see the * Hessian website - * + * *

        Burlap is a slim, XML-based RPC protocol over HTTP. * For information on Burlap, see the * Burlap website diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/AbstractHttpInvokerRequestExecutor.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/AbstractHttpInvokerRequestExecutor.java index 257d4a306f1e..49b7462a45c5 100644 --- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/AbstractHttpInvokerRequestExecutor.java +++ b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/AbstractHttpInvokerRequestExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/CommonsHttpInvokerRequestExecutor.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/CommonsHttpInvokerRequestExecutor.java index c53e36422681..0a4729b44a7e 100644 --- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/CommonsHttpInvokerRequestExecutor.java +++ b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/CommonsHttpInvokerRequestExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerClientInterceptor.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerClientInterceptor.java index df2fba95cccc..15122b56f698 100644 --- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerClientInterceptor.java +++ b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java index 67d35cae79d3..d95b47122cf2 100644 --- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java index 084a4e6596f7..ed94d9d8e953 100644 --- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/SimpleHttpInvokerServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/package-info.java b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/package-info.java index a18e047d91f9..7430dc45fe58 100644 --- a/spring-web/src/main/java/org/springframework/remoting/httpinvoker/package-info.java +++ b/spring-web/src/main/java/org/springframework/remoting/httpinvoker/package-info.java @@ -4,7 +4,7 @@ * Remoting classes for transparent Java-to-Java remoting via HTTP invokers. * Uses Java serialization just like RMI, but provides the same ease of setup * as Caucho's HTTP-based Hessian and Burlap protocols. - * + * *

        HTTP invoker is the recommended protocol for Java-to-Java remoting. * It is more powerful and more extensible than Hessian and Burlap, at the * expense of being tied to Java. Neverthelesss, it is as easy to set up as diff --git a/spring-web/src/main/java/org/springframework/remoting/jaxrpc/JaxRpcPortClientInterceptor.java b/spring-web/src/main/java/org/springframework/remoting/jaxrpc/JaxRpcPortClientInterceptor.java index 4fd4047ae761..afa55f21f384 100644 --- a/spring-web/src/main/java/org/springframework/remoting/jaxrpc/JaxRpcPortClientInterceptor.java +++ b/spring-web/src/main/java/org/springframework/remoting/jaxrpc/JaxRpcPortClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,9 +96,9 @@ public class JaxRpcPortClientInterceptor extends LocalJaxRpcServiceFactory /** Map of custom properties, keyed by property name (String) */ private final Map customPropertyMap = new HashMap(); - private Class serviceInterface; + private Class serviceInterface; - private Class portInterface; + private Class portInterface; private boolean lookupServiceOnStartup = true; @@ -273,7 +273,7 @@ public void addCustomProperty(String name, Object value) { * @see javax.xml.rpc.Service#createCall * @see #setPortInterface */ - public void setServiceInterface(Class serviceInterface) { + public void setServiceInterface(Class serviceInterface) { if (serviceInterface != null && !serviceInterface.isInterface()) { throw new IllegalArgumentException("'serviceInterface' must be an interface"); } @@ -283,7 +283,7 @@ public void setServiceInterface(Class serviceInterface) { /** * Return the interface of the service that this factory should create a proxy for. */ - public Class getServiceInterface() { + public Class getServiceInterface() { return this.serviceInterface; } @@ -301,7 +301,7 @@ public Class getServiceInterface() { * @see java.rmi.Remote * @see #setServiceInterface */ - public void setPortInterface(Class portInterface) { + public void setPortInterface(Class portInterface) { if (portInterface != null && (!portInterface.isInterface() || !Remote.class.isAssignableFrom(portInterface))) { throw new IllegalArgumentException( @@ -313,7 +313,7 @@ public void setPortInterface(Class portInterface) { /** * Return the JAX-RPC port interface to use. */ - public Class getPortInterface() { + public Class getPortInterface() { return this.portInterface; } @@ -380,7 +380,7 @@ public void prepare() throws RemoteLookupFailureException { postProcessJaxRpcService(service); } - Class portInterface = getPortInterface(); + Class portInterface = getPortInterface(); if (portInterface != null && !alwaysUseJaxRpcCall()) { // JAX-RPC-compliant port interface -> using JAX-RPC stub for port. @@ -391,7 +391,7 @@ public void prepare() throws RemoteLookupFailureException { Remote remoteObj = service.getPort(this.portQName, portInterface); if (logger.isDebugEnabled()) { - Class serviceInterface = getServiceInterface(); + Class serviceInterface = getServiceInterface(); if (serviceInterface != null) { boolean isImpl = serviceInterface.isInstance(remoteObj); logger.debug("Using service interface [" + serviceInterface.getName() + "] for JAX-RPC port [" + diff --git a/spring-web/src/main/java/org/springframework/remoting/jaxrpc/LocalJaxRpcServiceFactory.java b/spring-web/src/main/java/org/springframework/remoting/jaxrpc/LocalJaxRpcServiceFactory.java index bdedae20f3ca..17086624fa2e 100644 --- a/spring-web/src/main/java/org/springframework/remoting/jaxrpc/LocalJaxRpcServiceFactory.java +++ b/spring-web/src/main/java/org/springframework/remoting/jaxrpc/LocalJaxRpcServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ public class LocalJaxRpcServiceFactory { private ServiceFactory serviceFactory; - private Class serviceFactoryClass; + private Class serviceFactoryClass; private URL wsdlDocumentUrl; @@ -61,7 +61,7 @@ public class LocalJaxRpcServiceFactory { private String serviceName; - private Class jaxRpcServiceInterface; + private Class jaxRpcServiceInterface; private Properties jaxRpcServiceProperties; @@ -92,7 +92,7 @@ public ServiceFactory getServiceFactory() { * itself with the JAX-RPC system property "SERVICEFACTORY_PROPERTY". * @see javax.xml.rpc.ServiceFactory */ - public void setServiceFactoryClass(Class serviceFactoryClass) { + public void setServiceFactoryClass(Class serviceFactoryClass) { if (serviceFactoryClass != null && !ServiceFactory.class.isAssignableFrom(serviceFactoryClass)) { throw new IllegalArgumentException("'serviceFactoryClass' must implement [javax.xml.rpc.ServiceFactory]"); } @@ -102,7 +102,7 @@ public void setServiceFactoryClass(Class serviceFactoryClass) { /** * Return the ServiceFactory class to use, or null if default. */ - public Class getServiceFactoryClass() { + public Class getServiceFactoryClass() { return this.serviceFactoryClass; } @@ -165,14 +165,14 @@ public String getServiceName() { * @see javax.xml.rpc.ServiceFactory#loadService(Class) * @see javax.xml.rpc.ServiceFactory#loadService(java.net.URL, Class, java.util.Properties) */ - public void setJaxRpcServiceInterface(Class jaxRpcServiceInterface) { + public void setJaxRpcServiceInterface(Class jaxRpcServiceInterface) { this.jaxRpcServiceInterface = jaxRpcServiceInterface; } /** * Return the JAX-RPC service interface to use for looking up the service. */ - public Class getJaxRpcServiceInterface() { + public Class getJaxRpcServiceInterface() { return this.jaxRpcServiceInterface; } diff --git a/spring-web/src/main/java/org/springframework/remoting/jaxrpc/ServletEndpointSupport.java b/spring-web/src/main/java/org/springframework/remoting/jaxrpc/ServletEndpointSupport.java index d2fcaf921fe9..bf2b1e1531ae 100644 --- a/spring-web/src/main/java/org/springframework/remoting/jaxrpc/ServletEndpointSupport.java +++ b/spring-web/src/main/java/org/springframework/remoting/jaxrpc/ServletEndpointSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public abstract class ServletEndpointSupport implements ServiceLifecycle { protected final Log logger = LogFactory.getLog(getClass()); - + private ServletEndpointContext servletEndpointContext; private WebApplicationContext webApplicationContext; diff --git a/spring-web/src/main/java/org/springframework/remoting/jaxws/AbstractJaxWsServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/jaxws/AbstractJaxWsServiceExporter.java index 5a2f3ba7c4b0..d4078cae2e7e 100644 --- a/spring-web/src/main/java/org/springframework/remoting/jaxws/AbstractJaxWsServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/jaxws/AbstractJaxWsServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java b/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java index 5b30a338dcd2..43264ae2e0e3 100644 --- a/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java +++ b/spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/HttpMediaTypeException.java b/spring-web/src/main/java/org/springframework/web/HttpMediaTypeException.java index 9ed8c13134a8..95a8c32f68b2 100644 --- a/spring-web/src/main/java/org/springframework/web/HttpMediaTypeException.java +++ b/spring-web/src/main/java/org/springframework/web/HttpMediaTypeException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/HttpMediaTypeNotSupportedException.java b/spring-web/src/main/java/org/springframework/web/HttpMediaTypeNotSupportedException.java index 731c64ac3050..9961542b3854 100644 --- a/spring-web/src/main/java/org/springframework/web/HttpMediaTypeNotSupportedException.java +++ b/spring-web/src/main/java/org/springframework/web/HttpMediaTypeNotSupportedException.java @@ -21,7 +21,7 @@ import org.springframework.http.MediaType; /** - * Exception thrown when a client POSTs, PUTs, or PATCHes content of a type + * Exception thrown when a client POSTs or PUTs content * not supported by request handler. * * @author Arjen Poutsma diff --git a/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java b/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java index 34134c16c535..021e57a9b159 100644 --- a/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java +++ b/spring-web/src/main/java/org/springframework/web/HttpRequestMethodNotSupportedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/bind/EscapedErrors.java b/spring-web/src/main/java/org/springframework/web/bind/EscapedErrors.java index 03230048e936..049d79948afb 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/EscapedErrors.java +++ b/spring-web/src/main/java/org/springframework/web/bind/EscapedErrors.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -173,7 +173,7 @@ public Object getFieldValue(String field) { return (value instanceof String ? HtmlUtils.htmlEscape((String) value) : value); } - public Class getFieldType(String field) { + public Class getFieldType(String field) { return this.source.getFieldType(field); } diff --git a/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java b/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java index 3c7534327c00..ed19bc9cd29a 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java @@ -29,7 +29,7 @@ public class MethodArgumentNotValidException extends Exception { private final MethodParameter parameter; - + private final BindingResult bindingResult; @@ -69,5 +69,5 @@ public String getMessage() { } return sb.toString(); } - + } diff --git a/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java b/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java index 838cc633b2af..6ff75e8b09f4 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java +++ b/spring-web/src/main/java/org/springframework/web/bind/ServletRequestDataBinder.java @@ -115,7 +115,7 @@ public void bind(ServletRequest request) { /** * Extension point that subclasses can use to add extra bind values for a * request. Invoked before {@link #doBind(MutablePropertyValues)}. - * The default implementation is empty. + * The default implementation is empty. * @param mpvs the property values that will be used for data binding * @param request the current request */ diff --git a/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java b/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java index c067b432eed4..7af7bd7ac3ad 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,11 +43,10 @@ public class UnsatisfiedServletRequestParameterException extends ServletRequestB * @param paramConditions the parameter conditions that have been violated * @param actualParams the actual parameter Map associated with the ServletRequest */ - @SuppressWarnings("unchecked") - public UnsatisfiedServletRequestParameterException(String[] paramConditions, Map actualParams) { + public UnsatisfiedServletRequestParameterException(String[] paramConditions, Map actualParams) { super(""); this.paramConditions = paramConditions; - this.actualParams = (Map) actualParams; + this.actualParams = actualParams; } diff --git a/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java b/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java index 15d799210ec9..363e329ba0b0 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java +++ b/spring-web/src/main/java/org/springframework/web/bind/WebDataBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ * HTML checkboxes and select options: detecting that a field was part of * the form, but did not generate a request parameter because it was empty. * A field marker allows to detect that state and reset the corresponding - * bean property accordingly. Default values, for parameters that are otherwise + * bean property accordingly. Default values, for parameters that are otherwise * not present, can specify a value for the field other then empty. * * @author Juergen Hoeller @@ -65,7 +65,7 @@ public class WebDataBinder extends DataBinder { /** * Default prefix that field default parameters start with, followed by the field * name: e.g. "!subscribeToNewsletter" for a field "subscribeToNewsletter". - *

        Default parameters differ from field markers in that they provide a default + *

        Default parameters differ from field markers in that they provide a default * value instead of an empty value. * @see #setFieldDefaultPrefix */ @@ -134,15 +134,15 @@ public String getFieldMarkerPrefix() { /** * Specify a prefix that can be used for parameters that indicate default - * value fields, having "prefix + field" as name. The value of the default + * value fields, having "prefix + field" as name. The value of the default * field is used when the field is not provided. *

        Default is "!", for "!FIELD" parameters (e.g. "!subscribeToNewsletter"). * Set this to null if you want to turn off the field defaults completely. *

        HTML checkboxes only send a value when they're checked, so it is not * possible to detect that a formerly checked box has just been unchecked, - * at least not with standard HTML means. A default field is especially + * at least not with standard HTML means. A default field is especially * useful when a checkbox represents a non-boolean value. - *

        The presence of a default parameter preempts the behavior of a field + *

        The presence of a default parameter preempts the behavior of a field * marker for the given field. * @see #DEFAULT_FIELD_DEFAULT_PREFIX * @see org.springframework.web.servlet.mvc.BaseCommandController#onBind @@ -208,7 +208,7 @@ protected void checkFieldDefaults(MutablePropertyValues mpvs) { String field = pv.getName().substring(fieldDefaultPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { mpvs.add(field, pv.getValue()); - } + } mpvs.removePropertyValue(pv); } } @@ -234,7 +234,7 @@ protected void checkFieldMarkers(MutablePropertyValues mpvs) { if (pv.getName().startsWith(fieldMarkerPrefix)) { String field = pv.getName().substring(fieldMarkerPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { - Class fieldType = getPropertyAccessor().getPropertyType(field); + Class fieldType = getPropertyAccessor().getPropertyType(field); mpvs.add(field, getEmptyValue(field, fieldType)); } mpvs.removePropertyValue(pv); @@ -252,7 +252,7 @@ protected void checkFieldMarkers(MutablePropertyValues mpvs) { * @param fieldType the type of the field * @return the empty value (for most fields: null) */ - protected Object getEmptyValue(String field, Class fieldType) { + protected Object getEmptyValue(String field, Class fieldType) { if (fieldType != null && boolean.class.equals(fieldType) || Boolean.class.equals(fieldType)) { // Special handling of boolean property. return Boolean.FALSE; diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestPart.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestPart.java index 968e970aee1b..47a5fe8a627a 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestPart.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestPart.java @@ -29,29 +29,29 @@ import org.springframework.web.multipart.MultipartResolver; /** - * Annotation that can be used to associate the part of a "multipart/form-data" request + * Annotation that can be used to associate the part of a "multipart/form-data" request * with a method argument. Supported method argument types include {@link MultipartFile} - * in conjunction with Spring's {@link MultipartResolver} abstraction, + * in conjunction with Spring's {@link MultipartResolver} abstraction, * {@code javax.servlet.http.Part} in conjunction with Servlet 3.0 multipart requests, - * or otherwise for any other method argument, the content of the part is passed through an - * {@link HttpMessageConverter} taking into consideration the 'Content-Type' header - * of the request part. This is analogous to what @{@link RequestBody} does to resolve + * or otherwise for any other method argument, the content of the part is passed through an + * {@link HttpMessageConverter} taking into consideration the 'Content-Type' header + * of the request part. This is analogous to what @{@link RequestBody} does to resolve * an argument based on the content of a non-multipart regular request. - * - *

        Note that @{@link RequestParam} annotation can also be used to associate the + * + *

        Note that @{@link RequestParam} annotation can also be used to associate the * part of a "multipart/form-data" request with a method argument supporting the same * method argument types. The main difference is that when the method argument is not a - * String, @{@link RequestParam} relies on type conversion via a registered + * String, @{@link RequestParam} relies on type conversion via a registered * {@link Converter} or {@link PropertyEditor} while @{@link RequestPart} relies * on {@link HttpMessageConverter}s taking into consideration the 'Content-Type' header - * of the request part. @{@link RequestParam} is likely to be used with name-value form + * of the request part. @{@link RequestParam} is likely to be used with name-value form * fields while @{@link RequestPart} is likely to be used with parts containing more - * complex content (e.g. JSON, XML). - * + * complex content (e.g. JSON, XML). + * * @author Rossen Stoyanchev * @author Arjen Poutsma * @since 3.1 - * + * * @see RequestParam * @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter */ @@ -64,7 +64,7 @@ * The name of the part in the "multipart/form-data" request to bind to. */ String value() default ""; - + /** * Whether the part is required. *

        Default is true, leading to an exception thrown in case @@ -72,5 +72,5 @@ * if you prefer a null in case of the part missing. */ boolean required() default true; - + } diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java index fe7fac62cd47..69ec80110315 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java @@ -36,4 +36,4 @@ @Documented public @interface ResponseBody { -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java index ec9138f0ac1e..e41b2a5ce4ee 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/SessionAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,6 +71,6 @@ * session or some conversational storage. All model attributes of this * type will be stored in the session, regardless of attribute name. */ - Class[] types() default {}; + Class[] types() default {}; } diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java index 28b93fc403ab..44ac7c5fa0c2 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,7 +110,7 @@ public class HandlerMethodInvoker { private final WebArgumentResolver[] customArgumentResolvers; - private final HttpMessageConverter[] messageConverters; + private final HttpMessageConverter[] messageConverters; private final SimpleSessionStatus sessionStatus = new SimpleSessionStatus(); @@ -125,7 +125,7 @@ public HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInit public HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer, SessionAttributeStore sessionAttributeStore, ParameterNameDiscoverer parameterNameDiscoverer, - WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter[] messageConverters) { + WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter[] messageConverters) { this.methodResolver = methodResolver; this.bindingInitializer = bindingInitializer; @@ -161,7 +161,7 @@ public final Object invokeHandlerMethod(Method handlerMethod, Object handler, ReflectionUtils.makeAccessible(attributeMethodToInvoke); Object attrValue = attributeMethodToInvoke.invoke(handler, args); if ("".equals(attrName)) { - Class resolvedType = GenericTypeResolver.resolveReturnType(attributeMethodToInvoke, handler.getClass()); + Class resolvedType = GenericTypeResolver.resolveReturnType(attributeMethodToInvoke, handler.getClass()); attrName = Conventions.getVariableNameForReturnType(attributeMethodToInvoke, resolvedType, attrValue); } if (!implicitModel.containsAttribute(attrName)) { @@ -236,7 +236,7 @@ else if (!implicitModel.containsKey(MODEL_KEY_PREFIX_STALE + attrName)) { private Object[] resolveHandlerArguments(Method handlerMethod, Object handler, NativeWebRequest webRequest, ExtendedModelMap implicitModel) throws Exception { - Class[] paramTypes = handlerMethod.getParameterTypes(); + Class[] paramTypes = handlerMethod.getParameterTypes(); Object[] args = new Object[paramTypes.length]; for (int i = 0; i < args.length; i++) { @@ -412,7 +412,7 @@ protected void initBinder(Object handler, String attrName, WebDataBinder binder, private Object[] resolveInitBinderArguments(Object handler, Method initBinderMethod, WebDataBinder binder, NativeWebRequest webRequest) throws Exception { - Class[] initBinderParams = initBinderMethod.getParameterTypes(); + Class[] initBinderParams = initBinderMethod.getParameterTypes(); Object[] initBinderArgs = new Object[initBinderParams.length]; for (int i = 0; i < initBinderArgs.length; i++) { @@ -449,7 +449,7 @@ else if (PathVariable.class.isInstance(paramAnn)) { initBinderArgs[i] = argValue; } else { - Class paramType = initBinderParams[i]; + Class paramType = initBinderParams[i]; if (paramType.isInstance(binder)) { initBinderArgs[i] = binder; } @@ -482,7 +482,7 @@ private Object resolveRequestParam(String paramName, boolean required, String de Class paramType = methodParam.getParameterType(); if (Map.class.isAssignableFrom(paramType) && paramName.length() == 0) { - return resolveRequestParamMap((Class) paramType, webRequest); + return resolveRequestParamMap((Class>) paramType, webRequest); } if (paramName.length() == 0) { paramName = getRequiredParameterName(methodParam); @@ -515,7 +515,7 @@ else if (required) { return binder.convertIfNecessary(paramValue, paramType, methodParam); } - private Map resolveRequestParamMap(Class mapType, NativeWebRequest webRequest) { + private Map resolveRequestParamMap(Class> mapType, NativeWebRequest webRequest) { Map parameterMap = webRequest.getParameterMap(); if (MultiValueMap.class.isAssignableFrom(mapType)) { MultiValueMap result = new LinkedMultiValueMap(parameterMap.size()); @@ -544,7 +544,7 @@ private Object resolveRequestHeader(String headerName, boolean required, String Class paramType = methodParam.getParameterType(); if (Map.class.isAssignableFrom(paramType)) { - return resolveRequestHeaderMap((Class) paramType, webRequest); + return resolveRequestHeaderMap((Class>) paramType, webRequest); } if (headerName.length() == 0) { headerName = getRequiredParameterName(methodParam); @@ -568,7 +568,7 @@ else if (required) { return binder.convertIfNecessary(headerValue, paramType, methodParam); } - private Map resolveRequestHeaderMap(Class mapType, NativeWebRequest webRequest) { + private Map resolveRequestHeaderMap(Class> mapType, NativeWebRequest webRequest) { if (MultiValueMap.class.isAssignableFrom(mapType)) { MultiValueMap result; if (HttpHeaders.class.isAssignableFrom(mapType)) { @@ -605,7 +605,7 @@ protected Object resolveRequestBody(MethodParameter methodParam, NativeWebReques return readWithMessageConverters(methodParam, createHttpInputMessage(webRequest), methodParam.getParameterType()); } - private HttpEntity resolveHttpEntityRequest(MethodParameter methodParam, NativeWebRequest webRequest) + private HttpEntity resolveHttpEntityRequest(MethodParameter methodParam, NativeWebRequest webRequest) throws Exception { HttpInputMessage inputMessage = createHttpInputMessage(webRequest); @@ -614,7 +614,8 @@ private HttpEntity resolveHttpEntityRequest(MethodParameter methodParam, NativeW return new HttpEntity(body, inputMessage.getHeaders()); } - private Object readWithMessageConverters(MethodParameter methodParam, HttpInputMessage inputMessage, Class paramType) + @SuppressWarnings({ "unchecked", "rawtypes" }) + private Object readWithMessageConverters(MethodParameter methodParam, HttpInputMessage inputMessage, Class paramType) throws Exception { MediaType contentType = inputMessage.getHeaders().getContentType(); @@ -638,7 +639,7 @@ private Object readWithMessageConverters(MethodParameter methodParam, HttpInputM logger.debug("Reading [" + paramType.getName() + "] as \"" + contentType +"\" using [" + messageConverter + "]"); } - return messageConverter.read(paramType, inputMessage); + return messageConverter.read((Class)paramType, inputMessage); } } } @@ -664,7 +665,7 @@ else if (typeArgument instanceof GenericArrayType) { } throw new IllegalArgumentException( "HttpEntity parameter (" + methodParam.getParameterName() + ") is not parameterized"); - + } private Object resolveCookieValue(String cookieName, boolean required, String defaultValue, @@ -694,7 +695,7 @@ else if (required) { * Resolves the given {@link CookieValue @CookieValue} annotation. *

        Throws an UnsupportedOperationException by default. */ - protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) + protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) throws Exception { throw new UnsupportedOperationException("@CookieValue not supported"); @@ -717,7 +718,7 @@ private Object resolvePathVariable(String pathVarName, MethodParameter methodPar * Resolves the given {@link PathVariable @PathVariable} annotation. *

        Throws an UnsupportedOperationException by default. */ - protected String resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest) + protected String resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest) throws Exception { throw new UnsupportedOperationException("@PathVariable not supported"); @@ -733,7 +734,7 @@ private String getRequiredParameterName(MethodParameter methodParam) { return name; } - private Object checkValue(String name, Object value, Class paramType) { + private Object checkValue(String name, Object value, Class paramType) { if (value == null) { if (boolean.class.equals(paramType)) { return Boolean.FALSE; @@ -784,15 +785,15 @@ protected boolean isBindingCandidate(Object value) { !(value instanceof Map) && !BeanUtils.isSimpleValueType(value.getClass())); } - protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception { + protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception { throw new IllegalStateException("Missing parameter '" + paramName + "' of type [" + paramType.getName() + "]"); } - protected void raiseMissingHeaderException(String headerName, Class paramType) throws Exception { + protected void raiseMissingHeaderException(String headerName, Class paramType) throws Exception { throw new IllegalStateException("Missing header '" + headerName + "' of type [" + paramType.getName() + "]"); } - protected void raiseMissingCookieException(String cookieName, Class paramType) throws Exception { + protected void raiseMissingCookieException(String cookieName, Class paramType) throws Exception { throw new IllegalStateException( "Missing cookie value '" + cookieName + "' of type [" + paramType.getName() + "]"); } @@ -861,7 +862,7 @@ protected Object resolveCommonArgument(MethodParameter methodParameter, NativeWe } // Resolution of standard parameter types... - Class paramType = methodParameter.getParameterType(); + Class paramType = methodParameter.getParameterType(); Object value = resolveStandardArgument(paramType, webRequest); if (value != WebArgumentResolver.UNRESOLVED && !ClassUtils.isAssignableValue(paramType, value)) { throw new IllegalStateException("Standard argument type [" + paramType.getName() + @@ -878,13 +879,13 @@ protected Object resolveStandardArgument(Class parameterType, NativeWebReques return WebArgumentResolver.UNRESOLVED; } - protected final void addReturnValueAsModelAttribute(Method handlerMethod, Class handlerType, + protected final void addReturnValueAsModelAttribute(Method handlerMethod, Class handlerType, Object returnValue, ExtendedModelMap implicitModel) { ModelAttribute attr = AnnotationUtils.findAnnotation(handlerMethod, ModelAttribute.class); String attrName = (attr != null ? attr.value() : ""); if ("".equals(attrName)) { - Class resolvedType = GenericTypeResolver.resolveReturnType(handlerMethod, handlerType); + Class resolvedType = GenericTypeResolver.resolveReturnType(handlerMethod, handlerType); attrName = Conventions.getVariableNameForReturnType(handlerMethod, resolvedType, returnValue); } implicitModel.addAttribute(attrName, returnValue); diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java index 3595a8889326..ca0b7ccb8f0d 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java @@ -152,7 +152,7 @@ public boolean hasSessionAttributes() { return this.sessionAttributesFound; } - public boolean isSessionAttribute(String attrName, Class attrType) { + public boolean isSessionAttribute(String attrName, Class attrType) { if (this.sessionAttributeNames.contains(attrName) || this.sessionAttributeTypes.contains(attrType)) { this.actualSessionAttributeNames.put(attrName, Boolean.TRUE); return true; diff --git a/spring-web/src/main/java/org/springframework/web/bind/support/DefaultDataBinderFactory.java b/spring-web/src/main/java/org/springframework/web/bind/support/DefaultDataBinderFactory.java index a0ddc9713fc3..92b78c172133 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/support/DefaultDataBinderFactory.java +++ b/spring-web/src/main/java/org/springframework/web/bind/support/DefaultDataBinderFactory.java @@ -20,9 +20,9 @@ import org.springframework.web.context.request.NativeWebRequest; /** - * Create a {@link WebRequestDataBinder} instance and initialize it with a + * Create a {@link WebRequestDataBinder} instance and initialize it with a * {@link WebBindingInitializer}. - * + * * @author Rossen Stoyanchev * @since 3.1 */ @@ -39,8 +39,8 @@ public DefaultDataBinderFactory(WebBindingInitializer initializer) { } /** - * Create a new {@link WebDataBinder} for the given target object and - * initialize it through a {@link WebBindingInitializer}. + * Create a new {@link WebDataBinder} for the given target object and + * initialize it through a {@link WebBindingInitializer}. * @throws Exception in case of invalid state or arguments */ public final WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) @@ -57,7 +57,7 @@ public final WebDataBinder createBinder(NativeWebRequest webRequest, Object targ * Extension point to create the WebDataBinder instance. * By default this is {@code WebRequestDataBinder}. * @param target the binding target or {@code null} for type conversion only - * @param objectName the binding target object name + * @param objectName the binding target object name * @param webRequest the current request * @throws Exception in case of invalid state or arguments */ @@ -67,8 +67,8 @@ protected WebDataBinder createBinderInstance(Object target, String objectName, N } /** - * Extension point to further initialize the created data binder instance - * (e.g. with {@code @InitBinder} methods) after "global" initializaton + * Extension point to further initialize the created data binder instance + * (e.g. with {@code @InitBinder} methods) after "global" initializaton * via {@link WebBindingInitializer}. * @param dataBinder the data binder instance to customize * @param webRequest the current request diff --git a/spring-web/src/main/java/org/springframework/web/bind/support/WebDataBinderFactory.java b/spring-web/src/main/java/org/springframework/web/bind/support/WebDataBinderFactory.java index ba72a92a3a8c..e93a2b5e24be 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/support/WebDataBinderFactory.java +++ b/spring-web/src/main/java/org/springframework/web/bind/support/WebDataBinderFactory.java @@ -20,21 +20,21 @@ import org.springframework.web.context.request.NativeWebRequest; /** - * A factory for creating a {@link WebDataBinder} instance for a named target object. - * + * A factory for creating a {@link WebDataBinder} instance for a named target object. + * * @author Arjen Poutsma * @since 3.1 */ public interface WebDataBinderFactory { /** - * Create a {@link WebDataBinder} for the given object. + * Create a {@link WebDataBinder} for the given object. * @param webRequest the current request * @param target the object to create a data binder for, or {@code null} if creating a binder for a simple type - * @param objectName the name of the target object + * @param objectName the name of the target object * @return the created {@link WebDataBinder} instance, never null - * @throws Exception raised if the creation and initialization of the data binder fails + * @throws Exception raised if the creation and initialization of the data binder fails */ WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception; - -} \ No newline at end of file + +} diff --git a/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java b/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java index 53f83bf085c5..875484373a3d 100644 --- a/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java +++ b/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ public HttpMessageConverterExtractor(Type responseType, List()); + this.messageConverters.add(new XmlAwareFormHttpMessageConverter()); if (jaxb2Present) { this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter()); } @@ -545,7 +542,6 @@ private AcceptHeaderRequestCallback(Type responseType) { this.responseType = responseType; } - @SuppressWarnings("unchecked") public void doWithRequest(ClientHttpRequest request) throws IOException { if (responseType != null) { Class responseClass = null; @@ -600,20 +596,19 @@ private List getSupportedMediaTypes(HttpMessageConverter messageCo */ private class HttpEntityRequestCallback extends AcceptHeaderRequestCallback { - private final HttpEntity requestEntity; + private final HttpEntity requestEntity; private HttpEntityRequestCallback(Object requestBody) { this(requestBody, null); } - @SuppressWarnings("unchecked") - private HttpEntityRequestCallback(Object requestBody, Type responseType) { + private HttpEntityRequestCallback(Object requestBody, Class responseType) { super(responseType); if (requestBody instanceof HttpEntity) { - this.requestEntity = (HttpEntity) requestBody; + this.requestEntity = (HttpEntity) requestBody; } else if (requestBody != null) { - this.requestEntity = new HttpEntity(requestBody); + this.requestEntity = new HttpEntity(requestBody); } else { this.requestEntity = HttpEntity.EMPTY; @@ -621,7 +616,7 @@ else if (requestBody != null) { } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void doWithRequest(ClientHttpRequest httpRequest) throws IOException { super.doWithRequest(httpRequest); if (!requestEntity.hasBody()) { @@ -639,7 +634,7 @@ public void doWithRequest(ClientHttpRequest httpRequest) throws IOException { Class requestType = requestBody.getClass(); HttpHeaders requestHeaders = requestEntity.getHeaders(); MediaType requestContentType = requestHeaders.getContentType(); - for (HttpMessageConverter messageConverter : getMessageConverters()) { + for (HttpMessageConverter messageConverter : getMessageConverters()) { if (messageConverter.canWrite(requestType, requestContentType)) { if (!requestHeaders.isEmpty()) { httpRequest.getHeaders().putAll(requestHeaders); @@ -654,7 +649,7 @@ public void doWithRequest(ClientHttpRequest httpRequest) throws IOException { } } - messageConverter.write(requestBody, requestContentType, httpRequest); + ((HttpMessageConverter)messageConverter).write(requestBody, requestContentType, httpRequest); return; } } diff --git a/spring-web/src/main/java/org/springframework/web/client/support/RestGatewaySupport.java b/spring-web/src/main/java/org/springframework/web/client/support/RestGatewaySupport.java index 4d1a233fcb57..bee4e0dd6a3c 100644 --- a/spring-web/src/main/java/org/springframework/web/client/support/RestGatewaySupport.java +++ b/spring-web/src/main/java/org/springframework/web/client/support/RestGatewaySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/ContextCleanupListener.java b/spring-web/src/main/java/org/springframework/web/context/ContextCleanupListener.java index 4dc269a1b42c..d8fdb8e9b480 100644 --- a/spring-web/src/main/java/org/springframework/web/context/ContextCleanupListener.java +++ b/spring-web/src/main/java/org/springframework/web/context/ContextCleanupListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,9 +57,9 @@ public void contextDestroyed(ServletContextEvent event) { * @param sc the ServletContext to check */ static void cleanupAttributes(ServletContext sc) { - Enumeration attrNames = sc.getAttributeNames(); + Enumeration attrNames = sc.getAttributeNames(); while (attrNames.hasMoreElements()) { - String attrName = (String) attrNames.nextElement(); + String attrName = attrNames.nextElement(); if (attrName.startsWith("org.springframework.")) { Object attrValue = sc.getAttribute(attrName); if (attrValue instanceof DisposableBean) { diff --git a/spring-web/src/main/java/org/springframework/web/context/ServletContextAware.java b/spring-web/src/main/java/org/springframework/web/context/ServletContextAware.java index f8cc70144142..88e83b915149 100644 --- a/spring-web/src/main/java/org/springframework/web/context/ServletContextAware.java +++ b/spring-web/src/main/java/org/springframework/web/context/ServletContextAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java b/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java index 48ae350aeab0..167c4db87616 100644 --- a/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java +++ b/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java @@ -20,7 +20,7 @@ import org.springframework.context.ApplicationContext; -/** +/** * Interface to provide configuration for a web application. This is read-only while * the application is running, but may be reloaded if the implementation supports this. * @@ -107,5 +107,5 @@ public interface WebApplicationContext extends ApplicationContext { *

        Also available for a Portlet application, in addition to the PortletContext. */ ServletContext getServletContext(); - + } diff --git a/spring-web/src/main/java/org/springframework/web/context/request/AbstractRequestAttributesScope.java b/spring-web/src/main/java/org/springframework/web/context/request/AbstractRequestAttributesScope.java index 04b95bac0803..17d0da0f8ee3 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/AbstractRequestAttributesScope.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/AbstractRequestAttributesScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ * *

        Subclasses may wish to override the {@link #get} and {@link #remove} * methods to add synchronization around the call back into this super class. - * + * * @author Rod Johnson * @author Juergen Hoeller * @author Rob Harrop @@ -36,7 +36,7 @@ */ public abstract class AbstractRequestAttributesScope implements Scope { - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { RequestAttributes attributes = RequestContextHolder.currentRequestAttributes(); Object scopedObject = attributes.getAttribute(name, getScope()); if (scopedObject == null) { diff --git a/spring-web/src/main/java/org/springframework/web/context/request/DestructionCallbackBindingListener.java b/spring-web/src/main/java/org/springframework/web/context/request/DestructionCallbackBindingListener.java index 04789512aa0a..641144800fa4 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/DestructionCallbackBindingListener.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/DestructionCallbackBindingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java b/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java index 632d0d7f800b..564bd836d3ce 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/FacesRequestAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/request/FacesWebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/FacesWebRequest.java index edd13a778a61..f921d2a54171 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/FacesWebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/FacesWebRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,7 +93,7 @@ public String getParameter(String paramName) { public Iterator getParameterNames() { return getExternalContext().getRequestParameterNames(); } - + public String[] getParameterValues(String paramName) { return getExternalContext().getRequestParameterValuesMap().get(paramName); } diff --git a/spring-web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java b/spring-web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java index eaa52bc8eded..2377145bc09e 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java @@ -44,7 +44,7 @@ * @see org.springframework.web.portlet.DispatcherPortlet */ public abstract class RequestContextHolder { - + private static final boolean jsfPresent = ClassUtils.isPresent("javax.faces.context.FacesContext", RequestContextHolder.class.getClassLoader()); diff --git a/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java index d9a75991d339..ca6318f344a8 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/ServletWebRequest.java @@ -46,7 +46,7 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ private static final String HEADER_LAST_MODIFIED = "Last-Modified"; private static final String METHOD_GET = "GET"; - + private HttpServletResponse response; diff --git a/spring-web/src/main/java/org/springframework/web/context/request/SessionScope.java b/spring-web/src/main/java/org/springframework/web/context/request/SessionScope.java index 88d5d1fe56ec..24e85b39cd74 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/SessionScope.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/SessionScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ public String getConversationId() { } @Override - public Object get(String name, ObjectFactory objectFactory) { + public Object get(String name, ObjectFactory objectFactory) { Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex(); synchronized (mutex) { return super.get(name, objectFactory); diff --git a/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java index 9db1794781c5..620708266eca 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java @@ -77,7 +77,7 @@ public interface WebRequest extends RequestAttributes { * @since 3.0 */ Iterator getParameterNames(); - + /** * Return a immutable Map of the request parameters, with parameter names as map keys * and parameter values as map values. The map values will be of type String array. @@ -174,7 +174,7 @@ public interface WebRequest extends RequestAttributes { * {@link #checkNotModified(long)}, but not both. * @param eTag the entity tag that the application determined * for the underlying resource. This parameter will be padded - * with quotes (") if necessary. + * with quotes (") if necessary. * @return whether the request qualifies as not modified, * allowing to abort request processing and relying on the response * telling the client that the content has not been modified diff --git a/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java b/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java index 46e798956e95..9cde9456ef78 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/HttpRequestHandlerServlet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ public class HttpRequestHandlerServlet extends HttpServlet { @Override public void init() throws ServletException { WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); - this.target = (HttpRequestHandler) wac.getBean(getServletName(), HttpRequestHandler.class); + this.target = wac.getBean(getServletName(), HttpRequestHandler.class); } @@ -67,7 +67,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response) this.target.handleRequest(request, response); } catch (HttpRequestMethodNotSupportedException ex) { - String[] supportedMethods = ((HttpRequestMethodNotSupportedException) ex).getSupportedMethods(); + String[] supportedMethods = ex.getSupportedMethods(); if (supportedMethods != null) { response.setHeader("Allow", StringUtils.arrayToDelimitedString(supportedMethods, ", ")); } diff --git a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextAttributeExporter.java b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextAttributeExporter.java index 26bcfb44981d..6cde766017b3 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextAttributeExporter.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextAttributeExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertySource.java b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertySource.java index 38251f1ad1c3..4dc22c2449af 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertySource.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextPropertySource.java @@ -24,7 +24,7 @@ /** * {@link PropertySource} that reads init parameters from a {@link ServletContext} object. - * + * * @author Chris Beams * @since 3.1 * @see ServletConfigPropertySource diff --git a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResourcePatternResolver.java b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResourcePatternResolver.java index b40f7dbecb42..209632e07cd5 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResourcePatternResolver.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResourcePatternResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ protected void doRetrieveMatchingServletContextResources( ServletContext servletContext, String fullPattern, String dir, Set result) throws IOException { - Set candidates = servletContext.getResourcePaths(dir); + Set candidates = servletContext.getResourcePaths(dir); if (candidates != null) { boolean dirDepthNotFixed = fullPattern.contains("**"); int jarFileSep = fullPattern.indexOf(ResourceUtils.JAR_URL_SEPARATOR); @@ -156,7 +156,6 @@ protected void doRetrieveMatchingServletContextResources( * @param result the Set of matching Resources to add to * @throws IOException if jar contents could not be retrieved */ - @SuppressWarnings("unchecked") private void doRetrieveMatchingJarEntries(String jarFilePath, String entryPattern, Set result) { if (logger.isDebugEnabled()) { logger.debug("Searching jar file [" + jarFilePath + "] for entries matching [" + entryPattern + "]"); diff --git a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextScope.java b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextScope.java index 90301719e46e..5c2f7ff28c1f 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextScope.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/support/SpringBeanAutowiringSupport.java b/spring-web/src/main/java/org/springframework/web/context/support/SpringBeanAutowiringSupport.java index 93c00b96d428..3eb96306673d 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/SpringBeanAutowiringSupport.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/SpringBeanAutowiringSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationObjectSupport.java b/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationObjectSupport.java index 0a69d90d6a87..aefd52f8815f 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationObjectSupport.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationObjectSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java b/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java index c1ccfdd278d1..5fd15fe83e6c 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/filter/CompositeFilter.java b/spring-web/src/main/java/org/springframework/web/filter/CompositeFilter.java index 76b6b886b5fd..b85cb1e23e13 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/CompositeFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/CompositeFilter.java @@ -33,11 +33,11 @@ * This is useful for filters that require dependency injection, and can therefore be set up in a Spring application * context. Typically this composite would be used in conjunction with {@link DelegatingFilterProxy}, so that it can be * declared in Spring but applied to a servlet context. - * + * * @since 3.1 - * + * * @author Dave Syer - * + * */ public class CompositeFilter implements Filter { @@ -49,7 +49,7 @@ public void setFilters(List filters) { /** * Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order. - * + * * @see Filter#init(FilterConfig) */ public void destroy() { @@ -61,7 +61,7 @@ public void destroy() { /** * Initialize all the filters, calling each one's init method in turn in the order supplied. - * + * * @see Filter#init(FilterConfig) */ public void init(FilterConfig config) throws ServletException { @@ -74,7 +74,7 @@ public void init(FilterConfig config) throws ServletException { * Forms a temporary chain from the list of delegate filters supplied ({@link #setFilters(List)}) and executes them * in order. Each filter delegates to the next one in the list, achieving the normal behaviour of a * {@link FilterChain}, despite the fact that this is a {@link Filter}. - * + * * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, diff --git a/spring-web/src/main/java/org/springframework/web/filter/DelegatingFilterProxy.java b/spring-web/src/main/java/org/springframework/web/filter/DelegatingFilterProxy.java index dcebb69937cf..ea1a2155bc6e 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/DelegatingFilterProxy.java +++ b/spring-web/src/main/java/org/springframework/web/filter/DelegatingFilterProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/filter/GenericFilterBean.java b/spring-web/src/main/java/org/springframework/web/filter/GenericFilterBean.java index 8bb3a5e00960..d92801ab6549 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/GenericFilterBean.java +++ b/spring-web/src/main/java/org/springframework/web/filter/GenericFilterBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/filter/HiddenHttpMethodFilter.java b/spring-web/src/main/java/org/springframework/web/filter/HiddenHttpMethodFilter.java index 9c1778ca4737..5ca3a82f3470 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/HiddenHttpMethodFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/HiddenHttpMethodFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java b/spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java index 51d2b60fe7a5..02b4ec93fe52 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java @@ -47,12 +47,12 @@ /** * {@link javax.servlet.Filter} that makes form encoded data available through * the {@code ServletRequest.getParameter*()} family of methods during HTTP PUT - * or PATCH requests. + * requests. * *

        The Servlet spec requires form data to be available for HTTP POST but - * not for HTTP PUT or PATCH requests. This filter intercepts HTTP PUT and PATCH - * requests where content type is {@code 'application/x-www-form-urlencoded'}, - * reads form encoded content from the body of the request, and wraps the ServletRequest + * not for HTTP PUT requests. This filter intercepts HTTP PUT requests where + * content type is {@code 'application/x-www-form-urlencoded'}, reads form + * encoded content from the body of the request, and wraps the ServletRequest * in order to make the form data available as request parameters just like * it is for HTTP POST requests. * @@ -61,7 +61,7 @@ */ public class HttpPutFormContentFilter extends OncePerRequestFilter { - private final FormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter(); + private final FormHttpMessageConverter formConverter = new XmlAwareFormHttpMessageConverter(); /** * The default character set to use for reading form data. diff --git a/spring-web/src/main/java/org/springframework/web/jsf/DelegatingPhaseListenerMulticaster.java b/spring-web/src/main/java/org/springframework/web/jsf/DelegatingPhaseListenerMulticaster.java index 36b54f11f28d..e8f7a902409b 100644 --- a/spring-web/src/main/java/org/springframework/web/jsf/DelegatingPhaseListenerMulticaster.java +++ b/spring-web/src/main/java/org/springframework/web/jsf/DelegatingPhaseListenerMulticaster.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/jsf/DelegatingVariableResolver.java b/spring-web/src/main/java/org/springframework/web/jsf/DelegatingVariableResolver.java index cfc987dfdfc9..0ebf0fcdb54d 100644 --- a/spring-web/src/main/java/org/springframework/web/jsf/DelegatingVariableResolver.java +++ b/spring-web/src/main/java/org/springframework/web/jsf/DelegatingVariableResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/jsf/el/WebApplicationContextFacesELResolver.java b/spring-web/src/main/java/org/springframework/web/jsf/el/WebApplicationContextFacesELResolver.java index bf87a088f18e..afabc04e31e0 100644 --- a/spring-web/src/main/java/org/springframework/web/jsf/el/WebApplicationContextFacesELResolver.java +++ b/spring-web/src/main/java/org/springframework/web/jsf/el/WebApplicationContextFacesELResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/jsf/el/package-info.java b/spring-web/src/main/java/org/springframework/web/jsf/el/package-info.java index aa34df937fe1..ada7476aa521 100644 --- a/spring-web/src/main/java/org/springframework/web/jsf/el/package-info.java +++ b/spring-web/src/main/java/org/springframework/web/jsf/el/package-info.java @@ -3,7 +3,7 @@ * * Support classes for integrating a JSF 1.2 web tier with a Spring middle tier * which is hosted in a Spring root WebApplicationContext. - * + * *

        Supports JSF 1.2's ELResolver mechanism, providing closer integration * than JSF 1.1's VariableResolver mechanism allowed for. * diff --git a/spring-web/src/main/java/org/springframework/web/jsf/package-info.java b/spring-web/src/main/java/org/springframework/web/jsf/package-info.java index b49913a30143..b5d645df286d 100644 --- a/spring-web/src/main/java/org/springframework/web/jsf/package-info.java +++ b/spring-web/src/main/java/org/springframework/web/jsf/package-info.java @@ -3,7 +3,7 @@ * * Support classes for integrating a JSF web tier with a Spring middle tier * which is hosted in a Spring root WebApplicationContext. - * + * *

        Supports easy access to beans in the Spring root WebApplicationContext * from JSF EL expressions, for example in property values of JSF-managed beans. * diff --git a/spring-web/src/main/java/org/springframework/web/method/HandlerMethodSelector.java b/spring-web/src/main/java/org/springframework/web/method/HandlerMethodSelector.java index a8029705b78a..659372c3a5b5 100644 --- a/spring-web/src/main/java/org/springframework/web/method/HandlerMethodSelector.java +++ b/spring-web/src/main/java/org/springframework/web/method/HandlerMethodSelector.java @@ -28,18 +28,18 @@ import org.springframework.util.ReflectionUtils.MethodFilter; /** - * Defines the algorithm for searching handler methods exhaustively including interfaces and parent + * Defines the algorithm for searching handler methods exhaustively including interfaces and parent * classes while also dealing with parameterized methods as well as interface and class-based proxies. - * + * * @author Rossen Stoyanchev * @since 3.1 */ public abstract class HandlerMethodSelector { - + /** * Selects handler methods for the given handler type. Callers of this method define handler methods * of interest through the {@link MethodFilter} parameter. - * + * * @param handlerType the handler type to search handler methods on * @param handlerMethodFilter a {@link MethodFilter} to help recognize handler methods of interest * @return the selected methods, or an empty set @@ -69,4 +69,4 @@ public void doWith(Method method) { return handlerMethods; } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/AbstractCookieValueMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/AbstractCookieValueMethodArgumentResolver.java index df485e1b0afe..37ed585850fd 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/AbstractCookieValueMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/AbstractCookieValueMethodArgumentResolver.java @@ -23,16 +23,16 @@ import org.springframework.web.bind.annotation.CookieValue; /** - * A base abstract class to resolve method arguments annotated with + * A base abstract class to resolve method arguments annotated with * {@code @CookieValue}. Subclasses extract the cookie value from the request. - * - *

        An {@code @CookieValue} is a named value that is resolved from a cookie. - * It has a required flag and a default value to fall back on when the cookie - * does not exist. - * - *

        A {@link WebDataBinder} may be invoked to apply type conversion to the + * + *

        An {@code @CookieValue} is a named value that is resolved from a cookie. + * It has a required flag and a default value to fall back on when the cookie + * does not exist. + * + *

        A {@link WebDataBinder} may be invoked to apply type conversion to the * resolved cookie value. - * + * * @author Arjen Poutsma * @author Rossen Stoyanchev * @since 3.1 @@ -40,7 +40,7 @@ public abstract class AbstractCookieValueMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver { /** - * @param beanFactory a bean factory to use for resolving ${...} + * @param beanFactory a bean factory to use for resolving ${...} * placeholder and #{...} SpEL expressions in default values; * or {@code null} if default values are not expected to contain expressions */ @@ -71,4 +71,4 @@ private CookieValueNamedValueInfo(CookieValue annotation) { super(annotation.value(), annotation.required(), annotation.defaultValue()); } } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java index 626b0fe21899..e15b1fa627b5 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java @@ -33,10 +33,11 @@ import org.springframework.web.method.HandlerMethodSelector; /** - * Discovers {@linkplain ExceptionHandler @ExceptionHandler} methods in a given class - * type, including all super types, and helps to resolve an Exception to the method - * its mapped to. Exception mappings are defined through {@code @ExceptionHandler} - * annotation or by looking at the signature of an {@code @ExceptionHandler} method. + * Given a set of @{@link ExceptionHandler} methods at initialization, finds + * the best matching method mapped to an exception at runtime. + * + *

        Exception mappings are extracted from the method @{@link ExceptionHandler} + * annotation or by looking for {@link Throwable} method arguments. * * @author Rossen Stoyanchev * @since 3.1 @@ -46,14 +47,18 @@ public class ExceptionHandlerMethodResolver { private static final Method NO_METHOD_FOUND = ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis"); private final Map, Method> mappedMethods = - new ConcurrentHashMap, Method>(16); + new ConcurrentHashMap, Method>(); private final Map, Method> exceptionLookupCache = new ConcurrentHashMap, Method>(16); /** - * A constructor that finds {@link ExceptionHandler} methods in the given type. - * @param handlerType the type to introspect + * A constructor that finds {@link ExceptionHandler} methods in a handler. + * @param handlerType the handler to inspect for exception handler methods. + * @throws IllegalStateException + * If an exception type is mapped to two methods. + * @throws IllegalArgumentException + * If an @{@link ExceptionHandler} method is not mapped to any exceptions. */ public ExceptionHandlerMethodResolver(Class handlerType) { for (Method method : HandlerMethodSelector.selectMethods(handlerType, EXCEPTION_HANDLER_METHODS)) { diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolver.java index 7877e7923cc6..5ce571510971 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolver.java @@ -26,21 +26,21 @@ /** * Resolves method arguments annotated with {@code @Value}. - * + * *

        An {@code @Value} does not have a name but gets resolved from the default - * value string, which may contain ${...} placeholder or Spring Expression - * Language #{...} expressions. - * - *

        A {@link WebDataBinder} may be invoked to apply type conversion to + * value string, which may contain ${...} placeholder or Spring Expression + * Language #{...} expressions. + * + *

        A {@link WebDataBinder} may be invoked to apply type conversion to * resolved argument value. - * + * * @author Rossen Stoyanchev * @since 3.1 */ public class ExpressionValueMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver { /** - * @param beanFactory a bean factory to use for resolving ${...} + * @param beanFactory a bean factory to use for resolving ${...} * placeholder and #{...} SpEL expressions in default values; * or {@code null} if default values are not expected to contain expressions */ @@ -75,5 +75,5 @@ private static class ExpressionValueNamedValueInfo extends NamedValueInfo { private ExpressionValueNamedValueInfo(Value annotation) { super("@Value", false, annotation.value()); } - } -} \ No newline at end of file + } +} diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/InitBinderDataBinderFactory.java b/spring-web/src/main/java/org/springframework/web/method/annotation/InitBinderDataBinderFactory.java index 991ab9ff8620..c7520687e10b 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/InitBinderDataBinderFactory.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/InitBinderDataBinderFactory.java @@ -38,7 +38,7 @@ public class InitBinderDataBinderFactory extends DefaultDataBinderFactory { private final List binderMethods; - + /** * Create a new instance. * @param binderMethods {@code @InitBinder} methods, or {@code null} @@ -68,8 +68,8 @@ public void initBinder(WebDataBinder binder, NativeWebRequest request) throws Ex } /** - * Return {@code true} if the given {@code @InitBinder} method should be - * invoked to initialize the given WebDataBinder. + * Return {@code true} if the given {@code @InitBinder} method should be + * invoked to initialize the given WebDataBinder. *

        The default implementation checks if target object name is included * in the attribute names specified in the {@code @InitBinder} annotation. */ @@ -78,5 +78,5 @@ protected boolean isBinderMethodApplicable(HandlerMethod initBinderMethod, WebDa Collection names = Arrays.asList(annot.value()); return (names.size() == 0 || names.contains(binder.getObjectName())); } - + } diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java index 3d5abfa580a0..9fe685604225 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java @@ -41,24 +41,24 @@ import org.springframework.web.method.support.ModelAndViewContainer; /** - * Provides methods to initialize the {@link Model} before controller method - * invocation and to update it afterwards. On initialization, the model is - * populated with attributes from the session or by invoking - * {@code @ModelAttribute} methods. On update, model attributes are - * synchronized with the session -- either adding or removing them. + * Provides methods to initialize the {@link Model} before controller method + * invocation and to update it afterwards. On initialization, the model is + * populated with attributes from the session or by invoking + * {@code @ModelAttribute} methods. On update, model attributes are + * synchronized with the session -- either adding or removing them. * Also {@link BindingResult} attributes where missing. - * + * * @author Rossen Stoyanchev * @since 3.1 */ public final class ModelFactory { private final List attributeMethods; - + private final WebDataBinderFactory binderFactory; - + private final SessionAttributesHandler sessionAttributesHandler; - + /** * Create a new instance with the given {@code @ModelAttribute} methods. * @param attributeMethods for model initialization @@ -76,15 +76,15 @@ public ModelFactory(List attributeMethods, /** * Populate the model in the following order: *

          - *
        1. Retrieve "known" session attributes -- i.e. attributes listed via - * {@link SessionAttributes @SessionAttributes} and previously stored in + *
        2. Retrieve "known" session attributes -- i.e. attributes listed via + * {@link SessionAttributes @SessionAttributes} and previously stored in * the in the model at least once *
        3. Invoke {@link ModelAttribute @ModelAttribute} methods *
        4. Find method arguments eligible as session attributes and retrieve - * them if they're not already present in the model + * them if they're not already present in the model *
        * @param request the current request - * @param mavContainer contains the model to be initialized + * @param mavContainer contains the model to be initialized * @param handlerMethod the method for which the model is initialized * @throws Exception may arise from {@code @ModelAttribute} methods */ @@ -108,18 +108,18 @@ public void initModel(NativeWebRequest request, ModelAndViewContainer mavContain } /** - * Invoke model attribute methods to populate the model. Attributes are + * Invoke model attribute methods to populate the model. Attributes are * added only if not already present in the model. */ private void invokeModelAttributeMethods(NativeWebRequest request, ModelAndViewContainer mavContainer) throws Exception { - + for (InvocableHandlerMethod attrMethod : this.attributeMethods) { String modelName = attrMethod.getMethodAnnotation(ModelAttribute.class).value(); if (mavContainer.containsAttribute(modelName)) { continue; } - + Object returnValue = attrMethod.invokeForRequest(request, mavContainer); if (!attrMethod.isVoid()){ @@ -130,9 +130,9 @@ private void invokeModelAttributeMethods(NativeWebRequest request, ModelAndViewC } } } - + /** - * Return all {@code @ModelAttribute} arguments declared as session + * Return all {@code @ModelAttribute} arguments declared as session * attributes via {@code @SessionAttributes}. */ private List findSessionAttributeArguments(HandlerMethod handlerMethod) { @@ -147,12 +147,12 @@ private List findSessionAttributeArguments(HandlerMethod handlerMethod) } return result; } - + /** - * Derive the model attribute name for the given return value using + * Derive the model attribute name for the given return value using * one of the following: *
          - *
        1. The method {@code ModelAttribute} annotation value + *
        2. The method {@code ModelAttribute} annotation value *
        3. The declared return type if it is other than {@code Object} *
        4. The actual return value type *
        @@ -176,7 +176,7 @@ public static String getNameForReturnValue(Object returnValue, MethodParameter r * Derives the model attribute name for a method parameter based on: *
          *
        1. The parameter {@code @ModelAttribute} annotation value - *
        2. The parameter type + *
        3. The parameter type *
        * @return the derived name; never {@code null} or an empty string */ @@ -185,7 +185,7 @@ public static String getNameForParameter(MethodParameter parameter) { String attrName = (annot != null) ? annot.value() : null; return StringUtils.hasText(attrName) ? attrName : Conventions.getVariableNameForParameter(parameter); } - + /** * Synchronize model attributes with the session. Add {@link BindingResult} * attributes where necessary. @@ -194,17 +194,17 @@ public static String getNameForParameter(MethodParameter parameter) { * @throws Exception if creating BindingResult attributes fails */ public void updateModel(NativeWebRequest request, ModelAndViewContainer mavContainer) throws Exception { - + if (mavContainer.getSessionStatus().isComplete()){ this.sessionAttributesHandler.cleanupAttributes(request); } else { this.sessionAttributesHandler.storeAttributes(request, mavContainer.getModel()); } - + if (!mavContainer.isRequestHandled()) { updateBindingResult(request, mavContainer.getModel()); - } + } } /** @@ -217,7 +217,7 @@ private void updateBindingResult(NativeWebRequest request, ModelMap model) throw if (isBindingCandidate(name, value)) { String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + name; - + if (!model.containsAttribute(bindingResultKey)) { WebDataBinder dataBinder = binderFactory.createBinder(request, value, name); model.put(bindingResultKey, dataBinder.getBindingResult()); @@ -233,14 +233,14 @@ private boolean isBindingCandidate(String attributeName, Object value) { if (attributeName.startsWith(BindingResult.MODEL_KEY_PREFIX)) { return false; } - + Class attrType = (value != null) ? value.getClass() : null; if (this.sessionAttributesHandler.isHandlerSessionAttribute(attributeName, attrType)) { return true; } - - return (value != null && !value.getClass().isArray() && !(value instanceof Collection) && + + return (value != null && !value.getClass().isArray() && !(value instanceof Collection) && !(value instanceof Map) && !BeanUtils.isSimpleValueType(value.getClass())); } - -} \ No newline at end of file + +} diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolver.java index 1c5c3cf04f42..41421ceac4e0 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolver.java @@ -27,16 +27,16 @@ /** * Resolves method arguments annotated with {@code @RequestHeader} except for - * {@link Map} arguments. See {@link RequestHeaderMapMethodArgumentResolver} for + * {@link Map} arguments. See {@link RequestHeaderMapMethodArgumentResolver} for * details on {@link Map} arguments annotated with {@code @RequestHeader}. - * + * *

        An {@code @RequestHeader} is a named value resolved from a request header. - * It has a required flag and a default value to fall back on when the request - * header does not exist. + * It has a required flag and a default value to fall back on when the request + * header does not exist. * - *

        A {@link WebDataBinder} is invoked to apply type conversion to resolved + *

        A {@link WebDataBinder} is invoked to apply type conversion to resolved * request header values that don't yet match the method parameter type. - * + * * @author Arjen Poutsma * @author Rossen Stoyanchev * @since 3.1 @@ -44,7 +44,7 @@ public class RequestHeaderMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver { /** - * @param beanFactory a bean factory to use for resolving ${...} + * @param beanFactory a bean factory to use for resolving ${...} * placeholder and #{...} SpEL expressions in default values; * or {@code null} if default values are not expected to have expressions */ @@ -87,4 +87,4 @@ private RequestHeaderNamedValueInfo(RequestHeader annotation) { super(annotation.value(), annotation.required(), annotation.defaultValue()); } } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java index 3f351595ecdb..2a532f4bed8c 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java @@ -212,4 +212,4 @@ private RequestParamNamedValueInfo(RequestParam annotation) { super(annotation.value(), annotation.required(), annotation.defaultValue()); } } -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodArgumentResolver.java index 9dafb6d867ac..2699d8536f80 100644 --- a/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodArgumentResolver.java @@ -22,7 +22,7 @@ import org.springframework.web.context.request.NativeWebRequest; /** - * Strategy interface for resolving method parameters into argument values in + * Strategy interface for resolving method parameters into argument values in * the context of a given request. * * @author Arjen Poutsma @@ -31,25 +31,25 @@ public interface HandlerMethodArgumentResolver { /** - * Whether the given {@linkplain MethodParameter method parameter} is + * Whether the given {@linkplain MethodParameter method parameter} is * supported by this resolver. - * + * * @param parameter the method parameter to check - * @return {@code true} if this resolver supports the supplied parameter; + * @return {@code true} if this resolver supports the supplied parameter; * {@code false} otherwise */ boolean supportsParameter(MethodParameter parameter); /** - * Resolves a method parameter into an argument value from a given request. - * A {@link ModelAndViewContainer} provides access to the model for the + * Resolves a method parameter into an argument value from a given request. + * A {@link ModelAndViewContainer} provides access to the model for the * request. A {@link WebDataBinderFactory} provides a way to create - * a {@link WebDataBinder} instance when needed for data binding and + * a {@link WebDataBinder} instance when needed for data binding and * type conversion purposes. - * - * @param parameter the method parameter to resolve. This parameter must - * have previously been passed to - * {@link #supportsParameter(org.springframework.core.MethodParameter)} + * + * @param parameter the method parameter to resolve. This parameter must + * have previously been passed to + * {@link #supportsParameter(org.springframework.core.MethodParameter)} * and it must have returned {@code true} * @param mavContainer the ModelAndViewContainer for the current request * @param webRequest the current request @@ -57,9 +57,9 @@ public interface HandlerMethodArgumentResolver { * @return the resolved argument value, or {@code null}. * @throws Exception in case of errors with the preparation of argument values */ - Object resolveArgument(MethodParameter parameter, + Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, - NativeWebRequest webRequest, + NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception; -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodReturnValueHandler.java b/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodReturnValueHandler.java index 8def3ac532be..4393f66eb1b7 100644 --- a/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodReturnValueHandler.java +++ b/spring-web/src/main/java/org/springframework/web/method/support/HandlerMethodReturnValueHandler.java @@ -20,8 +20,8 @@ import org.springframework.web.context.request.NativeWebRequest; /** - * Strategy interface to handle the value returned from the invocation of a - * handler method . + * Strategy interface to handle the value returned from the invocation of a + * handler method . * * @author Arjen Poutsma * @since 3.1 @@ -29,25 +29,25 @@ public interface HandlerMethodReturnValueHandler { /** - * Whether the given {@linkplain MethodParameter method return type} is + * Whether the given {@linkplain MethodParameter method return type} is * supported by this handler. * * @param returnType the method return type to check - * @return {@code true} if this handler supports the supplied return type; + * @return {@code true} if this handler supports the supplied return type; * {@code false} otherwise */ boolean supportsReturnType(MethodParameter returnType); /** - * Handle the given return value by adding attributes to the model and - * setting a view or setting the + * Handle the given return value by adding attributes to the model and + * setting a view or setting the * {@link ModelAndViewContainer#setRequestHandled} flag to {@code true} - * to indicate the response has been handled directly. - * + * to indicate the response has been handled directly. + * * @param returnValue the value returned from the handler method - * @param returnType the type of the return value. This type must have - * previously been passed to - * {@link #supportsReturnType(org.springframework.core.MethodParameter)} + * @param returnType the type of the return value. This type must have + * previously been passed to + * {@link #supportsReturnType(org.springframework.core.MethodParameter)} * and it must have returned {@code true} * @param mavContainer the ModelAndViewContainer for the current request * @param webRequest the current request @@ -58,4 +58,4 @@ void handleReturnValue(Object returnValue, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception; -} \ No newline at end of file +} diff --git a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java index d2e5938d291d..2301cc1d7f26 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java index 9c2d45113b13..55bf0ec4f450 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.Serializable; -import java.util.Collections; -import java.util.Iterator; - import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItem; diff --git a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java index 3ea1edc79dfb..d2cd3c14b0c1 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/AbstractMultipartHttpServletRequest.java b/spring-web/src/main/java/org/springframework/web/multipart/support/AbstractMultipartHttpServletRequest.java index 4dd8c14b0165..9f8b4e52bd21 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/AbstractMultipartHttpServletRequest.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/AbstractMultipartHttpServletRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/DefaultMultipartHttpServletRequest.java b/spring-web/src/main/java/org/springframework/web/multipart/support/DefaultMultipartHttpServletRequest.java index 19d435b77d3a..e35e9e51ebb5 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/DefaultMultipartHttpServletRequest.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/DefaultMultipartHttpServletRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,9 +76,9 @@ public DefaultMultipartHttpServletRequest(HttpServletRequest request) { @Override public Enumeration getParameterNames() { Set paramNames = new HashSet(); - Enumeration paramEnum = super.getParameterNames(); + Enumeration paramEnum = super.getParameterNames(); while (paramEnum.hasMoreElements()) { - paramNames.add((String) paramEnum.nextElement()); + paramNames.add(paramEnum.nextElement()); } paramNames.addAll(getMultipartParameters().keySet()); return Collections.enumeration(paramNames); @@ -103,7 +103,6 @@ public String[] getParameterValues(String name) { } @Override - @SuppressWarnings("unchecked") public Map getParameterMap() { Map paramMap = new HashMap(); paramMap.putAll(super.getParameterMap()); diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java b/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java index c7bff8e6e430..5730b844035b 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -114,7 +114,7 @@ protected void doFilterInternal( logger.debug("Request [" + processedRequest.getRequestURI() + "] is not a multipart request"); } } - + try { filterChain.doFilter(processedRequest, response); } diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequest.java b/spring-web/src/main/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequest.java index 4cffa524bb98..2d8c260ef657 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequest.java @@ -51,15 +51,15 @@ public class RequestPartServletServerHttpRequest extends ServletServerHttpReques /** - * Create a new instance. + * Create a new instance. * @param request the current request * @param partName the name of the part to adapt to the {@link ServerHttpRequest} contract * @throws MissingServletRequestPartException if the request part cannot be found * @throws IllegalArgumentException if MultipartHttpServletRequest cannot be initialized */ - public RequestPartServletServerHttpRequest(HttpServletRequest request, String partName) + public RequestPartServletServerHttpRequest(HttpServletRequest request, String partName) throws MissingServletRequestPartException { - + super(request); this.multipartRequest = asMultipartRequest(request); @@ -78,7 +78,7 @@ public RequestPartServletServerHttpRequest(HttpServletRequest request, String pa } } } - + private static MultipartHttpServletRequest asMultipartRequest(HttpServletRequest request) { if (request instanceof MultipartHttpServletRequest) { return (MultipartHttpServletRequest) request; diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/StringMultipartFileEditor.java b/spring-web/src/main/java/org/springframework/web/multipart/support/StringMultipartFileEditor.java index 9c551c315f2b..7d8e8dff17a2 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/support/StringMultipartFileEditor.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/support/StringMultipartFileEditor.java @@ -24,7 +24,7 @@ /** * Custom {@link java.beans.PropertyEditor} for converting * {@link MultipartFile MultipartFiles} to Strings. - * + * *

        Allows one to specify the charset to use. * * @author Juergen Hoeller diff --git a/spring-web/src/main/java/org/springframework/web/util/ExpressionEvaluationUtils.java b/spring-web/src/main/java/org/springframework/web/util/ExpressionEvaluationUtils.java index 46f78f10755a..dd84f6897575 100644 --- a/spring-web/src/main/java/org/springframework/web/util/ExpressionEvaluationUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/ExpressionEvaluationUtils.java @@ -114,7 +114,7 @@ public static boolean isExpressionLanguage(String value) { * if the passed-in literal value is not an EL expression and not assignable to * the result class */ - public static Object evaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) + public static Object evaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) throws JspException { if (isSpringJspExpressionSupportActive(pageContext) && isExpressionLanguage(attrValue)) { @@ -216,7 +216,7 @@ public static boolean evaluateBoolean(String attrName, String attrValue, PageCon * @return the result of the evaluation * @throws JspException in case of parsing errors */ - private static Object doEvaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) + private static Object doEvaluate(String attrName, String attrValue, Class resultClass, PageContext pageContext) throws JspException { Assert.notNull(attrValue, "Attribute value must not be null"); @@ -274,7 +274,7 @@ private static Object doEvaluate(String attrName, String attrValue, Class result } } - private static Object evaluateExpression(String exprValue, Class resultClass, PageContext pageContext) + private static Object evaluateExpression(String exprValue, Class resultClass, PageContext pageContext) throws ELException { return pageContext.getExpressionEvaluator().evaluate( diff --git a/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java b/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java index 4f91a68ebfe9..b09c4e97ad3b 100644 --- a/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java +++ b/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public HtmlCharacterEntityReferences() { } // Parse reference definition properties - Enumeration keys = entityReferences.propertyNames(); + Enumeration keys = entityReferences.propertyNames(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); int referredChar = Integer.parseInt(key); diff --git a/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java b/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java index e28d503c8eb7..d5deee498f78 100644 --- a/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,7 +126,7 @@ public static String htmlEscapeHex(String input) { char character = input.charAt(i); if (characterEntityReferences.isMappedToReference(character)) { escaped.append(HtmlCharacterEntityReferences.HEX_REFERENCE_START); - escaped.append(Integer.toString((int) character, 16)); + escaped.append(Integer.toString(character, 16)); escaped.append(HtmlCharacterEntityReferences.REFERENCE_END); } else { diff --git a/spring-web/src/main/java/org/springframework/web/util/TagUtils.java b/spring-web/src/main/java/org/springframework/web/util/TagUtils.java index 8c000e83f0b9..4043eb1776fd 100644 --- a/spring-web/src/main/java/org/springframework/web/util/TagUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/TagUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public abstract class TagUtils { * 'page' or 'application', the method will return {@link PageContext#PAGE_SCOPE}. * @param scope the String to inspect * @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched - * @throws IllegalArgumentException if the supplied scope is null + * @throws IllegalArgumentException if the supplied scope is null */ public static int getScope(String scope) { Assert.notNull(scope, "Scope to search for cannot be null"); @@ -90,9 +90,9 @@ else if (scope.equals(SCOPE_APPLICATION)) { * of the supplied type * @throws IllegalArgumentException if either of the supplied arguments is null; * or if the supplied ancestorTagClass is not type-assignable to - * the {@link Tag} class + * the {@link Tag} class */ - public static boolean hasAncestorOfType(Tag tag, Class ancestorTagClass) { + public static boolean hasAncestorOfType(Tag tag, Class ancestorTagClass) { Assert.notNull(tag, "Tag cannot be null"); Assert.notNull(ancestorTagClass, "Ancestor tag class cannot be null"); if (!Tag.class.isAssignableFrom(ancestorTagClass)) { @@ -122,10 +122,10 @@ public static boolean hasAncestorOfType(Tag tag, Class ancestorTagClass) { * @throws IllegalArgumentException if any of the supplied arguments is null, * or in the case of the {@link String}-typed arguments, is composed wholly * of whitespace; or if the supplied ancestorTagClass is not - * type-assignable to the {@link Tag} class + * type-assignable to the {@link Tag} class * @see #hasAncestorOfType(javax.servlet.jsp.tagext.Tag, Class) */ - public static void assertHasAncestorOfType(Tag tag, Class ancestorTagClass, String tagName, String ancestorTagName) { + public static void assertHasAncestorOfType(Tag tag, Class ancestorTagClass, String tagName, String ancestorTagName) { Assert.hasText(tagName, "'tagName' must not be empty"); Assert.hasText(ancestorTagName, "'ancestorTagName' must not be empty"); if (!TagUtils.hasAncestorOfType(tag, ancestorTagClass)) { diff --git a/spring-web/src/main/java/org/springframework/web/util/UriUtils.java b/spring-web/src/main/java/org/springframework/web/util/UriUtils.java index e976a43b54a6..c86b5a613e7b 100644 --- a/spring-web/src/main/java/org/springframework/web/util/UriUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/UriUtils.java @@ -70,8 +70,8 @@ public abstract class UriUtils { /** * Encodes the given source URI into an encoded String. All various URI components are * encoded according to their respective valid character sets. - *

        Note that this method does not attempt to encode "=" and "&" - * characters in query parameter names and query parameter values because they cannot + *

        Note that this method does not attempt to encode "=" and "&" + * characters in query parameter names and query parameter values because they cannot * be parsed in a reliable way. Instead use: *

         	 * UriComponents uriComponents = UriComponentsBuilder.fromUri("/path?name={value}").buildAndExpand("a=b");
        @@ -111,8 +111,8 @@ public static String encodeUri(String uri, String encoding) throws UnsupportedEn
         	 * encoded according to their respective valid character sets.
         	 * 

        Note that this method does not support fragments ({@code #}), * as these are not supposed to be sent to the server, but retained by the client. - *

        Note that this method does not attempt to encode "=" and "&" - * characters in query parameter names and query parameter values because they cannot + *

        Note that this method does not attempt to encode "=" and "&" + * characters in query parameter names and query parameter values because they cannot * be parsed in a reliable way. Instead use: *

         	 * UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl("/path?name={value}").buildAndExpand("a=b");
        diff --git a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java
        index 4c2b036a6cdc..6b4e54be3d95 100644
        --- a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java
        +++ b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -319,7 +319,7 @@ public static void setSessionAttribute(HttpServletRequest request, String name,
         	 * @return the value of the session attribute, newly created if not found
         	 * @throws IllegalArgumentException if the session attribute could not be instantiated
         	 */
        -	public static Object getOrCreateSessionAttribute(HttpSession session, String name, Class clazz)
        +	public static Object getOrCreateSessionAttribute(HttpSession session, String name, Class clazz)
         			throws IllegalArgumentException {
         
         		Assert.notNull(session, "Session must not be null");
        @@ -573,7 +573,6 @@ public static boolean hasSubmitParameter(ServletRequest request, String name) {
         	 * @return the value of the parameter, or null
         	 * if the parameter does not exist in given request
         	 */
        -	@SuppressWarnings("unchecked")
         	public static String findParameterValue(ServletRequest request, String name) {
         		return findParameterValue(request.getParameterMap(), name);
         	}
        @@ -644,13 +643,13 @@ else if (value != null) {
         	 */
         	public static Map getParametersStartingWith(ServletRequest request, String prefix) {
         		Assert.notNull(request, "Request must not be null");
        -		Enumeration paramNames = request.getParameterNames();
        +		Enumeration paramNames = request.getParameterNames();
         		Map params = new TreeMap();
         		if (prefix == null) {
         			prefix = "";
         		}
         		while (paramNames != null && paramNames.hasMoreElements()) {
        -			String paramName = (String) paramNames.nextElement();
        +			String paramName = paramNames.nextElement();
         			if ("".equals(prefix) || paramName.startsWith(prefix)) {
         				String unprefixed = paramName.substring(prefix.length());
         				String[] values = request.getParameterValues(paramName);
        @@ -678,9 +677,9 @@ else if (values.length > 1) {
         	 * @return the page specified in the request, or current page if not found
         	 */
         	public static int getTargetPage(ServletRequest request, String paramPrefix, int currentPage) {
        -		Enumeration paramNames = request.getParameterNames();
        +		Enumeration paramNames = request.getParameterNames();
         		while (paramNames.hasMoreElements()) {
        -			String paramName = (String) paramNames.nextElement();
        +			String paramName = paramNames.nextElement();
         			if (paramName.startsWith(paramPrefix)) {
         				for (int i = 0; i < WebUtils.SUBMIT_IMAGE_SUFFIXES.length; i++) {
         					String suffix = WebUtils.SUBMIT_IMAGE_SUFFIXES[i];
        diff --git a/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java b/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java
        index bb5e71f5cd07..18ddbd3b78be 100644
        --- a/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java
        +++ b/spring-web/src/test/java/org/springframework/beans/BeanWithObjectProperty.java
        @@ -32,4 +32,4 @@ public void setObject(Object object) {
         		this.object = object;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/Colour.java b/spring-web/src/test/java/org/springframework/beans/Colour.java
        index 60dc333e0b47..4db722187d9d 100644
        --- a/spring-web/src/test/java/org/springframework/beans/Colour.java
        +++ b/spring-web/src/test/java/org/springframework/beans/Colour.java
        @@ -32,4 +32,4 @@ private Colour(int code, String label) {
         		super(code, label);
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java
        index 2bb41a9d5b68..db326041c361 100644
        --- a/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/DerivedTestBean.java
        @@ -82,4 +82,4 @@ public boolean wasDestroyed() {
         		return destroyed;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java b/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java
        index 61f911902c7b..f367fb5d6e32 100644
        --- a/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/FieldAccessBean.java
        @@ -41,4 +41,4 @@ public TestBean getSpouse() {
         		return spouse;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java
        index 7d87547b5f7f..115af8482600 100644
        --- a/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/INestedTestBean.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        @@ -20,4 +20,4 @@ public interface INestedTestBean {
         
         	public String getCompany();
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/IOther.java b/spring-web/src/test/java/org/springframework/beans/IOther.java
        index 797486ec44e7..c77616637e6c 100644
        --- a/spring-web/src/test/java/org/springframework/beans/IOther.java
        +++ b/spring-web/src/test/java/org/springframework/beans/IOther.java
        @@ -1,13 +1,13 @@
         
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        @@ -21,4 +21,4 @@ public interface IOther {
         
         	void absquatulate();
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/ITestBean.java b/spring-web/src/test/java/org/springframework/beans/ITestBean.java
        index 526c3dacfb57..cf9c20276913 100644
        --- a/spring-web/src/test/java/org/springframework/beans/ITestBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/ITestBean.java
        @@ -84,4 +84,4 @@ public interface ITestBean {
         
         	void unreliableFileOperation() throws IOException;
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java
        index ddb091770ee7..4f3012666eac 100644
        --- a/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/IndexedTestBean.java
        @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) {
         		this.sortedMap = sortedMap;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java
        index a06e15d150be..638f6b4a81eb 100644
        --- a/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/NestedTestBean.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        @@ -57,4 +57,4 @@ public String toString() {
         		return "NestedTestBean: " + this.company;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/Person.java b/spring-web/src/test/java/org/springframework/beans/Person.java
        index 3ebce5e2ea0a..763cfa92e134 100644
        --- a/spring-web/src/test/java/org/springframework/beans/Person.java
        +++ b/spring-web/src/test/java/org/springframework/beans/Person.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        @@ -33,4 +33,4 @@ public interface Person {
         	 * returned.
         	 */
         	Object echo(Object o) throws Throwable;
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java b/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java
        index 36351352aab8..275cc2750529 100644
        --- a/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java
        +++ b/spring-web/src/test/java/org/springframework/beans/SerializablePerson.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        @@ -61,4 +61,4 @@ public boolean equals(Object other) {
         		return p.age == age && ObjectUtils.nullSafeEquals(name, p.name);
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/TestBean.java b/spring-web/src/test/java/org/springframework/beans/TestBean.java
        index 282a18352d7c..a968db059509 100644
        --- a/spring-web/src/test/java/org/springframework/beans/TestBean.java
        +++ b/spring-web/src/test/java/org/springframework/beans/TestBean.java
        @@ -464,4 +464,4 @@ public String toString() {
         		return this.name;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java
        index 006228975a76..9ab82f0d0c25 100644
        --- a/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java
        +++ b/spring-web/src/test/java/org/springframework/beans/factory/DummyFactory.java
        @@ -169,4 +169,4 @@ public void destroy() {
         		}
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/core/task/MockRunnable.java b/spring-web/src/test/java/org/springframework/core/task/MockRunnable.java
        index 42b9adbfd569..8aa2d6395460 100644
        --- a/spring-web/src/test/java/org/springframework/core/task/MockRunnable.java
        +++ b/spring-web/src/test/java/org/springframework/core/task/MockRunnable.java
        @@ -31,4 +31,4 @@ public boolean wasExecuted() {
         		return this.executed;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/http/HttpEntityTests.java b/spring-web/src/test/java/org/springframework/http/HttpEntityTests.java
        index 9b70cecfb159..939d18a4d7ba 100644
        --- a/spring-web/src/test/java/org/springframework/http/HttpEntityTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/HttpEntityTests.java
        @@ -57,29 +57,6 @@ public void multiValueMap() {
         		assertEquals("text/plain", entity.getHeaders().getFirst("Content-Type"));
         	}
         
        -	@Test
        -	public void testEquals() {
        -		MultiValueMap map1 = new LinkedMultiValueMap();
        -		map1.set("Content-Type", "text/plain");
        -
        -		MultiValueMap map2 = new LinkedMultiValueMap();
        -		map2.set("Content-Type", "application/json");
        -
        -		assertTrue(new HttpEntity().equals(new HttpEntity()));
        -		assertFalse(new HttpEntity(map1).equals(new HttpEntity()));
        -		assertFalse(new HttpEntity().equals(new HttpEntity(map2)));
        -
        -		assertTrue(new HttpEntity(map1).equals(new HttpEntity(map1)));
        -		assertFalse(new HttpEntity(map1).equals(new HttpEntity(map2)));
        -
        -		assertTrue(new HttpEntity(null, null).equals(new HttpEntity(null, null)));
        -		assertFalse(new HttpEntity("foo", null).equals(new HttpEntity(null, null)));
        -		assertFalse(new HttpEntity(null, null).equals(new HttpEntity("bar", null)));
        -
        -		assertTrue(new HttpEntity("foo", map1).equals(new HttpEntity("foo", map1)));
        -		assertFalse(new HttpEntity("foo", map1).equals(new HttpEntity("bar", map1)));
        -	}
        -
         	@Test
         	public void responseEntity() {
         		HttpHeaders headers = new HttpHeaders();
        diff --git a/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java b/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
        index 2b6ef1035fb4..129cd89f1ca8 100644
        --- a/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/client/BufferingClientHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/BufferingClientHttpRequestFactoryTests.java
        index f862d0cb311f..2f21e9ec7c0c 100644
        --- a/spring-web/src/test/java/org/springframework/http/client/BufferingClientHttpRequestFactoryTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/client/BufferingClientHttpRequestFactoryTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java
        index 4fd3017ca236..ca3dc0ef7032 100644
        --- a/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java
        @@ -16,10 +16,6 @@
         
         package org.springframework.http.client;
         
        -import java.net.URI;
        -
        -import org.junit.Test;
        -import org.springframework.http.HttpMethod;
         
         public class CommonsHttpRequestFactoryTests extends AbstractHttpRequestFactoryTestCase {
         
        diff --git a/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java
        index 8507cdbfe833..aaa9c487e5a3 100644
        --- a/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/client/StreamingSimpleHttpRequestFactoryTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/client/support/ProxyFactoryBeanTest.java b/spring-web/src/test/java/org/springframework/http/client/support/ProxyFactoryBeanTest.java
        index 1bb2e0e52426..93b2c134c9fc 100644
        --- a/spring-web/src/test/java/org/springframework/http/client/support/ProxyFactoryBeanTest.java
        +++ b/spring-web/src/test/java/org/springframework/http/client/support/ProxyFactoryBeanTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2010 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/BufferedImageHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/BufferedImageHttpMessageConverterTests.java
        index 3fd2d97e2afc..e86edadb04f4 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/BufferedImageHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/BufferedImageHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/ByteArrayHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/ByteArrayHttpMessageConverterTests.java
        index 4b8eda8400de..e50a9a0da017 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/ByteArrayHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/ByteArrayHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java
        index 7293a4690c3e..cdd3010af0fc 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -73,7 +73,6 @@ public void canWrite() {
         	}
         
         	@Test
        -	@SuppressWarnings("unchecked")
         	public void readForm() throws Exception {
         		String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3";
         		Charset iso88591 = Charset.forName("ISO-8859-1");
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/HttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/HttpMessageConverterTests.java
        index 0de4c197367e..d29b2b71298d 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/HttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/HttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2010 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -17,15 +17,6 @@
         package org.springframework.http.converter;
         
         import java.io.IOException;
        -import java.io.StringReader;
        -import java.io.StringWriter;
        -
        -import javax.xml.bind.JAXBContext;
        -import javax.xml.bind.JAXBElement;
        -import javax.xml.transform.Source;
        -import javax.xml.transform.stream.StreamSource;
        -import javax.xml.namespace.QName;
        -
         import static org.junit.Assert.*;
         import org.junit.Test;
         
        @@ -56,7 +47,7 @@ protected boolean supports(Class clazz) {
         		assertFalse(converter.canRead(MyType.class, new MediaType("foo", "*")));
         		assertFalse(converter.canRead(MyType.class, MediaType.ALL));
         	}
        -	
        +
         	@Test
         	public void canWrite() {
         		AbstractHttpMessageConverter converter = new MyHttpMessageConverter(MEDIA_TYPE) {
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/ResourceHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/ResourceHttpMessageConverterTests.java
        index 8d8f38516bf7..562d7d1250a6 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/ResourceHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/ResourceHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2010 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/StringHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/StringHttpMessageConverterTests.java
        index 149a84f659e8..2af8ea381679 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/StringHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/StringHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -87,7 +87,7 @@ public void writeUTF8() throws IOException {
         	}
         
         	// SPR-8867
        -	
        +
         	@Test
         	public void writeOverrideRequestedContentType() throws IOException {
         		Charset utf8 = Charset.forName("UTF-8");
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java
        index 57ffc51f356e..9f0779784ecc 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2010 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java
        index 6f7cf78cd317..a4180354009a 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2010 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -135,4 +135,4 @@ public void writeOtherCharset() throws IOException, SAXException {
         	}
         
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTest.java b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTest.java
        index d8c60f182721..2f12bc988b7f 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTest.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -56,7 +56,7 @@ public void setUp() {
         		AopProxy proxy = proxyFactory.createAopProxy(advisedSupport);
         		rootElementCglib = (RootElement) proxy.getProxy();
         	}
        -	
        +
         	@Test
         	public void canRead() throws Exception {
         		assertTrue("Converter does not support reading @XmlRootElement", converter.canRead(RootElement.class, null));
        @@ -72,29 +72,26 @@ public void canWrite() throws Exception {
         	}
         
         	@Test
        -	@SuppressWarnings("unchecked")
         	public void readXmlRootElement() throws Exception {
         		byte[] body = "".getBytes("UTF-8");
         		MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
        -		RootElement result = (RootElement) converter.read((Class) RootElement.class, inputMessage);
        +		RootElement result = (RootElement) converter.read(RootElement.class, inputMessage);
         		assertEquals("Invalid result", "Hello World", result.type.s);
         	}
        -	
        +
         	@Test
        -	@SuppressWarnings("unchecked")
         	public void readXmlRootElementSubclass() throws Exception {
         		byte[] body = "".getBytes("UTF-8");
         		MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
        -		RootElementSubclass result = (RootElementSubclass) converter.read((Class) RootElementSubclass.class, inputMessage);
        +		RootElementSubclass result = (RootElementSubclass) converter.read(RootElementSubclass.class, inputMessage);
         		assertEquals("Invalid result", "Hello World", result.type.s);
         	}
         
         	@Test
        -	@SuppressWarnings("unchecked")
         	public void readXmlType() throws Exception {
         		byte[] body = "".getBytes("UTF-8");
         		MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
        -		Type result = (Type) converter.read((Class) Type.class, inputMessage);
        +		Type result = (Type) converter.read(Type.class, inputMessage);
         		assertEquals("Invalid result", "Hello World", result.s);
         	}
         
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverterTests.java
        index 7fd414b627cd..812114126ea1 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java
        index 3dbbb80e5f2e..b009e2d491e2 100644
        --- a/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -39,7 +39,6 @@
         import static org.custommonkey.xmlunit.XMLAssert.*;
         
         /** @author Arjen Poutsma */
        -@SuppressWarnings("unchecked")
         public class SourceHttpMessageConverterTests {
         
         	private SourceHttpMessageConverter converter;
        @@ -120,7 +119,7 @@ public void writeDOMSource() throws Exception {
         		assertEquals("Invalid content-length", outputMessage.getBodyAsBytes().length,
         				outputMessage.getHeaders().getContentLength());
         	}
        -	
        +
         	@Test
         	public void writeSAXSource() throws Exception {
         		String xml = "Hello World";
        diff --git a/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java b/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java
        index 9b0555ae57c7..d6273d46d6ed 100644
        --- a/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java
        @@ -106,4 +106,4 @@ public void getFormBody() throws Exception {
         		assertArrayEquals("Invalid content returned", content, result);
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpResponseTests.java b/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpResponseTests.java
        index 0c329bd785ce..288d0d06d42b 100644
        --- a/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpResponseTests.java
        +++ b/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpResponseTests.java
        @@ -78,4 +78,4 @@ public void getBody() throws Exception {
         
         		assertArrayEquals("Invalid content written", content, mockResponse.getContentAsByteArray());
         	}
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/mock/web/test/MockMultipartFile.java b/spring-web/src/test/java/org/springframework/mock/web/test/MockMultipartFile.java
        index 5a556d145ab5..c9bf0742967c 100644
        --- a/spring-web/src/test/java/org/springframework/mock/web/test/MockMultipartFile.java
        +++ b/spring-web/src/test/java/org/springframework/mock/web/test/MockMultipartFile.java
        @@ -20,9 +20,6 @@
         import java.io.File;
         import java.io.IOException;
         import java.io.InputStream;
        -import java.util.Collections;
        -import java.util.Iterator;
        -
         import org.springframework.util.Assert;
         import org.springframework.util.FileCopyUtils;
         import org.springframework.web.multipart.MultipartFile;
        diff --git a/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java b/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java
        index 82a198d48ead..c99e389ae355 100644
        --- a/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java
        +++ b/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java
        @@ -251,7 +251,6 @@ public Enumeration getAttributeNames() {
         		return Collections.enumeration(this.attributes.keySet());
         	}
         
        -	@SuppressWarnings("unchecked")
         	public Enumeration getAttributeNamesInScope(int scope) {
         		switch (scope) {
         			case PAGE_SCOPE:
        diff --git a/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java b/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java
        index b2ca68eb7f66..f89503b255dc 100644
        --- a/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java
        +++ b/spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java
        index dbe6421093e4..39a7582e831c 100644
        --- a/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java
        +++ b/spring-web/src/test/java/org/springframework/util/SerializationTestUtils.java
        @@ -94,4 +94,4 @@ public void testWithSerializableObject() throws Exception {
         		assertEquals(y, (int) p2.getY());
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java b/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java
        index 9f6a1df756f6..ce165a097c04 100644
        --- a/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/bind/EscapedErrorsTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java b/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
        index 00306c05316b..cdbe94dcb2c7 100644
        --- a/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java b/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java
        index 6bd5bb75d301..5c18203da6ba 100644
        --- a/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java
        @@ -72,7 +72,7 @@ public void testPutBeanInRequest() throws Exception {
         			// expected
         		}
         	}
        -	
        +
         	@Test
         	public void testPutBeanInSession() throws Exception {
         		String targetBeanName = "target";
        diff --git a/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java b/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java
        index d427f7f38110..47b200b2ea09 100644
        --- a/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java b/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java
        index 5c87bb7c0572..dc19900478e3 100644
        --- a/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/context/support/StandardServletEnvironmentTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/filter/HiddenHttpMethodFilterTest.java b/spring-web/src/test/java/org/springframework/web/filter/HiddenHttpMethodFilterTest.java
        index 13f74da0aa12..c81ee3609719 100644
        --- a/spring-web/src/test/java/org/springframework/web/filter/HiddenHttpMethodFilterTest.java
        +++ b/spring-web/src/test/java/org/springframework/web/filter/HiddenHttpMethodFilterTest.java
        @@ -70,4 +70,4 @@ public void doFilter(ServletRequest filterRequest, ServletResponse filterRespons
         		};
         		filter.doFilter(request, response, filterChain);
         	}
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/filter/HttpPutFormContentFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/HttpPutFormContentFilterTests.java
        index 4ef31fad5b0c..0d3afb5c3124 100644
        --- a/spring-web/src/test/java/org/springframework/web/filter/HttpPutFormContentFilterTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/filter/HttpPutFormContentFilterTests.java
        @@ -87,15 +87,6 @@ public void wrapFormEncodedOnly() throws Exception {
         		}
         	}
         
        -	@Test
        -	public void invalidMediaType() throws Exception {
        -		request.setContent("".getBytes("ISO-8859-1"));
        -		request.setContentType("foo");
        -		filterChain = new MockFilterChain();
        -		filter.doFilter(request, response, filterChain);
        -		assertSame(request, filterChain.getRequest());
        -	}
        -
         	@Test
         	public void getParameter() throws Exception {
         		request.setContent("name=value".getBytes("ISO-8859-1"));
        diff --git a/spring-web/src/test/java/org/springframework/web/filter/RequestContextFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/RequestContextFilterTests.java
        index 69a71bb3fc1c..5eed6a55ac7d 100644
        --- a/spring-web/src/test/java/org/springframework/web/filter/RequestContextFilterTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/filter/RequestContextFilterTests.java
        @@ -41,16 +41,16 @@ public class RequestContextFilterTests extends TestCase {
         	public void testHappyPath() throws Exception {
         		testFilterInvocation(null);
         	}
        -	
        +
         	public void testWithException() throws Exception {
         		testFilterInvocation(new ServletException());
         	}
        -		
        +
         	public void testFilterInvocation(final ServletException sex) throws Exception {
         		final MockHttpServletRequest req = new MockHttpServletRequest();
         		req.setAttribute("myAttr", "myValue");
         		final MockHttpServletResponse resp = new MockHttpServletResponse();
        -		
        +
         		// Expect one invocation by the filter being tested
         		class DummyFilterChain implements FilterChain {
         			public int invocations = 0;
        @@ -84,7 +84,7 @@ public void doFilter(ServletRequest req, ServletResponse resp) throws IOExceptio
         		catch (ServletException ex) {
         			assertNotNull(sex);
         		}
        -		
        +
         		try {
         			RequestContextHolder.currentRequestAttributes();
         			fail();
        diff --git a/spring-web/src/test/java/org/springframework/web/filter/ShallowEtagHeaderFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/ShallowEtagHeaderFilterTests.java
        index f5fdf0849944..ebb4867bfd7c 100644
        --- a/spring-web/src/test/java/org/springframework/web/filter/ShallowEtagHeaderFilterTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/filter/ShallowEtagHeaderFilterTests.java
        @@ -126,4 +126,4 @@ public void doFilter(ServletRequest filterRequest, ServletResponse filterRespons
         		assertArrayEquals("Invalid content", new byte[0], response.getContentAsByteArray());
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/jsf/MockFacesContext.java b/spring-web/src/test/java/org/springframework/web/jsf/MockFacesContext.java
        index 7963c88b5adf..144545a0afda 100644
        --- a/spring-web/src/test/java/org/springframework/web/jsf/MockFacesContext.java
        +++ b/spring-web/src/test/java/org/springframework/web/jsf/MockFacesContext.java
        @@ -122,4 +122,4 @@ public void renderResponse() {
         	public void responseComplete() {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/jsf/MockLifecycle.java b/spring-web/src/test/java/org/springframework/web/jsf/MockLifecycle.java
        index 5cda13aead9b..29a22aa6fcf5 100644
        --- a/spring-web/src/test/java/org/springframework/web/jsf/MockLifecycle.java
        +++ b/spring-web/src/test/java/org/springframework/web/jsf/MockLifecycle.java
        @@ -43,4 +43,4 @@ public void removePhaseListener(PhaseListener phaseListener) {
         	public void render(FacesContext facesContext) throws FacesException {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/CookieValueMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/CookieValueMethodArgumentResolverTests.java
        index 8b36851a2af0..8e859f847e74 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/CookieValueMethodArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/CookieValueMethodArgumentResolverTests.java
        @@ -38,7 +38,7 @@
         
         /**
          * Test fixture with {@link org.springframework.web.method.annotation.AbstractCookieValueMethodArgumentResolver}.
        - * 
        + *
          * @author Arjen Poutsma
          * @author Rossen Stoyanchev
          */
        @@ -59,7 +59,7 @@ public class CookieValueMethodArgumentResolverTests {
         	@Before
         	public void setUp() throws Exception {
         		resolver = new TestCookieValueMethodArgumentResolver();
        -		
        +
         		Method method = getClass().getMethod("params", Cookie.class, String.class, String.class);
         		paramNamedCookie = new MethodParameter(method, 0);
         		paramNamedDefaultValueString = new MethodParameter(method, 1);
        @@ -79,7 +79,7 @@ public void supportsParameter() {
         	@Test
         	public void resolveCookieDefaultValue() throws Exception {
         		Object result = resolver.resolveArgument(paramNamedDefaultValueString, null, webRequest, null);
        -		
        +
         		assertTrue(result instanceof String);
         		assertEquals("Invalid result", "bar", result);
         	}
        @@ -101,10 +101,10 @@ protected Object resolveName(String name, MethodParameter parameter, NativeWebRe
         			return null;
         		}
         	}
        -	
        +
         	public void params(@CookieValue("name") Cookie param1,
         					   @CookieValue(value = "name", defaultValue = "bar") String param2,
         					   String param3) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ErrorsMethodHandlerArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ErrorsMethodHandlerArgumentResolverTests.java
        index 719d5eda0a96..3b505d1fec77 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ErrorsMethodHandlerArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ErrorsMethodHandlerArgumentResolverTests.java
        @@ -32,7 +32,7 @@
         
         /**
          * Test fixture with {@link ErrorsMethodArgumentResolver}.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class ErrorsMethodHandlerArgumentResolverTests {
        @@ -66,7 +66,7 @@ public void bindingResult() throws Exception {
         		mavContainer.addAttribute("ignore4", "value4");
         		mavContainer.addAttribute("ignore5", "value5");
         		mavContainer.addAllAttributes(bindingResult.getModel());
        -		
        +
         		Object actual = resolver.resolveArgument(paramErrors, mavContainer, webRequest, null);
         
         		assertSame(actual, bindingResult);
        @@ -77,10 +77,10 @@ public void bindingResultNotFound() throws Exception {
         		ModelAndViewContainer mavContainer = new ModelAndViewContainer();
         		mavContainer.addAllAttributes(bindingResult.getModel());
         		mavContainer.addAttribute("ignore1", "value1");
        -		
        +
         		resolver.resolveArgument(paramErrors, mavContainer, webRequest, null);
         	}
        -	
        +
         	@Test(expected=IllegalStateException.class)
         	public void noBindingResult() throws Exception {
         		resolver.resolveArgument(paramErrors, new ModelAndViewContainer(), webRequest, null);
        @@ -90,4 +90,4 @@ public void noBindingResult() throws Exception {
         	private void handle(Errors errors) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolverTests.java
        index 1a233bba9dcb..4ac6a733487e 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolverTests.java
        @@ -34,7 +34,7 @@
         
         /**
          * Test fixture for {@link ExceptionHandlerMethodResolver} tests.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class ExceptionHandlerMethodResolverTests {
        @@ -83,7 +83,7 @@ public void resolveMethodInherited() {
         		IOException exception = new IOException();
         		assertEquals("handleIOException", resolver.resolveMethod(exception).getName());
         	}
        -	
        +
         	@Test(expected = IllegalStateException.class)
         	public void ambiguousExceptionMapping() {
         		new ExceptionHandlerMethodResolver(AmbiguousController.class);
        @@ -96,7 +96,7 @@ public void noExceptionMapping() {
         
         	@Controller
         	static class ExceptionController {
        -		
        +
         		public void handle() {}
         
         		@ExceptionHandler(IOException.class)
        @@ -139,10 +139,10 @@ public String handle2(IllegalArgumentException ex) {
         
         	@Controller
         	static class NoExceptionController {
        -		
        +
         		@ExceptionHandler
         		public void handle() {
         		}
         	}
        -	
        +
         }
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java
        index cd6ac844ba0f..0b2a47065da0 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java
        @@ -37,7 +37,7 @@
         
         /**
          * Test fixture with {@link ExpressionValueMethodArgumentResolver}.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class ExpressionValueMethodArgumentResolverTests {
        @@ -57,18 +57,18 @@ public void setUp() throws Exception {
         		GenericWebApplicationContext context = new GenericWebApplicationContext();
         		context.refresh();
         		resolver = new ExpressionValueMethodArgumentResolver(context.getBeanFactory());
        -		
        +
         		Method method = getClass().getMethod("params", int.class, String.class, String.class);
         		paramSystemProperty = new MethodParameter(method, 0);
         		paramContextPath = new MethodParameter(method, 1);
         		paramNotSupported = new MethodParameter(method, 2);
         
         		webRequest = new ServletWebRequest(new MockHttpServletRequest(), new MockHttpServletResponse());
        -		
        +
         		// Expose request to the current thread (for SpEL expressions)
         		RequestContextHolder.setRequestAttributes(webRequest);
         	}
        -	
        +
         	@After
         	public void teardown() {
         		RequestContextHolder.resetRequestAttributes();
        @@ -86,7 +86,7 @@ public void resolveSystemProperty() throws Exception {
         		System.setProperty("systemProperty", "22");
         		Object value = resolver.resolveArgument(paramSystemProperty, null, webRequest, null);
         		System.clearProperty("systemProperty");
        -		
        +
         		assertEquals("22", value);
         	}
         
        @@ -94,7 +94,7 @@ public void resolveSystemProperty() throws Exception {
         	public void resolveContextPath() throws Exception {
         		webRequest.getNativeRequest(MockHttpServletRequest.class).setContextPath("/contextPath");
         		Object value = resolver.resolveArgument(paramContextPath, null, webRequest, null);
        -		
        +
         		assertEquals("/contextPath", value);
         	}
         
        @@ -103,4 +103,4 @@ public void params(@Value("#{systemProperties.systemProperty}") int param1,
         					   String notSupported) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java
        index 6600ef920fcd..9076e240f17e 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/InitBinderDataBinderFactoryTests.java
        @@ -53,19 +53,19 @@ public class InitBinderDataBinderFactoryTests {
         	private HandlerMethodArgumentResolverComposite argumentResolvers;
         
         	private NativeWebRequest webRequest;
        -	
        +
         	@Before
         	public void setUp() throws Exception {
         		bindingInitializer = new ConfigurableWebBindingInitializer();
         		argumentResolvers = new HandlerMethodArgumentResolverComposite();
         		webRequest = new ServletWebRequest(new MockHttpServletRequest());
         	}
        -	
        +
         	@Test
         	public void createBinder() throws Exception {
         		WebDataBinderFactory factory = createBinderFactory("initBinder", WebDataBinder.class);
         		WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
        -		
        +
         		assertNotNull(dataBinder.getDisallowedFields());
         		assertEquals("id", dataBinder.getDisallowedFields()[0]);
         	}
        @@ -74,10 +74,10 @@ public void createBinder() throws Exception {
         	public void createBinderWithGlobalInitialization() throws Exception {
         		ConversionService conversionService = new DefaultFormattingConversionService();
         		bindingInitializer.setConversionService(conversionService);
        -		
        +
         		WebDataBinderFactory factory = createBinderFactory("initBinder", WebDataBinder.class);
         		WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
        -		
        +
         		assertSame(conversionService, dataBinder.getConversionService());
         	}
         
        @@ -85,7 +85,7 @@ public void createBinderWithGlobalInitialization() throws Exception {
         	public void createBinderWithAttrName() throws Exception {
         		WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
         		WebDataBinder dataBinder = factory.createBinder(webRequest, null, "foo");
        -		
        +
         		assertNotNull(dataBinder.getDisallowedFields());
         		assertEquals("id", dataBinder.getDisallowedFields()[0]);
         	}
        @@ -94,18 +94,18 @@ public void createBinderWithAttrName() throws Exception {
         	public void createBinderWithAttrNameNoMatch() throws Exception {
         		WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
         		WebDataBinder dataBinder = factory.createBinder(webRequest, null, "invalidName");
        -		
        +
         		assertNull(dataBinder.getDisallowedFields());
         	}
        -	
        +
         	@Test
         	public void createBinderNullAttrName() throws Exception {
         		WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
         		WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
        -		
        +
         		assertNull(dataBinder.getDisallowedFields());
         	}
        -	
        +
         	@Test(expected=IllegalStateException.class)
         	public void returnValueNotExpected() throws Exception {
         		WebDataBinderFactory factory = createBinderFactory("initBinderReturnValue", WebDataBinder.class);
        @@ -123,7 +123,7 @@ public void createBinderTypeConversion() throws Exception {
         		assertNotNull(dataBinder.getDisallowedFields());
         		assertEquals("requestParam-22", dataBinder.getDisallowedFields()[0]);
         	}
        -	
        +
         	private WebDataBinderFactory createBinderFactory(String methodName, Class... parameterTypes)
         			throws Exception {
         
        @@ -134,9 +134,9 @@ private WebDataBinderFactory createBinderFactory(String methodName, Class...
         		handlerMethod.setHandlerMethodArgumentResolvers(argumentResolvers);
         		handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null));
         		handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());
        -		
        +
         		return new InitBinderDataBinderFactory(Arrays.asList(handlerMethod), bindingInitializer);
        -	}	
        +	}
         
         	private static class InitBinderHandler {
         
        @@ -145,24 +145,24 @@ private static class InitBinderHandler {
         		public void initBinder(WebDataBinder dataBinder) {
         			dataBinder.setDisallowedFields("id");
         		}
        -		
        +
         		@SuppressWarnings("unused")
         		@InitBinder(value="foo")
         		public void initBinderWithAttributeName(WebDataBinder dataBinder) {
         			dataBinder.setDisallowedFields("id");
         		}
        -		
        +
         		@SuppressWarnings("unused")
         		@InitBinder
         		public String initBinderReturnValue(WebDataBinder dataBinder) {
         			return "invalid";
         		}
        -		
        +
         		@SuppressWarnings("unused")
         		@InitBinder
         		public void initBinderTypeConversion(WebDataBinder dataBinder, @RequestParam int requestParam) {
         			dataBinder.setDisallowedFields("requestParam-" + requestParam);
         		}
         	}
        -	
        -}
        \ No newline at end of file
        +
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/MapMethodProcessorTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/MapMethodProcessorTests.java
        index 3d35b95cbd9a..da09dc6fad5d 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/MapMethodProcessorTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/MapMethodProcessorTests.java
        @@ -35,15 +35,15 @@
         
         /**
          * Test fixture with {@link org.springframework.web.method.annotation.MapMethodProcessor}.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class MapMethodProcessorTests {
         
         	private MapMethodProcessor processor;
        -	
        +
         	private ModelAndViewContainer mavContainer;
        -	
        +
         	private MethodParameter paramMap;
         
         	private MethodParameter returnParamMap;
        @@ -54,8 +54,8 @@ public class MapMethodProcessorTests {
         	public void setUp() throws Exception {
         		processor = new MapMethodProcessor();
         		mavContainer = new ModelAndViewContainer();
        -		
        -		Method method = getClass().getDeclaredMethod("map", Map.class); 
        +
        +		Method method = getClass().getDeclaredMethod("map", Map.class);
         		paramMap = new MethodParameter(method, 0);
         		returnParamMap = new MethodParameter(method, 0);
         
        @@ -76,12 +76,12 @@ public void supportsReturnType() {
         	public void resolveArgumentValue() throws Exception {
         		assertSame(mavContainer.getModel(), processor.resolveArgument(paramMap, mavContainer, webRequest, null));
         	}
        -	
        +
         	@Test
         	public void handleMapReturnValue() throws Exception {
         		mavContainer.addAttribute("attr1", "value1");
         		Map returnValue = new ModelMap("attr2", "value2");
        -		
        +
         		processor.handleReturnValue(returnValue , returnParamMap, mavContainer, webRequest);
         
         		assertEquals("value1", mavContainer.getModel().get("attr1"));
        @@ -92,5 +92,5 @@ public void handleMapReturnValue() throws Exception {
         	private Map map(Map map) {
         		return null;
         	}
        -	
        -}
        \ No newline at end of file
        +
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java
        index 573b1c54b30b..cb23a6494c1b 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelAttributeMethodProcessorTests.java
        @@ -307,4 +307,4 @@ private TestBean notAnnotatedReturnValue() {
         		return null;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java
        index 1007bb266cb0..34ca840ce93e 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryTests.java
        @@ -50,13 +50,13 @@
         
         /**
          * Text fixture for {@link ModelFactory} tests.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class ModelFactoryTests {
        -	
        +
         	private Object handler = new ModelHandler();
        -	
        +
         	private InvocableHandlerMethod handleMethod;
         
         	private InvocableHandlerMethod handleSessionAttrMethod;
        @@ -77,13 +77,13 @@ public void setUp() throws Exception {
         		sessionAttrsHandler = new SessionAttributesHandler(handlerType, sessionAttributeStore);
         		webRequest = new ServletWebRequest(new MockHttpServletRequest());
         	}
        -	
        +
         	@Test
         	public void modelAttributeMethod() throws Exception {
         		ModelFactory modelFactory = createModelFactory("modelAttr", Model.class);
         		ModelAndViewContainer mavContainer = new ModelAndViewContainer();
         		modelFactory.initModel(webRequest, mavContainer, handleMethod);
        -		
        +
         		assertEquals(Boolean.TRUE, mavContainer.getModel().get("modelAttr"));
         	}
         
        @@ -114,14 +114,14 @@ public void modelAttributeMethodWithNullReturnValue() throws Exception {
         		assertTrue(mavContainer.containsAttribute("name"));
         		assertNull(mavContainer.getModel().get("name"));
         	}
        -	
        +
         	@Test
         	public void sessionAttribute() throws Exception {
         		sessionAttributeStore.storeAttribute(webRequest, "sessionAttr", "sessionAttrValue");
         
         		// Resolve successfully handler session attribute once
         		assertTrue(sessionAttrsHandler.isHandlerSessionAttribute("sessionAttr", null));
        -		
        +
         		ModelFactory modelFactory = createModelFactory("modelAttr", Model.class);
         		ModelAndViewContainer mavContainer = new ModelAndViewContainer();
         		modelFactory.initModel(webRequest, mavContainer, handleMethod);
        @@ -137,7 +137,7 @@ public void requiredSessionAttribute() throws Exception {
         			modelFactory.initModel(webRequest, new ModelAndViewContainer(), handleSessionAttrMethod);
         			fail("Expected HttpSessionRequiredException");
         		} catch (HttpSessionRequiredException e) { }
        -		
        +
         		sessionAttributeStore.storeAttribute(webRequest, "sessionAttr", "sessionAttrValue");
         		ModelAndViewContainer mavContainer = new ModelAndViewContainer();
         		modelFactory.initModel(webRequest, mavContainer, handleSessionAttrMethod);
        @@ -151,19 +151,19 @@ public void updateModelBindingResultKeys() throws Exception {
         		Object attrValue = new Object();
         		ModelAndViewContainer mavContainer = new ModelAndViewContainer();
         		mavContainer.addAttribute(attrName, attrValue);
        -		
        +
         		WebDataBinder dataBinder = new WebDataBinder(attrValue, attrName);
         		WebDataBinderFactory binderFactory = createMock(WebDataBinderFactory.class);
         		expect(binderFactory.createBinder(webRequest, attrValue, attrName)).andReturn(dataBinder);
         		replay(binderFactory);
        -		
        +
         		ModelFactory modelFactory = new ModelFactory(null, binderFactory, sessionAttrsHandler);
         		modelFactory.updateModel(webRequest, mavContainer);
         
         		assertEquals(attrValue, mavContainer.getModel().remove(attrName));
         		assertSame(dataBinder.getBindingResult(), mavContainer.getModel().remove(bindingResultKey(attrName)));
         		assertEquals(0, mavContainer.getModel().size());
        -		
        +
         		verify(binderFactory);
         	}
         
        @@ -171,12 +171,12 @@ public void updateModelBindingResultKeys() throws Exception {
         	public void updateModelSessionStatusComplete() throws Exception {
         		String attrName = "sessionAttr";
         		String attrValue = "sessionAttrValue";
        -		
        +
         		ModelAndViewContainer mavContainer = new ModelAndViewContainer();
         		mavContainer.addAttribute(attrName, attrValue);
         		mavContainer.getSessionStatus().setComplete();
         		sessionAttributeStore.storeAttribute(webRequest, attrName, attrValue);
        -		
        +
         		// Resolve successfully handler session attribute once
         		assertTrue(sessionAttrsHandler.isHandlerSessionAttribute(attrName, null));
         
        @@ -193,11 +193,11 @@ public void updateModelSessionStatusComplete() throws Exception {
         
         		verify(binderFactory);
         	}
        -	
        +
         	private String bindingResultKey(String key) {
         		return BindingResult.MODEL_KEY_PREFIX + key;
         	}
        -	
        +
         	private ModelFactory createModelFactory(String methodName, Class... parameterTypes) throws Exception{
         		Method method = ModelHandler.class.getMethod(methodName, parameterTypes);
         
        @@ -208,13 +208,13 @@ private ModelFactory createModelFactory(String methodName, Class... parameter
         		handlerMethod.setHandlerMethodArgumentResolvers(argResolvers);
         		handlerMethod.setDataBinderFactory(null);
         		handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());
        -		
        +
         		return new ModelFactory(Arrays.asList(handlerMethod), null, sessionAttrsHandler);
         	}
        -	
        +
         	@SessionAttributes("sessionAttr") @SuppressWarnings("unused")
         	private static class ModelHandler {
        -		
        +
         		@ModelAttribute
         		public void modelAttr(Model model) {
         			model.addAttribute("modelAttr", Boolean.TRUE);
        @@ -234,7 +234,7 @@ public Boolean modelAttrConvention() {
         		public Boolean nullModelAttr() {
         			return null;
         		}
        -		
        +
         		public void handle() {
         		}
         
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelMethodProcessorTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelMethodProcessorTests.java
        index 7c42a0f9cfcf..8ee374e00444 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelMethodProcessorTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelMethodProcessorTests.java
        @@ -35,15 +35,15 @@
         
         /**
          * Test fixture with {@link org.springframework.web.method.annotation.ModelMethodProcessor}.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class ModelMethodProcessorTests {
         
         	private ModelMethodProcessor processor;
        -	
        +
         	private ModelAndViewContainer mavContainer;
        -	
        +
         	private MethodParameter paramModel;
         
         	private MethodParameter returnParamModel;
        @@ -54,11 +54,11 @@ public class ModelMethodProcessorTests {
         	public void setUp() throws Exception {
         		processor = new ModelMethodProcessor();
         		mavContainer = new ModelAndViewContainer();
        -		
        -		Method method = getClass().getDeclaredMethod("model", Model.class); 
        +
        +		Method method = getClass().getDeclaredMethod("model", Model.class);
         		paramModel = new MethodParameter(method, 0);
         		returnParamModel = new MethodParameter(method, -1);
        -		
        +
         		webRequest = new ServletWebRequest(new MockHttpServletRequest());
         	}
         
        @@ -76,7 +76,7 @@ public void supportsReturnType() {
         	public void resolveArgumentValue() throws Exception {
         		assertSame(mavContainer.getModel(), processor.resolveArgument(paramModel, mavContainer, webRequest, null));
         	}
        -	
        +
         	@Test
         	public void handleModelReturnValue() throws Exception {
         		mavContainer.addAttribute("attr1", "value1");
        @@ -84,14 +84,14 @@ public void handleModelReturnValue() throws Exception {
         		returnValue.addAttribute("attr2", "value2");
         
         		processor.handleReturnValue(returnValue , returnParamModel, mavContainer, webRequest);
        -		
        +
         		assertEquals("value1", mavContainer.getModel().get("attr1"));
         		assertEquals("value2", mavContainer.getModel().get("attr2"));
         	}
        -	
        +
         	@SuppressWarnings("unused")
         	private Model model(Model model) {
         		return null;
         	}
        -	
        -}
        \ No newline at end of file
        +
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java
        index 25170be90d98..96411e79a851 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java
        @@ -39,7 +39,7 @@
         
         /**
          * Text fixture with {@link RequestHeaderMapMethodArgumentResolver}.
        - * 
        + *
          * @author Arjen Poutsma
          * @author Rossen Stoyanchev
          */
        @@ -62,7 +62,7 @@ public class RequestHeaderMapMethodArgumentResolverTests {
         	@Before
         	public void setUp() throws Exception {
         		resolver = new RequestHeaderMapMethodArgumentResolver();
        -		
        +
         		Method method = getClass().getMethod("params", Map.class, MultiValueMap.class, HttpHeaders.class, Map.class);
         		paramMap = new MethodParameter(method, 0);
         		paramMultiValueMap = new MethodParameter(method, 1);
        @@ -108,7 +108,7 @@ public void resolveMultiValueMapArgument() throws Exception {
         		expected.add(name, value2);
         
         		Object result = resolver.resolveArgument(paramMultiValueMap, null, webRequest, null);
        -		
        +
         		assertTrue(result instanceof MultiValueMap);
         		assertEquals("Invalid result", expected, result);
         	}
        @@ -127,7 +127,7 @@ public void resolveHttpHeadersArgument() throws Exception {
         		expected.add(name, value2);
         
         		Object result = resolver.resolveArgument(paramHttpHeaders, null, webRequest, null);
        -		
        +
         		assertTrue(result instanceof HttpHeaders);
         		assertEquals("Invalid result", expected, result);
         	}
        @@ -138,4 +138,4 @@ public void params(@RequestHeader Map param1,
         					   Map unsupported) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java
        index 0c3921d72090..53b0290dfa3c 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java
        @@ -41,7 +41,7 @@
         
         /**
          * Test fixture with {@link org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver}.
        - * 
        + *
          * @author Arjen Poutsma
          * @author Rossen Stoyanchev
          */
        @@ -78,7 +78,7 @@ public void setUp() throws Exception {
         		// Expose request to the current thread (for SpEL expressions)
         		RequestContextHolder.setRequestAttributes(webRequest);
         	}
        -	
        +
         	@After
         	public void teardown() {
         		RequestContextHolder.resetRequestAttributes();
        @@ -153,4 +153,4 @@ public void params(@RequestHeader(value = "name", defaultValue = "bar") String p
         					   @RequestHeader("name") Map unsupported) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMapMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMapMethodArgumentResolverTests.java
        index 6334fcd4c9e7..9e3ee54bb89d 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMapMethodArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMapMethodArgumentResolverTests.java
        @@ -38,7 +38,7 @@
         
         /**
          * Test fixture with {@link RequestParamMapMethodArgumentResolver}.
        - * 
        + *
          * @author Arjen Poutsma
          * @author Rossen Stoyanchev
          */
        @@ -61,7 +61,7 @@ public class RequestParamMapMethodArgumentResolverTests {
         	@Before
         	public void setUp() throws Exception {
         		resolver = new RequestParamMapMethodArgumentResolver();
        -		
        +
         		Method method = getClass().getMethod("params", Map.class, MultiValueMap.class, Map.class, Map.class);
         		paramMap = new MethodParameter(method, 0);
         		paramMultiValueMap = new MethodParameter(method, 1);
        @@ -88,7 +88,7 @@ public void resolveMapArgument() throws Exception {
         		Map expected = Collections.singletonMap(name, value);
         
         		Object result = resolver.resolveArgument(paramMap, null, webRequest, null);
        -		
        +
         		assertTrue(result instanceof Map);
         		assertEquals("Invalid result", expected, result);
         	}
        @@ -99,7 +99,7 @@ public void resolveMultiValueMapArgument() throws Exception {
         		String value1 = "bar";
         		String value2 = "baz";
         		request.addParameter(name, new String[]{value1, value2});
        -		
        +
         		MultiValueMap expected = new LinkedMultiValueMap(1);
         		expected.add(name, value1);
         		expected.add(name, value2);
        @@ -116,4 +116,4 @@ public void params(@RequestParam Map param1,
         					   Map param4) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverTests.java
        index 272b2b59594d..f8978d8b176b 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverTests.java
        @@ -50,7 +50,7 @@
         
         /**
          * Test fixture with {@link org.springframework.web.method.annotation.RequestParamMethodArgumentResolver}.
        - * 
        + *
          * @author Arjen Poutsma
          * @author Rossen Stoyanchev
          */
        @@ -81,7 +81,7 @@ public void setUp() throws Exception {
         
         		Method method = getClass().getMethod("params", String.class, String[].class, Map.class, MultipartFile.class,
         				Map.class, String.class, MultipartFile.class, List.class, Part.class, MultipartFile.class);
        -		
        +
         		paramNamedDefaultValueString = new MethodParameter(method, 0);
         		paramNamedStringArray = new MethodParameter(method, 1);
         		paramNamedMap = new MethodParameter(method, 2);
        @@ -112,7 +112,7 @@ public void supportsParameter() {
         		assertTrue("Simple type params supported w/o annotations", resolver.supportsParameter(paramStringNotAnnot));
         		assertTrue("MultipartFile parameter not supported", resolver.supportsParameter(paramMultipartFileNotAnnot));
         		assertTrue("Part parameter not supported", resolver.supportsParameter(paramServlet30Part));
        -		
        +
         		resolver = new RequestParamMethodArgumentResolver(null, false);
         		assertFalse(resolver.supportsParameter(paramStringNotAnnot));
         		assertFalse(resolver.supportsParameter(paramRequestPartAnnot));
        @@ -229,7 +229,7 @@ public void resolveServlet30Part() throws Exception {
         	@Test
         	public void resolveDefaultValue() throws Exception {
         		Object result = resolver.resolveArgument(paramNamedDefaultValueString, null, webRequest, null);
        -		
        +
         		assertTrue(result instanceof String);
         		assertEquals("Invalid result", "bar", result);
         	}
        @@ -250,7 +250,7 @@ public void resolveSimpleTypeParam() throws Exception {
         	}
         
         	// SPR-8561
        -	
        +
         	@Test
         	public void resolveSimpleTypeParamToNull() throws Exception {
         		Object result = resolver.resolveArgument(paramStringNotAnnot, null, webRequest, null);
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java
        index a9699262e48d..8c9314dea5f8 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/SessionAttributesHandlerTests.java
        @@ -122,4 +122,4 @@ public void storeAttributes() throws Exception {
         	private static class SessionAttributeHandler {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/WebArgumentResolverAdapterTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/WebArgumentResolverAdapterTests.java
        index ed392de90970..b09b4750d934 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/annotation/WebArgumentResolverAdapterTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/WebArgumentResolverAdapterTests.java
        @@ -36,7 +36,7 @@
         
         /**
          * Test fixture with {@link WebArgumentResolverAdapterTests}.
        - * 
        + *
          * @author Arjen Poutsma
          * @author Rossen Stoyanchev
          */
        @@ -56,7 +56,7 @@ public void setUp() throws Exception {
         		adapter = new TestWebArgumentResolverAdapter(adaptee);
         		parameter = new MethodParameter(getClass().getMethod("handle", Integer.TYPE), 0);
         		webRequest = new ServletWebRequest(new MockHttpServletRequest());
        -		
        +
         		// Expose request to the current thread (for SpEL expressions)
         		RequestContextHolder.setRequestAttributes(webRequest);
         	}
        @@ -151,7 +151,7 @@ public void resolveArgumentThrowsException() throws Exception {
         
         	public void handle(int param) {
         	}
        -	
        +
         	private class TestWebArgumentResolverAdapter extends AbstractWebArgumentResolverAdapter {
         
         		public TestWebArgumentResolverAdapter(WebArgumentResolver adaptee) {
        @@ -164,4 +164,4 @@ protected NativeWebRequest getWebRequest() {
         		}
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodArgumentResolverCompositeTests.java b/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodArgumentResolverCompositeTests.java
        index 18a8a164164c..c0c93f370215 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodArgumentResolverCompositeTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodArgumentResolverCompositeTests.java
        @@ -28,7 +28,7 @@
         
         /**
          * Test fixture with {@link HandlerMethodArgumentResolverComposite}.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class HandlerMethodArgumentResolverCompositeTests {
        @@ -42,20 +42,20 @@ public class HandlerMethodArgumentResolverCompositeTests {
         	@Before
         	public void setUp() throws Exception {
         		resolvers = new HandlerMethodArgumentResolverComposite();
        -		
        +
         		Method method = getClass().getDeclaredMethod("handle", Integer.class, String.class);
         		paramInt = new MethodParameter(method, 0);
         		paramStr = new MethodParameter(method, 1);
         	}
        -	
        +
         	@Test
         	public void supportsParameter() throws Exception {
         		registerResolver(Integer.class, null);
        -		
        +
         		assertTrue(this.resolvers.supportsParameter(paramInt));
         		assertFalse(this.resolvers.supportsParameter(paramStr));
         	}
        -	
        +
         	@Test
         	public void resolveArgument() throws Exception {
         		registerResolver(Integer.class, Integer.valueOf(55));
        @@ -63,7 +63,7 @@ public void resolveArgument() throws Exception {
         
         		assertEquals(Integer.valueOf(55), resolvedValue);
         	}
        -	
        +
         	@Test
         	public void checkArgumentResolverOrder() throws Exception {
         		registerResolver(Integer.class, Integer.valueOf(1));
        @@ -72,7 +72,7 @@ public void checkArgumentResolverOrder() throws Exception {
         
         		assertEquals("Didn't use the first registered resolver", Integer.valueOf(1), resolvedValue);
         	}
        -	
        +
         	@Test(expected=IllegalArgumentException.class)
         	public void noSuitableArgumentResolver() throws Exception {
         		this.resolvers.resolveArgument(paramStr, null, null, null);
        @@ -88,4 +88,4 @@ protected StubArgumentResolver registerResolver(Class supportedType, Object s
         	private void handle(Integer arg1, String arg2) {
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodReturnValueHandlerCompositeTests.java b/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodReturnValueHandlerCompositeTests.java
        index 99b53bb78b22..0ab867fab9f1 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodReturnValueHandlerCompositeTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/support/HandlerMethodReturnValueHandlerCompositeTests.java
        @@ -27,7 +27,7 @@
         
         /**
          * Test fixture with {@link HandlerMethodReturnValueHandlerComposite}.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class HandlerMethodReturnValueHandlerCompositeTests {
        @@ -35,7 +35,7 @@ public class HandlerMethodReturnValueHandlerCompositeTests {
         	private HandlerMethodReturnValueHandlerComposite handlers;
         
         	ModelAndViewContainer mavContainer;
        -	
        +
         	private MethodParameter paramInt;
         
         	private MethodParameter paramStr;
        @@ -43,11 +43,11 @@ public class HandlerMethodReturnValueHandlerCompositeTests {
         	@Before
         	public void setUp() throws Exception {
         		handlers = new HandlerMethodReturnValueHandlerComposite();
        -		mavContainer = new ModelAndViewContainer(); 
        +		mavContainer = new ModelAndViewContainer();
         		paramInt = new MethodParameter(getClass().getDeclaredMethod("handleInteger"), -1);
         		paramStr = new MethodParameter(getClass().getDeclaredMethod("handleString"), -1);
         	}
        -	
        +
         	@Test
         	public void supportsReturnType() throws Exception {
         		registerHandler(Integer.class);
        @@ -55,12 +55,12 @@ public void supportsReturnType() throws Exception {
         		assertTrue(this.handlers.supportsReturnType(paramInt));
         		assertFalse(this.handlers.supportsReturnType(paramStr));
         	}
        -	
        +
         	@Test
         	public void handleReturnValue() throws Exception {
         		StubReturnValueHandler handler = registerHandler(Integer.class);
         		this.handlers.handleReturnValue(Integer.valueOf(55), paramInt, mavContainer, null);
        -		
        +
         		assertEquals(Integer.valueOf(55), handler.getReturnValue());
         	}
         
        @@ -69,31 +69,31 @@ public void handleReturnValueMultipleHandlers() throws Exception {
         		StubReturnValueHandler h1 = registerHandler(Integer.class);
         		StubReturnValueHandler h2 = registerHandler(Integer.class);
         		this.handlers.handleReturnValue(Integer.valueOf(55), paramInt, mavContainer, null);
        -		
        +
         		assertEquals("Didn't use the 1st registered handler", Integer.valueOf(55), h1.getReturnValue());
         		assertNull("Shouldn't have use the 2nd registered handler", h2.getReturnValue());
         	}
        -	
        +
         	@Test(expected=IllegalArgumentException.class)
         	public void noSuitableReturnValueHandler() throws Exception {
         		registerHandler(Integer.class);
         		this.handlers.handleReturnValue("value", paramStr, null, null);
         	}
        -	
        +
         	private StubReturnValueHandler registerHandler(Class returnType) {
         		StubReturnValueHandler handler = new StubReturnValueHandler(returnType);
         		handlers.addHandler(handler);
         		return handler;
         	}
        -	
        +
         	@SuppressWarnings("unused")
         	private Integer handleInteger() {
         		return null;
         	}
        -	
        +
         	@SuppressWarnings("unused")
         	private String handleString() {
         		return null;
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/support/InvocableHandlerMethodTests.java b/spring-web/src/test/java/org/springframework/web/method/support/InvocableHandlerMethodTests.java
        index 9eb740031e40..08f9176ab163 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/support/InvocableHandlerMethodTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/support/InvocableHandlerMethodTests.java
        @@ -60,9 +60,9 @@ public void resolveArg() throws Exception {
         		HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
         		composite.addResolver(intResolver);
         		composite.addResolver(stringResolver);
        -		handlerMethod.setHandlerMethodArgumentResolvers(composite);
        +		handleMethod.setHandlerMethodArgumentResolvers(composite);
         
        -		Object returnValue = handlerMethod.invokeForRequest(webRequest, null);
        +		Object returnValue = handleMethod.invokeForRequest(webRequest, null);
         
         		assertEquals(1, intResolver.getResolvedParameters().size());
         		assertEquals(1, stringResolver.getResolvedParameters().size());
        @@ -80,9 +80,9 @@ public void resolveNullArg() throws Exception {
         		HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
         		composite.addResolver(intResolver);
         		composite.addResolver(stringResolver);
        -		handlerMethod.setHandlerMethodArgumentResolvers(composite);
        +		handleMethod.setHandlerMethodArgumentResolvers(composite);
         
        -		Object returnValue = handlerMethod.invokeForRequest(webRequest, null);
        +		Object returnValue = handleMethod.invokeForRequest(webRequest, null);
         
         		assertEquals(1, intResolver.getResolvedParameters().size());
         		assertEquals(1, stringResolver.getResolvedParameters().size());
        @@ -126,7 +126,7 @@ public void resolveProvidedArgFirst() throws Exception {
         	public void exceptionInResolvingArg() throws Exception {
         		HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
         		composite.addResolver(new ExceptionRaisingArgumentResolver());
        -		handlerMethod.setHandlerMethodArgumentResolvers(composite);
        +		handleMethod.setHandlerMethodArgumentResolvers(composite);
         
         		try {
         			handlerMethod.invokeForRequest(webRequest, null);
        diff --git a/spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java b/spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java
        index 7e98d2c4e64d..bd0c80565c39 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java
        @@ -36,7 +36,7 @@ public class ModelAndViewContainerTests {
         	public void setup() {
         		this.mavContainer = new ModelAndViewContainer();
         	}
        -	
        +
         	@Test
         	public void getModel() {
         		this.mavContainer.addAttribute("name", "value");
        @@ -48,13 +48,13 @@ public void getModelRedirectModel() {
         		ModelMap redirectModel = new ModelMap("name", "redirectValue");
         		this.mavContainer.setRedirectModel(redirectModel);
         		this.mavContainer.addAttribute("name", "value");
        -		
        +
         		assertEquals("Default model should be used if not in redirect scenario",
         				"value", this.mavContainer.getModel().get("name"));
        -	
        +
         		this.mavContainer.setRedirectModelScenario(true);
        -		
        -		assertEquals("Redirect model should be used in redirect scenario", 
        +
        +		assertEquals("Redirect model should be used in redirect scenario",
         				"redirectValue", this.mavContainer.getModel().get("name"));
         	}
         
        @@ -62,13 +62,13 @@ public void getModelRedirectModel() {
         	public void getModelIgnoreDefaultModelOnRedirect() {
         		this.mavContainer.addAttribute("name", "value");
         		this.mavContainer.setRedirectModelScenario(true);
        -		
        -		assertEquals("Default model should be used since no redirect model was provided", 
        +
        +		assertEquals("Default model should be used since no redirect model was provided",
         				1, this.mavContainer.getModel().size());
         
         		this.mavContainer.setIgnoreDefaultModelOnRedirect(true);
        -		
        -		assertEquals("Empty model should be returned if no redirect model is available", 
        +
        +		assertEquals("Empty model should be returned if no redirect model is available",
         				0, this.mavContainer.getModel().size());
         	}
         
        diff --git a/spring-web/src/test/java/org/springframework/web/method/support/StubArgumentResolver.java b/spring-web/src/test/java/org/springframework/web/method/support/StubArgumentResolver.java
        index db89c8dea578..9e2750ed58b8 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/support/StubArgumentResolver.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/support/StubArgumentResolver.java
        @@ -26,7 +26,7 @@
         /**
          * Supports parameters of a given type and resolves them using a stub value.
          * Also records the resolved parameter value.
        - * 
        + *
          * @author Rossen Stoyanchev
          */
         public class StubArgumentResolver implements HandlerMethodArgumentResolver {
        @@ -34,7 +34,7 @@ public class StubArgumentResolver implements HandlerMethodArgumentResolver {
         	private final Class parameterType;
         
         	private final Object stubValue;
        -	
        +
         	private List resolvedParameters = new ArrayList();
         
         	public StubArgumentResolver(Class supportedParameterType, Object stubValue) {
        @@ -55,4 +55,4 @@ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m
         		this.resolvedParameters.add(parameter);
         		return this.stubValue;
         	}
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/method/support/StubReturnValueHandler.java b/spring-web/src/test/java/org/springframework/web/method/support/StubReturnValueHandler.java
        index 61717c659ac9..7f888093543e 100644
        --- a/spring-web/src/test/java/org/springframework/web/method/support/StubReturnValueHandler.java
        +++ b/spring-web/src/test/java/org/springframework/web/method/support/StubReturnValueHandler.java
        @@ -20,16 +20,16 @@
         import org.springframework.web.context.request.NativeWebRequest;
         
         /**
        - * Supports a fixed return value type. Records the last handled return value. 
        - * 
        + * Supports a fixed return value type. Records the last handled return value.
        + *
          * @author Rossen Stoyanchev
          */
         public class StubReturnValueHandler implements HandlerMethodReturnValueHandler {
         
         	private final Class returnType;
        -	
        +
         	private Object returnValue;
        -	
        +
         	public StubReturnValueHandler(Class returnType) {
         		this.returnType = returnType;
         	}
        diff --git a/spring-web/src/test/java/org/springframework/web/multipart/support/ByteArrayMultipartFileEditorTests.java b/spring-web/src/test/java/org/springframework/web/multipart/support/ByteArrayMultipartFileEditorTests.java
        index 169f2477e01f..542e16e80796 100644
        --- a/spring-web/src/test/java/org/springframework/web/multipart/support/ByteArrayMultipartFileEditorTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/multipart/support/ByteArrayMultipartFileEditorTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2006 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java b/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java
        index 51252eec7494..60776274c52c 100644
        --- a/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java
        @@ -36,19 +36,19 @@
         public class RequestPartServletServerHttpRequestTests {
         
         	private RequestPartServletServerHttpRequest request;
        -	
        +
         	private MockMultipartHttpServletRequest mockRequest;
         
         	private MockMultipartFile mockFile;
        -	
        +
         	@Before
         	public void create() throws Exception {
         		mockFile = new MockMultipartFile("part", "", "application/json" ,"Part Content".getBytes("UTF-8"));
         		mockRequest = new MockMultipartHttpServletRequest();
         		mockRequest.addFile(mockFile);
         		request = new RequestPartServletServerHttpRequest(mockRequest, "part");
        -	}	
        -	
        +	}
        +
         	@Test
         	public void getMethod() throws Exception {
         		mockRequest.setMethod("POST");
        @@ -80,5 +80,5 @@ public void getBody() throws Exception {
         		byte[] result = FileCopyUtils.copyToByteArray(request.getBody());
         		assertArrayEquals("Invalid content returned", mockFile.getBytes(), result);
         	}
        -	
        +
         }
        diff --git a/spring-web/src/test/java/org/springframework/web/util/HtmlCharacterEntityReferencesTests.java b/spring-web/src/test/java/org/springframework/web/util/HtmlCharacterEntityReferencesTests.java
        index 97917b81469c..afa92ef09387 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/HtmlCharacterEntityReferencesTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/HtmlCharacterEntityReferencesTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java
        index 26d8f711b3c1..be70998555c1 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/HtmlUtilsTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java b/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java
        index 2d37f8c6ac1c..baa11b9e441c 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java
        @@ -50,7 +50,7 @@ public void initLoggingWithClasspathResource() {
         	public void initLoggingWithClasspathResourceAndRefreshInterval() {
         		initLogging(CLASSPATH_RESOURCE, true);
         	}
        -	
        +
         	@Test
         	public void initLoggingWithRelativeFilePath() {
         		initLogging(RELATIVE_PATH, false);
        @@ -119,11 +119,11 @@ private void assertLogOutput() {
         	@Test
         	public void testLog4jConfigListener() {
         		Log4jConfigListener listener = new Log4jConfigListener();
        -		
        +
         		MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
         		sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, RELATIVE_PATH);
         		listener.contextInitialized(new ServletContextEvent(sc));
        -		
        +
         		try {
         			assertLogOutput();
         		} finally {
        diff --git a/spring-web/src/test/java/org/springframework/web/util/MockLog4jAppender.java b/spring-web/src/test/java/org/springframework/web/util/MockLog4jAppender.java
        index 83963b8c06bc..dcccf0dd7eb6 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/MockLog4jAppender.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/MockLog4jAppender.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        @@ -56,4 +56,4 @@ public boolean requiresLayout() {
         
         
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/util/TagUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/TagUtilsTests.java
        index 9484a2c514b0..a4eb20758469 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/TagUtilsTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/TagUtilsTests.java
        @@ -1,12 +1,12 @@
         /*
        - * Copyright 2002-2006 the original author or authors.
        - * 
        + * Copyright 2002-2012 the original author or authors.
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        diff --git a/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java b/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java
        index 234a21c09045..50b1fc07ee53 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java
        @@ -45,7 +45,7 @@ public void toUriNotEncoded() throws URISyntaxException {
                 UriComponents uriComponents = UriComponentsBuilder.fromUriString("http://example.com/hotel list/Z\u00fcrich").build();
                 assertEquals(new URI("http://example.com/hotel%20list/Z\u00fcrich"), uriComponents.toUri());
             }
        -	
        +
         	@Test
         	public void expand() {
         		UriComponents uriComponents = UriComponentsBuilder.fromUriString("http://example.com").path("/{foo} {bar}").build();
        @@ -63,7 +63,7 @@ public void expandEncoded() {
         	public void invalidCharacters() {
         		UriComponentsBuilder.fromPath("/{foo}").build(true);
         	}
        -	
        +
         	@Test(expected = IllegalArgumentException.class)
         	public void invalidEncodedSequence() {
         		UriComponentsBuilder.fromPath("/fo%2o").build(true);
        diff --git a/spring-web/src/test/java/org/springframework/web/util/UriTemplateTests.java b/spring-web/src/test/java/org/springframework/web/util/UriTemplateTests.java
        index ba2d7a796d2f..557ba7ca9ff6 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/UriTemplateTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/UriTemplateTests.java
        @@ -80,7 +80,7 @@ public void expandMapNonString() throws Exception {
         		URI result = template.expand(uriVariables);
         		assertEquals("Invalid expanded template", new URI("http://example.com/hotels/1/bookings/42"), result);
         	}
        -    
        +
             @Test
             public void expandMapEncoded() throws Exception {
                 Map uriVariables = Collections.singletonMap("hotel", "Z\u00fcrich");
        @@ -113,7 +113,7 @@ public void matches() throws Exception {
         		assertFalse("UriTemplate matches", template.matches(""));
         		assertFalse("UriTemplate matches", template.matches(null));
         	}
        -	
        +
         	@Test
         	public void matchesCustomRegex() throws Exception {
         		UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel:\\d+}");
        diff --git a/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java
        index 444b7ec43c2a..29585bb05d59 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -29,7 +29,7 @@ public class UriUtilsTests {
         
         	private static final String ENC = "UTF-8";
         
        -	
        +
         
         	@Test
         	public void encodeScheme() throws UnsupportedEncodingException {
        diff --git a/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java b/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java
        index 40aeff33a5c5..4088cac9b004 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java
        @@ -368,4 +368,4 @@ public void getOriginatingQueryStringIsNull() {
         		assertNull(this.helper.getOriginatingQueryString(request));
         	}
         
        -}
        \ No newline at end of file
        +}
        diff --git a/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
        index 437e1db6042e..d4510b3984d6 100644
        --- a/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
        +++ b/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2008 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java
        index bb3e0e85b795..5272c45b2501 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java
        @@ -577,7 +577,7 @@ protected  List getDefaultStrategies(ApplicationContext context, Class
         			List strategies = new ArrayList(classNames.length);
         			for (String className : classNames) {
         				try {
        -					Class clazz = ClassUtils.forName(className, DispatcherPortlet.class.getClassLoader());
        +					Class clazz = ClassUtils.forName(className, DispatcherPortlet.class.getClassLoader());
         					Object strategy = createDefaultStrategy(context, clazz);
         					strategies.add((T) strategy);
         				}
        @@ -1143,7 +1143,7 @@ protected void render(ModelAndView mv, PortletRequest request, MimeResponse resp
         	 * (typically in case of problems creating an actual View object)
         	 * @see ViewResolver#resolveViewName
         	 */
        -	protected View resolveViewName(String viewName, Map model, PortletRequest request) throws Exception {
        +	protected View resolveViewName(String viewName, Map model, PortletRequest request) throws Exception {
         		for (ViewResolver viewResolver : this.viewResolvers) {
         			View view = viewResolver.resolveViewName(viewName, request.getLocale());
         			if (view != null) {
        @@ -1163,7 +1163,7 @@ protected View resolveViewName(String viewName, Map model, PortletRequest reques
         	 * @param response current portlet render/resource response
         	 * @throws Exception if there's a problem rendering the view
         	 */
        -	protected void doRender(View view, Map model, PortletRequest request, MimeResponse response) throws Exception {
        +	protected void doRender(View view, Map model, PortletRequest request, MimeResponse response) throws Exception {
         		// Expose Portlet ApplicationContext to view objects.
         		request.setAttribute(ViewRendererServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, getPortletApplicationContext());
         
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java
        index ce8d4ad18b32..fde1aaa2e166 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/FrameworkPortlet.java
        @@ -107,7 +107,7 @@ public abstract class FrameworkPortlet extends GenericPortletBean
         	 * Default context class for FrameworkPortlet.
         	 * @see org.springframework.web.portlet.context.XmlPortletApplicationContext
         	 */
        -	public static final Class DEFAULT_CONTEXT_CLASS = XmlPortletApplicationContext.class;
        +	public static final Class DEFAULT_CONTEXT_CLASS = XmlPortletApplicationContext.class;
         
         	/**
         	 * Suffix for Portlet ApplicationContext namespaces. If a portlet of this class is
        @@ -130,7 +130,7 @@ public abstract class FrameworkPortlet extends GenericPortletBean
         
         
         	/** Portlet ApplicationContext implementation class to use */
        -	private Class contextClass = DEFAULT_CONTEXT_CLASS;
        +	private Class contextClass = DEFAULT_CONTEXT_CLASS;
         
         	/** Namespace for this portlet */
         	private String namespace;
        @@ -163,14 +163,14 @@ public abstract class FrameworkPortlet extends GenericPortletBean
         	 * must also implement ConfigurablePortletApplicationContext.
         	 * @see #createPortletApplicationContext
         	 */
        -	public void setContextClass(Class contextClass) {
        +	public void setContextClass(Class contextClass) {
         		this.contextClass = contextClass;
         	}
         
         	/**
         	 * Return the custom context class.
         	 */
        -	public Class getContextClass() {
        +	public Class getContextClass() {
         		return this.contextClass;
         	}
         
        @@ -609,9 +609,9 @@ protected String getUsernameForRequest(PortletRequest request) {
         		if (userName != null) {
         			return userName;
         		}
        -		
        +
         		// Try the Portlet USER_INFO map.
        -		Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
        +		Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
         		if (userInfo != null) {
         			for (int i = 0, n = this.userinfoUsernameAttributes.length; i < n; i++) {
         				userName = (String) userInfo.get(this.userinfoUsernameAttributes[i]);
        @@ -620,7 +620,7 @@ protected String getUsernameForRequest(PortletRequest request) {
         				}
         			}
         		}
        -		
        +
         		// Nothing worked...
         		return null;
         	}
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/GenericPortletBean.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/GenericPortletBean.java
        index 1006cd340547..310210130353 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/GenericPortletBean.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/GenericPortletBean.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -74,7 +74,7 @@ public abstract class GenericPortletBean extends GenericPortlet
         	/** Logger available to subclasses */
         	protected final Log logger = LogFactory.getLog(getClass());
         
        -	/** 
        +	/**
         	 * Set of required properties (Strings) that must be supplied as
         	 * config parameters to this portlet.
         	 */
        @@ -105,7 +105,7 @@ public final void init() throws PortletException {
         		if (logger.isInfoEnabled()) {
         			logger.info("Initializing portlet '" + getPortletName() + "'");
         		}
        -		
        +
         		// Set bean properties from init parameters.
         		try {
         			PropertyValues pvs = new PortletConfigPropertyValues(getPortletConfig(), this.requiredProperties);
        @@ -127,7 +127,7 @@ public final void init() throws PortletException {
         			logger.info("Portlet '" + getPortletName() + "' configured successfully");
         		}
         	}
        -	
        +
         	/**
         	 * Initialize the BeanWrapper for this GenericPortletBean,
         	 * possibly with custom editors.
        @@ -215,13 +215,13 @@ private static class PortletConfigPropertyValues extends MutablePropertyValues {
         		 */
         		private PortletConfigPropertyValues(PortletConfig config, Set requiredProperties)
         			throws PortletException {
        -				
        +
         			Set missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
         					new HashSet(requiredProperties) : null;
         
        -			Enumeration en = config.getInitParameterNames();
        +			Enumeration en = config.getInitParameterNames();
         			while (en.hasMoreElements()) {
        -				String property = (String) en.nextElement();
        +				String property = en.nextElement();
         				Object value = config.getInitParameter(property);
         				addPropertyValue(new PropertyValue(property, value));
         				if (missingProps != null) {
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerAdapter.java
        index c1e618fa6d4f..ae952850f17b 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerAdapter.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerAdapter.java
        @@ -48,7 +48,7 @@
          * @see org.springframework.web.portlet.mvc.SimpleControllerHandlerAdapter
          */
         public interface HandlerAdapter {
        -	
        +
         	/**
         	 * Given a handler instance, return whether or not this HandlerAdapter can
         	 * support it. Typical HandlerAdapters will base the decision on the handler
        @@ -60,7 +60,7 @@ public interface HandlerAdapter {
         	 * @param handler handler object to check
         	 * @return whether or not this object can use the given handler
         	 */
        -	boolean supports(Object handler); 
        +	boolean supports(Object handler);
         
         	/**
         	 * Use the given handler to handle this action request.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java
        index a09d13d5b707..c952cc05fb6d 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerInterceptor.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerMapping.java
        index 7c79d8482ffb..cc0913e9439a 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerMapping.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/HandlerMapping.java
        @@ -54,7 +54,7 @@
          * @see org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping
          */
         public interface HandlerMapping {
        -	
        +
         	/**
         	 * Return a handler and any interceptors for this request. The choice may be made
         	 * on portlet mode, session state, or any factor the implementing class chooses.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/ModelAndViewDefiningException.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/ModelAndViewDefiningException.java
        index dcb2a64e4eaa..ce35bb669f64 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/ModelAndViewDefiningException.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/ModelAndViewDefiningException.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
        index fa139ff53d63..86dd7ac2ffef 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
        @@ -55,7 +55,7 @@
          * @see org.springframework.web.portlet.DispatcherPortlet
          */
         public abstract class PortletApplicationContextUtils {
        -	
        +
         	/**
         	 * Find the root WebApplicationContext for this portlet application, which is
         	 * typically loaded via ContextLoaderListener or ContextLoaderServlet.
        @@ -156,16 +156,16 @@ static void registerEnvironmentBeans(
         		if (!bf.containsBean(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME)) {
         			Map parameterMap = new HashMap();
         			if (pc != null) {
        -				Enumeration paramNameEnum = pc.getInitParameterNames();
        +				Enumeration paramNameEnum = pc.getInitParameterNames();
         				while (paramNameEnum.hasMoreElements()) {
        -					String paramName = (String) paramNameEnum.nextElement();
        +					String paramName = paramNameEnum.nextElement();
         					parameterMap.put(paramName, pc.getInitParameter(paramName));
         				}
         			}
         			if (config != null) {
        -				Enumeration paramNameEnum = config.getInitParameterNames();
        +				Enumeration paramNameEnum = config.getInitParameterNames();
         				while (paramNameEnum.hasMoreElements()) {
        -					String paramName = (String) paramNameEnum.nextElement();
        +					String paramName = paramNameEnum.nextElement();
         					parameterMap.put(paramName, config.getInitParameter(paramName));
         				}
         			}
        @@ -176,9 +176,9 @@ static void registerEnvironmentBeans(
         		if (!bf.containsBean(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME)) {
         			Map attributeMap = new HashMap();
         			if (pc != null) {
        -				Enumeration attrNameEnum = pc.getAttributeNames();
        +				Enumeration attrNameEnum = pc.getAttributeNames();
         				while (attrNameEnum.hasMoreElements()) {
        -					String attrName = (String) attrNameEnum.nextElement();
        +					String attrName = attrNameEnum.nextElement();
         					attributeMap.put(attrName, pc.getAttribute(attrName));
         				}
         			}
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationObjectSupport.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationObjectSupport.java
        index 574b4d80d7c7..2f074204e9ec 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationObjectSupport.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationObjectSupport.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2005 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java
        index 2a3fee97f0f3..7e64034a49c5 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2011 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java
        index 3fa1a56a6a43..5b0b1e40aef4 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java
        @@ -1,12 +1,12 @@
         /*
          * Copyright 2002-2011 the original author or authors.
        - * 
        + *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
          * You may obtain a copy of the License at
        - * 
        + *
          *      http://www.apache.org/licenses/LICENSE-2.0
        - * 
        + *
          * Unless required by applicable law or agreed to in writing, software
          * distributed under the License is distributed on an "AS IS" BASIS,
          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAwareProcessor.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAwareProcessor.java
        index 1daacb553ece..07e60b45ad8f 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAwareProcessor.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAwareProcessor.java
        @@ -49,7 +49,7 @@ public class PortletContextAwareProcessor implements BeanPostProcessor {
         	public PortletContextAwareProcessor(PortletContext portletContext) {
         		this(portletContext, null);
         	}
        -	
        +
         	/**
         	 * Create a new PortletContextAwareProcessor for the given config.
         	 */
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextResourcePatternResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextResourcePatternResolver.java
        index a62ddb129276..ade995f9342d 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextResourcePatternResolver.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextResourcePatternResolver.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2008 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -100,11 +100,11 @@ protected Set doFindPathMatchingFileResources(Resource rootDirResource
         	protected void doRetrieveMatchingPortletContextResources(
         			PortletContext portletContext, String fullPattern, String dir, Set result) throws IOException {
         
        -		Set candidates = portletContext.getResourcePaths(dir);
        +		Set candidates = portletContext.getResourcePaths(dir);
         		if (candidates != null) {
         			boolean dirDepthNotFixed = fullPattern.contains("**");
        -			for (Iterator it = candidates.iterator(); it.hasNext();) {
        -				String currPath = (String) it.next();
        +			for (Iterator it = candidates.iterator(); it.hasNext();) {
        +				String currPath = it.next();
         				if (currPath.endsWith("/") &&
         						(dirDepthNotFixed ||
         						StringUtils.countOccurrencesOf(currPath, "/") <= StringUtils.countOccurrencesOf(fullPattern, "/"))) {
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextScope.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextScope.java
        index 4f3e0178b957..1ad8a39a3ef8 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextScope.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletContextScope.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletRequestAttributes.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletRequestAttributes.java
        index b6217269b6f5..7641e32b3628 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletRequestAttributes.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletRequestAttributes.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2009 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletWebRequest.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletWebRequest.java
        index d407f40fa9ec..32f7e5997123 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletWebRequest.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletWebRequest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2011 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -76,17 +76,14 @@ public Object getNativeResponse() {
         		return getResponse();
         	}
         
        -	@SuppressWarnings("unchecked")
         	public  T getNativeRequest(Class requiredType) {
         		return PortletUtils.getNativeRequest(getRequest(), requiredType);
         	}
         
        -	@SuppressWarnings("unchecked")
         	public  T getNativeResponse(Class requiredType) {
         		return PortletUtils.getNativeResponse(getResponse(), requiredType);
         	}
         
        -
         	public String getHeader(String headerName) {
         		return getRequest().getProperty(headerName);
         	}
        @@ -111,7 +108,7 @@ public String[] getParameterValues(String paramName) {
         	public Iterator getParameterNames() {
         		return CollectionUtils.toIterator(getRequest().getParameterNames());
         	}
        -	
        +
         	public Map getParameterMap() {
         		return getRequest().getParameterMap();
         	}
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/StaticPortletApplicationContext.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/StaticPortletApplicationContext.java
        index 7452f6b34cde..ce44602bb6db 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/StaticPortletApplicationContext.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/StaticPortletApplicationContext.java
        @@ -51,7 +51,7 @@ public class StaticPortletApplicationContext extends StaticApplicationContext
         		implements ConfigurablePortletApplicationContext {
         
         	private ServletContext servletContext;
        -	
        +
         	private PortletContext portletContext;
         
         	private PortletConfig portletConfig;
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerExceptionResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerExceptionResolver.java
        index c03ab5c50772..1b3f2fed1a4e 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerExceptionResolver.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerExceptionResolver.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2010 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        @@ -48,9 +48,9 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
         
         	private int order = Ordered.LOWEST_PRECEDENCE;
         
        -	private Set mappedHandlers;
        +	private Set mappedHandlers;
         
        -	private Class[] mappedHandlerClasses;
        +	private Class[] mappedHandlerClasses;
         
         	private Log warnLogger;
         
        @@ -74,7 +74,7 @@ public int getOrder() {
         	 * error view will be used as fallback for all exceptions; any further
         	 * HandlerExceptionResolvers in the chain will be ignored in this case.
         	 */
        -	public void setMappedHandlers(Set mappedHandlers) {
        +	public void setMappedHandlers(Set mappedHandlers) {
         		this.mappedHandlers = mappedHandlers;
         	}
         
        @@ -89,7 +89,7 @@ public void setMappedHandlers(Set mappedHandlers) {
         	 * any further HandlerExceptionResolvers in the chain will be ignored in
         	 * this case.
         	 */
        -	public void setMappedHandlerClasses(Class[] mappedHandlerClasses) {
        +	public void setMappedHandlerClasses(Class[] mappedHandlerClasses) {
         		this.mappedHandlerClasses = mappedHandlerClasses;
         	}
         
        @@ -166,7 +166,7 @@ protected boolean shouldApplyTo(PortletRequest request, Object handler) {
         				return true;
         			}
         			if (this.mappedHandlerClasses != null) {
        -				for (Class mappedClass : this.mappedHandlerClasses) {
        +				for (Class mappedClass : this.mappedHandlerClasses) {
         					if (mappedClass.isInstance(handler)) {
         						return true;
         					}
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerMapping.java
        index f30d5655fde1..5f88d909cb30 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerMapping.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractHandlerMapping.java
        @@ -139,7 +139,7 @@ protected void initApplicationContext() throws BeansException {
         	 * allowing to add further interceptors before as well as after the existing
         	 * interceptors
         	 */
        -	protected void extendInterceptors(List interceptors) {
        +	protected void extendInterceptors(List interceptors) {
         	}
         
         	/**
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractMapBasedHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractMapBasedHandlerMapping.java
        index 8a803a5038eb..1f1765223d4d 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractMapBasedHandlerMapping.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/AbstractMapBasedHandlerMapping.java
        @@ -185,7 +185,7 @@ protected void registerHandler(K lookupKey, Object handler, PortletRequestMappin
         	/**
         	 * Predicate interface for determining a match with a given request.
         	 */
        -	protected interface PortletRequestMappingPredicate extends Comparable {
        +	protected interface PortletRequestMappingPredicate extends Comparable {
         
         		/**
         		 * Determine whether the given request matches this predicate.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterHandlerMapping.java
        index c8f712050fd4..85880fffce34 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterHandlerMapping.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterHandlerMapping.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright 2002-2008 the original author or authors.
        + * Copyright 2002-2012 the original author or authors.
          *
          * Licensed under the Apache License, Version 2.0 (the "License");
          * you may not use this file except in compliance with the License.
        diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterMappingInterceptor.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterMappingInterceptor.java
        index cd5f15701155..700ef95078a5 100644
        --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterMappingInterceptor.java
        +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/ParameterMappingInterceptor.java
        @@ -26,7 +26,7 @@
          * 

        This can be useful when using {@link ParameterHandlerMapping ParameterHandlerMapping} * or {@link PortletModeParameterHandlerMapping PortletModeParameterHandlerMapping}. * It will ensure that the parameter that was used to map the ActionRequest - * to a handler will be forwarded to the RenderRequest so that it will also be + * to a handler will be forwarded to the RenderRequest so that it will also be * mapped the same way. * *

        When using this Interceptor, you can still change the value of the mapping parameter diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletContentGenerator.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletContentGenerator.java index 318c5d1ceb65..b23756f87c4e 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletContentGenerator.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletContentGenerator.java @@ -95,7 +95,7 @@ protected final void check(PortletRequest request, PortletResponse response) thr /** * Check and prepare the given request and response according to the settings - * of this generator. Checks for a required session, and applies the number of + * of this generator. Checks for a required session, and applies the number of * cache seconds configured for this generator (if it is a render request/response). * @param request current portlet request * @param response current portlet response @@ -109,7 +109,7 @@ protected final void checkAndPrepare(PortletRequest request, MimeResponse respon /** * Check and prepare the given request and response according to the settings - * of this generator. Checks for a required session, and applies the given + * of this generator. Checks for a required session, and applies the given * number of cache seconds (if it is a render request/response). * @param request current portlet request * @param response current portlet response diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeHandlerMapping.java index 0bcdcc8b413d..0ba3b79c8959 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeHandlerMapping.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMapping.java index cde1399fe889..2b8f51e49133 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMapping.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletRequestMethodNotSupportedException.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletRequestMethodNotSupportedException.java index b9c9718a6e23..cb7257a0593c 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletRequestMethodNotSupportedException.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/PortletRequestMethodNotSupportedException.java @@ -78,4 +78,4 @@ public String[] getSupportedMethods() { return this.supportedMethods; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java index accdd3adfccb..feafc65817ef 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -156,7 +156,7 @@ protected String findMatchingViewName(Properties exceptionMappings, Exception ex String viewName = null; String dominantMapping = null; int deepest = Integer.MAX_VALUE; - for (Enumeration names = exceptionMappings.propertyNames(); names.hasMoreElements();) { + for (Enumeration names = exceptionMappings.propertyNames(); names.hasMoreElements();) { String exceptionMapping = (String) names.nextElement(); int depth = getDepth(exceptionMapping, ex); if (depth >= 0 && depth < deepest) { @@ -183,7 +183,7 @@ protected int getDepth(String exceptionMapping, Exception ex) { return getDepth(exceptionMapping, ex.getClass(), 0); } - private int getDepth(String exceptionMapping, Class exceptionClass, int depth) { + private int getDepth(String exceptionMapping, Class exceptionClass, int depth) { if (exceptionClass.getName().contains(exceptionMapping)) { // Found it! return depth; diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletHandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletHandlerAdapter.java index b8e85ab7450d..7d1eacd87f89 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletHandlerAdapter.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletHandlerAdapter.java @@ -59,7 +59,7 @@ * @see org.springframework.web.portlet.mvc.PortletWrappingController */ public class SimplePortletHandlerAdapter implements HandlerAdapter, PortletContextAware { - + private PortletContext portletContext; diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletPostProcessor.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletPostProcessor.java index b5687fd6e765..4f6191254faa 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletPostProcessor.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/SimplePortletPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java index c480ac731c40..f2e8442c613e 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/CommonsPortletMultipartResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/DefaultMultipartActionRequest.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/DefaultMultipartActionRequest.java index ca644eaddcda..54319e8e7a0e 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/DefaultMultipartActionRequest.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/DefaultMultipartActionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,7 +91,7 @@ public List getFiles(String name) { return Collections.emptyList(); } } - + public Map getFileMap() { return getMultipartFiles().toSingleValueMap(); @@ -104,9 +104,9 @@ public MultiValueMap getMultiFileMap() { @Override public Enumeration getParameterNames() { Set paramNames = new HashSet(); - Enumeration paramEnum = super.getParameterNames(); + Enumeration paramEnum = super.getParameterNames(); while (paramEnum.hasMoreElements()) { - paramNames.add((String) paramEnum.nextElement()); + paramNames.add(paramEnum.nextElement()); } paramNames.addAll(getMultipartParameters().keySet()); return Collections.enumeration(paramNames); @@ -131,7 +131,6 @@ public String[] getParameterValues(String name) { } @Override - @SuppressWarnings("unchecked") public Map getParameterMap() { Map paramMap = new HashMap(); paramMap.putAll(super.getParameterMap()); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/PortletMultipartResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/PortletMultipartResolver.java index 0370c8b77b44..4add8c5cc81c 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/PortletMultipartResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/multipart/PortletMultipartResolver.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2007 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractCommandController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractCommandController.java index acfe87e30e52..b2425a755d20 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractCommandController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractCommandController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ public AbstractCommandController() { * Create a new AbstractCommandController. * @param commandClass class of the command bean */ - public AbstractCommandController(Class commandClass) { + public AbstractCommandController(Class commandClass) { setCommandClass(commandClass); } @@ -82,7 +82,7 @@ public AbstractCommandController(Class commandClass) { * @param commandClass class of the command bean * @param commandName name of the command bean */ - public AbstractCommandController(Class commandClass, String commandName) { + public AbstractCommandController(Class commandClass, String commandName) { setCommandClass(commandClass); setCommandName(commandName); } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java index fa56a66a3179..f8721abb7608 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractController.java @@ -204,7 +204,7 @@ public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse re if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) { return null; } - + // Delegate to PortletContentGenerator for checking and preparing. checkAndPrepare(request, response); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractFormController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractFormController.java index 5b081df6dd1c..f3fe7005c3f2 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractFormController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractFormController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -638,7 +638,7 @@ protected final BindException getErrorsForNewForm(RenderRequest request) throws binder.bind(request); onBindOnNewForm(request, command, errors); } - + // Return BindException object that resulted from binding. return errors; } @@ -690,7 +690,7 @@ protected final Object getCommand(PortletRequest request) throws Exception { if (!isSessionForm()) { return formBackingObject(request); } - + // Session-form mode: retrieve form object from portlet session attribute. PortletSession session = request.getPortletSession(false); if (session == null) { @@ -804,7 +804,7 @@ protected final ModelAndView showForm(RenderRequest request, BindException error * @see #showForm(RenderRequest, BindException, String) * @see #showForm(RenderRequest, RenderResponse, BindException) */ - protected final ModelAndView showForm(RenderRequest request, BindException errors, String viewName, Map controlModel) + protected final ModelAndView showForm(RenderRequest request, BindException errors, String viewName, Map controlModel) throws Exception { // In session form mode, re-expose form object as portlet session attribute. @@ -820,10 +820,10 @@ protected final ModelAndView showForm(RenderRequest request, BindException error // Fetch errors model as starting point, containing form object under // "commandName", and corresponding Errors instance under internal key. - Map model = errors.getModel(); - + Map model = errors.getModel(); + // Merge reference data into model, if any. - Map referenceData = referenceData(request, errors.getTarget(), errors); + Map referenceData = referenceData(request, errors.getTarget(), errors); if (referenceData != null) { model.putAll(referenceData); } @@ -849,7 +849,7 @@ protected final ModelAndView showForm(RenderRequest request, BindException error * @throws Exception in case of invalid state or arguments * @see ModelAndView */ - protected Map referenceData(PortletRequest request, Object command, Errors errors) throws Exception { + protected Map referenceData(PortletRequest request, Object command, Errors errors) throws Exception { return null; } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractWizardFormController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractWizardFormController.java index ef52eec34581..b37cf7e4c44c 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractWizardFormController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/AbstractWizardFormController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -271,7 +271,7 @@ protected boolean isFormSubmission(PortletRequest request) { * Calls page-specific referenceData method. */ @Override - protected final Map referenceData(PortletRequest request, Object command, Errors errors) + protected final Map referenceData(PortletRequest request, Object command, Errors errors) throws Exception { return referenceData(request, command, errors, getCurrentPage(request)); @@ -291,7 +291,7 @@ protected final Map referenceData(PortletRequest request, Object command, Errors * @see #referenceData(PortletRequest, int) * @see org.springframework.web.portlet.ModelAndView */ - protected Map referenceData(PortletRequest request, Object command, Errors errors, int page) + protected Map referenceData(PortletRequest request, Object command, Errors errors, int page) throws Exception { return referenceData(request, page); @@ -308,7 +308,7 @@ protected Map referenceData(PortletRequest request, Object command, Errors error * @throws Exception in case of invalid state or arguments * @see org.springframework.web.portlet.ModelAndView */ - protected Map referenceData(PortletRequest request, int page) throws Exception { + protected Map referenceData(PortletRequest request, int page) throws Exception { return null; } @@ -342,7 +342,7 @@ protected final ModelAndView showPage(RenderRequest request, BindException error if (logger.isDebugEnabled()) { logger.debug("Showing wizard page " + page + " for form bean '" + getCommandName() + "'"); } - + // Set page session attribute, expose overriding request attribute. Integer pageInteger = new Integer(page); String pageAttrName = getPageSessionAttributeName(request); @@ -353,9 +353,9 @@ protected final ModelAndView showPage(RenderRequest request, BindException error request.getPortletSession().setAttribute(pageAttrName, pageInteger); } request.setAttribute(pageAttrName, pageInteger); - + // Set page request attribute for evaluation by views. - Map controlModel = new HashMap(); + Map controlModel = new HashMap(); if (this.pageAttribute != null) { controlModel.put(this.pageAttribute, new Integer(page)); } @@ -647,7 +647,7 @@ protected final void processFormSubmission( request.getPortletSession().removeAttribute(pageAttrName); } request.setAttribute(pageAttrName, new Integer(currentPage)); - + // cancel? if (isCancelRequest(request)) { if (logger.isDebugEnabled()) { diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/BaseCommandController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/BaseCommandController.java index 162843b29b9c..66fb6b140a06 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/BaseCommandController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/BaseCommandController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ *

        This controller is the base for all controllers wishing to populate * JavaBeans based on request parameters, validate the content of such * JavaBeans using {@link Validator Validators} and use custom editors (in the form of - * {@link java.beans.PropertyEditor PropertyEditors}) to transform + * {@link java.beans.PropertyEditor PropertyEditors}) to transform * objects into strings and vice versa, for example. Three notions are mentioned here:

        * *

        Command class:
        @@ -54,7 +54,7 @@ * Upon receiving a request, any BaseCommandController will attempt to fill the * command object using the request parameters. This is done using the typical * and well-known JavaBeans property notation. When a request parameter named - * 'firstName' exists, the framework will attempt to call + * 'firstName' exists, the framework will attempt to call * setFirstName([value]) passing the value of the parameter. Nested properties * are of course supported. For instance a parameter named 'address.city' * will result in a getAddress().setCity([value]) call on the @@ -155,14 +155,14 @@ public abstract class BaseCommandController extends AbstractController { * session is that we have no way of knowing when we are done re-rendering * the request and so we don't know when we can remove the objects from * the session. So we will end up polluting the session with old objects - * when we finally leave the render of this controller and move on to + * when we finally leave the render of this controller and move on to * somthing else. To minimize the pollution, we will use a static string * value as the session attribute name. At least this way we are only ever * leaving one orphaned set behind. The methods that return these names * can be overridden if you want to use a different method, but be aware * of the session pollution that may occur. */ - private static final String RENDER_COMMAND_SESSION_ATTRIBUTE = + private static final String RENDER_COMMAND_SESSION_ATTRIBUTE = "org.springframework.web.portlet.mvc.RenderCommand"; private static final String RENDER_ERRORS_SESSION_ATTRIBUTE = @@ -172,13 +172,13 @@ public abstract class BaseCommandController extends AbstractController { private String commandName = DEFAULT_COMMAND_NAME; - - private Class commandClass; - + + private Class commandClass; + private Validator[] validators; - + private boolean validateOnBinding = true; - + private MessageCodesResolver messageCodesResolver; private BindingErrorProcessor bindingErrorProcessor; @@ -207,14 +207,14 @@ public final String getCommandName() { * Set the command class for this controller. * An instance of this class gets populated and validated on each request. */ - public final void setCommandClass(Class commandClass) { + public final void setCommandClass(Class commandClass) { this.commandClass = commandClass; } /** * Return the command class for this controller. */ - public final Class getCommandClass() { + public final Class getCommandClass() { return this.commandClass; } @@ -405,7 +405,7 @@ protected final Object createCommand() throws Exception { protected final boolean checkCommand(Object command) { return (this.commandClass == null || this.commandClass.isInstance(command)); } - + /** * Bind the parameters of the given request to the given command object. @@ -416,7 +416,7 @@ protected final boolean checkCommand(Object command) { */ protected final PortletRequestDataBinder bindAndValidate(PortletRequest request, Object command) throws Exception { - + PortletRequestDataBinder binder = createBinder(request, command); if (!suppressBinding(request)) { binder.bind(request); @@ -464,7 +464,7 @@ protected boolean suppressBinding(PortletRequest request) { */ protected PortletRequestDataBinder createBinder(PortletRequest request, Object command) throws Exception { - + PortletRequestDataBinder binder = new PortletRequestDataBinder(command, getCommandName()); prepareBinder(binder); initBinder(request, binder); @@ -598,7 +598,7 @@ protected String getRenderCommandSessionAttributeName() { return RENDER_COMMAND_SESSION_ATTRIBUTE; } - /** + /** * Return the name of the session attribute that holds * the render phase command object for this form controller. * @return the name of the render phase command object session attribute diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/Controller.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/Controller.java index 356898f97ba2..c8f3096eb87d 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/Controller.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/Controller.java @@ -24,8 +24,8 @@ import org.springframework.web.portlet.ModelAndView; /** - * Base portlet Controller interface, representing a component that receives - * RenderRequest/RenderResponse and ActionRequest/ActionResponse like a + * Base portlet Controller interface, representing a component that receives + * RenderRequest/RenderResponse and ActionRequest/ActionResponse like a * Portlet but is able to participate in an MVC workflow. * *

        Any implementation of the portlet Controller interface should be a @@ -46,7 +46,7 @@ * So actually, these method are the main entrypoint for the * {@link org.springframework.web.portlet.DispatcherPortlet DispatcherPortlet} * which delegates requests to controllers.

        - * + * *

        So basically any direct implementation of the Controller interface * just handles RenderRequests/ActionRequests and should return a ModelAndView, to be * further used by the DispatcherPortlet. Any additional functionality such as diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java index 5fdfd335968c..0a39a2fd0ca8 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/ParameterizableViewController.java @@ -63,7 +63,7 @@ * @since 2.0 */ public class ParameterizableViewController extends AbstractController { - + private String viewName; diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/PortletWrappingController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/PortletWrappingController.java index ad8d452ee36f..1770375444a8 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/PortletWrappingController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/PortletWrappingController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,7 +89,7 @@ public class PortletWrappingController extends AbstractController private PortletConfig portletConfig; - private Class portletClass; + private Class portletClass; private String portletName; @@ -126,7 +126,7 @@ public void setPortletConfig(PortletConfig portletConfig) { * Needs to implement javax.portlet.Portlet. * @see javax.portlet.Portlet */ - public void setPortletClass(Class portletClass) { + public void setPortletClass(Class portletClass) { this.portletClass = portletClass; } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/SimpleFormController.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/SimpleFormController.java index 97e622bef4c0..3d6b2adc7996 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/SimpleFormController.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/SimpleFormController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -223,7 +223,7 @@ protected ModelAndView showForm(RenderRequest request, RenderResponse response, * @throws Exception in case of invalid state or arguments * @see #setFormView */ - protected ModelAndView showForm(RenderRequest request, RenderResponse response, BindException errors, Map controlModel) + protected ModelAndView showForm(RenderRequest request, RenderResponse response, BindException errors, Map controlModel) throws Exception { return showForm(request, errors, getFormView(), controlModel); @@ -242,7 +242,7 @@ protected ModelAndView showForm(RenderRequest request, RenderResponse response, * @see ModelAndView */ @Override - protected Map referenceData(PortletRequest request, Object command, Errors errors) throws Exception { + protected Map referenceData(PortletRequest request, Object command, Errors errors) throws Exception { return referenceData(request); } @@ -257,7 +257,7 @@ protected Map referenceData(PortletRequest request, Object command, Errors error * @see #referenceData(PortletRequest, Object, Errors) * @see ModelAndView */ - protected Map referenceData(PortletRequest request) throws Exception { + protected Map referenceData(PortletRequest request) throws Exception { return null; } diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index da4991220ebe..4dbeb91f221a 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -374,7 +374,7 @@ private ModelAndView invokeHandlerMethod( if (response instanceof EventResponse) { // Update the existing model, if any, when responding to an event - // whereas we're replacing the model in case of an action response. - Map existingModel = (Map) request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE); + Map existingModel = (Map) request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE); if (existingModel != null) { existingModel.putAll(implicitModel); modelToStore = existingModel; @@ -394,7 +394,7 @@ private ModelAndView invokeHandlerMethod( * Build a HandlerMethodResolver for the given handler type. */ private PortletHandlerMethodResolver getMethodResolver(Object handler) { - Class handlerClass = ClassUtils.getUserClass(handler); + Class handlerClass = ClassUtils.getUserClass(handler); PortletHandlerMethodResolver resolver = this.methodResolverCache.get(handlerClass); if (resolver == null) { synchronized (this.methodResolverCache) { @@ -547,7 +547,7 @@ public PortletHandlerMethodInvoker(HandlerMethodResolver resolver) { } @Override - protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception { + protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception { throw new MissingPortletRequestParameterException(paramName, paramType.getSimpleName()); } @@ -584,7 +584,7 @@ protected Object resolveDefaultValue(String value) { } @Override - protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) + protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) throws Exception { PortletRequest portletRequest = webRequest.getNativeRequest(PortletRequest.class); @@ -679,7 +679,7 @@ else if (Event.class.equals(parameterType)) { } @SuppressWarnings("unchecked") - public ModelAndView getModelAndView(Method handlerMethod, Class handlerType, Object returnValue, ExtendedModelMap implicitModel, + public ModelAndView getModelAndView(Method handlerMethod, Class handlerType, Object returnValue, ExtendedModelMap implicitModel, PortletWebRequest webRequest) { // Invoke custom resolvers if present... if (customModelAndViewResolvers != null) { @@ -718,7 +718,7 @@ else if (handlerMethod.isAnnotationPresent(ModelAttribute.class)) { return new ModelAndView().addAllObjects(implicitModel); } else if (returnValue instanceof Map) { - return new ModelAndView().addAllObjects(implicitModel).addAllObjects((Map) returnValue); + return new ModelAndView().addAllObjects(implicitModel).addAllObjects((Map) returnValue); } else if (returnValue instanceof String) { return new ModelAndView((String) returnValue).addAllObjects(implicitModel); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java index 0f763828c37b..fbd6a40dd118 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java @@ -385,7 +385,7 @@ else if (returnValue instanceof Model) { return new ModelAndView().addAllObjects(((Model) returnValue).asMap()); } else if (returnValue instanceof Map) { - return new ModelAndView().addAllObjects((Map) returnValue); + return new ModelAndView().addAllObjects((Map) returnValue); } else if (returnValue instanceof View) { return new ModelAndView(returnValue); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java index 8d5c00dce531..9ccdfe46d826 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java @@ -92,6 +92,9 @@ */ public class DefaultAnnotationHandlerMapping extends AbstractMapBasedHandlerMapping { + private final Map, RequestMapping> cachedMappings = new HashMap, RequestMapping>(); + + /** * Calls the registerHandlers method in addition * to the superclass's initialization. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationMappingUtils.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationMappingUtils.java index f1796355cf43..3d29c742f660 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationMappingUtils.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationMappingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/util/PortletUtils.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/util/PortletUtils.java index 2beb0352b86b..89c90ebffc87 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/util/PortletUtils.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/util/PortletUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -194,7 +194,7 @@ public static void setSessionAttribute(PortletRequest request, String name, Obje /** * Get the specified session attribute under the {@link javax.portlet.PortletSession#PORTLET_SCOPE}, - * creating and setting a new attribute if no existing found. The given class + * creating and setting a new attribute if no existing found. The given class * needs to have a public no-arg constructor. * Useful for on-demand state objects in a web tier, like shopping carts. * @param session current portlet session @@ -203,7 +203,7 @@ public static void setSessionAttribute(PortletRequest request, String name, Obje * @return the value of the session attribute, newly created if not found * @throws IllegalArgumentException if the session attribute could not be instantiated */ - public static Object getOrCreateSessionAttribute(PortletSession session, String name, Class clazz) + public static Object getOrCreateSessionAttribute(PortletSession session, String name, Class clazz) throws IllegalArgumentException { return getOrCreateSessionAttribute(session, name, clazz, PortletSession.PORTLET_SCOPE); @@ -211,7 +211,7 @@ public static Object getOrCreateSessionAttribute(PortletSession session, String /** * Get the specified session attribute in the given scope, - * creating and setting a new attribute if no existing found. The given class + * creating and setting a new attribute if no existing found. The given class * needs to have a public no-arg constructor. * Useful for on-demand state objects in a web tier, like shopping carts. * @param session current portlet session @@ -221,7 +221,7 @@ public static Object getOrCreateSessionAttribute(PortletSession session, String * @return the value of the session attribute, newly created if not found * @throws IllegalArgumentException if the session attribute could not be instantiated */ - public static Object getOrCreateSessionAttribute(PortletSession session, String name, Class clazz, int scope) + public static Object getOrCreateSessionAttribute(PortletSession session, String name, Class clazz, int scope) throws IllegalArgumentException { Assert.notNull(session, "Session must not be null"); @@ -369,7 +369,7 @@ public static boolean hasSubmitParameter(PortletRequest request, String name) { } /** - * Return the full name of a specific input type="submit" parameter + * Return the full name of a specific input type="submit" parameter * if it was sent in the request, either via a button (directly with name) * or via an image (name + ".x" or name + ".y"). * @param request current portlet request diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..4db722187d9d 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/Colour.java @@ -32,4 +32,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java index 2bb41a9d5b68..db326041c361 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/DerivedTestBean.java @@ -82,4 +82,4 @@ public boolean wasDestroyed() { return destroyed; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java index 7d87547b5f7f..115af8482600 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/INestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,4 +20,4 @@ public interface INestedTestBean { public String getCompany(); -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java index 797486ec44e7..c77616637e6c 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/IOther.java @@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,4 +21,4 @@ public interface IOther { void absquatulate(); -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java index cdf5ef510ddd..7b6ebcfc2fb6 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/ITestBean.java @@ -68,4 +68,4 @@ public interface ITestBean { void unreliableFileOperation() throws IOException; -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java index ddb091770ee7..4f3012666eac 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/IndexedTestBean.java @@ -142,4 +142,4 @@ public void setSortedMap(SortedMap sortedMap) { this.sortedMap = sortedMap; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java index a06e15d150be..638f6b4a81eb 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/NestedTestBean.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,4 +57,4 @@ public String toString() { return "NestedTestBean: " + this.company; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java index 7842bbfeacfe..4cd145c9bb7e 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/TestBean.java @@ -434,4 +434,4 @@ public String toString() { return this.name; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java index a04d1796443a..fa24a5b8045d 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -326,4 +326,4 @@ public void setAsText(String text) { } } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java index d683491a1f64..a4c2a6d5b311 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java @@ -83,4 +83,4 @@ public void testContainsBeanDefinition() { Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java index 006228975a76..9ab82f0d0c25 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/DummyFactory.java @@ -169,4 +169,4 @@ public void destroy() { } } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java index 19b7da62f8d3..89d35d4c8fe8 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/LifecycleBean.java @@ -155,4 +155,4 @@ public Object postProcessAfterInitialization(Object bean, String name) throws Be } } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java index b85110e1cbc8..ec5b6da597a9 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/MustBeInitialized.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,6 @@ package org.springframework.beans.factory; -import org.springframework.beans.factory.InitializingBean; /** * Simple test of BeanFactory initialization @@ -43,4 +42,4 @@ public void businessMethod() { throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object"); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/ACATester.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/ACATester.java index f77a7bda5041..475dc505b081 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/ACATester.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/context/ACATester.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ import org.springframework.context.NoSuchMessageException; public class ACATester implements ApplicationContextAware { - + private ApplicationContext ac; public void setApplicationContext(ApplicationContext ctx) throws ApplicationContextException { diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java index d014d770e165..7b4c749a534a 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/context/AbstractApplicationContextTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,7 +94,7 @@ public void testGrandparentDefinitionFound() throws Exception { } public void testGrandparentTypedDefinitionFound() throws Exception { - TestBean dad = (TestBean) applicationContext.getBean("father", TestBean.class); + TestBean dad = applicationContext.getBean("father", TestBean.class); assertTrue("Dad has correct name", dad.getName().equals("Albert")); } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/BeanThatBroadcasts.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/BeanThatBroadcasts.java index 8137de62f611..9a436e6171f0 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/BeanThatBroadcasts.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/context/BeanThatBroadcasts.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.context; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; /** * @author Juergen Hoeller diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java index d8be8ec9667a..50c9936c444c 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/context/LifecycleContextBean.java @@ -7,12 +7,12 @@ /** * Simple bean to test ApplicationContext lifecycle methods for beans - * + * * @author Colin Sampaleanu * @since 03.07.2004 */ public class LifecycleContextBean extends LifecycleBean implements ApplicationContextAware { - + protected ApplicationContext owningContext; public void setBeanFactory(BeanFactory beanFactory) { @@ -20,18 +20,18 @@ public void setBeanFactory(BeanFactory beanFactory) { if (this.owningContext != null) throw new RuntimeException("Factory called setBeanFactory after setApplicationContext"); } - + public void afterPropertiesSet() { super.afterPropertiesSet(); if (this.owningContext == null) throw new RuntimeException("Factory didn't call setAppliationContext before afterPropertiesSet on lifecycle bean"); } - + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (this.owningFactory == null) throw new RuntimeException("Factory called setApplicationContext before setBeanFactory"); - + this.owningContext = applicationContext; } - + } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/context/TestListener.java b/spring-webmvc-portlet/src/test/java/org/springframework/context/TestListener.java index 29f375105ff0..1176c0745f40 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/context/TestListener.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/context/TestListener.java @@ -1,7 +1,5 @@ package org.springframework.context; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; /** * Listener that maintains a global count of events. @@ -25,4 +23,4 @@ public void onApplicationEvent(ApplicationEvent e) { ++eventCount; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java index 66fca5df2f91..af0974faabb3 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/DelegatingServletOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java index 3e2701c576b7..5bf52bbd5d5e 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java @@ -51,7 +51,7 @@ public class MockHttpServletResponse implements HttpServletResponse { private static final String CHARSET_PREFIX = "charset="; private static final String CONTENT_TYPE_HEADER = "Content-Type"; - + private static final String CONTENT_LENGTH_HEADER = "Content-Length"; private static final String LOCATION_HEADER = "Location"; @@ -141,7 +141,7 @@ public void setCharacterEncoding(String characterEncoding) { this.charset = true; updateContentTypeHeader(); } - + private void updateContentTypeHeader() { if (this.contentType != null) { StringBuilder sb = new StringBuilder(this.contentType); @@ -457,7 +457,7 @@ private void addHeaderValue(String name, Object value) { } doAddHeaderValue(name, value, false); } - + private boolean setSpecialHeader(String name, Object value) { if (CONTENT_TYPE_HEADER.equalsIgnoreCase(name)) { setContentType((String) value); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java index 24518968c381..b3d9db40b424 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/MockMultipartFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.Collections; -import java.util.Iterator; - import org.springframework.util.Assert; import org.springframework.util.FileCopyUtils; import org.springframework.web.multipart.MultipartFile; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockActionResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockActionResponse.java index bec6687887c5..2ca21a472b19 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockActionResponse.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockActionResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockBaseURL.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockBaseURL.java index aad992058b9e..5072ede8bb4a 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockBaseURL.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockBaseURL.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockClientDataRequest.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockClientDataRequest.java index 8f36c3a76405..f6a850c7aa30 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockClientDataRequest.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockClientDataRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,4 +125,4 @@ public String getMethod() { return this.method; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEvent.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEvent.java index 0dc7efaba8dd..7f5ad3fe9627 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEvent.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,4 +85,4 @@ public Serializable getValue() { return this.value; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEventRequest.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEventRequest.java index 2406f18d01ca..a2850e3c1f7f 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEventRequest.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockEventRequest.java @@ -85,4 +85,4 @@ public String getMethod() { return this.method; } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockMimeResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockMimeResponse.java index e606fc808d29..0d2bab32e370 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockMimeResponse.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockMimeResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortalContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortalContext.java index 949d077b9a26..2895914662b0 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortalContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortalContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletConfig.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletConfig.java index d69e75d0c111..9d3a878026ab 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletConfig.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,15 +95,15 @@ public MockPortletConfig(PortletContext portletContext, String portletName) { this.portletName = portletName; } - + public String getPortletName() { return this.portletName; } - + public PortletContext getPortletContext() { return this.portletContext; } - + public void setResourceBundle(Locale locale, ResourceBundle resourceBundle) { Assert.notNull(locale, "Locale must not be null"); this.resourceBundles.put(locale, resourceBundle); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletContext.java index 0cf9f24ffe89..4444a7a4a3cc 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ public class MockPortletContext implements PortletContext { private final Log logger = LogFactory.getLog(getClass()); private final String resourceBasePath; - + private final ResourceLoader resourceLoader; private final Map attributes = new LinkedHashMap(); @@ -68,7 +68,7 @@ public class MockPortletContext implements PortletContext { /** - * Create a new MockPortletContext with no base path and a + * Create a new MockPortletContext with no base path and a * DefaultResourceLoader (i.e. the classpath root as WAR root). * @see org.springframework.core.io.DefaultResourceLoader */ @@ -123,7 +123,7 @@ protected String getResourceLocation(String path) { return this.resourceBasePath + path; } - + public String getServerInfo() { return "MockPortal/1.0"; } @@ -158,7 +158,7 @@ public int getMajorVersion() { public int getMinorVersion() { return 0; } - + public String getMimeType(String filePath) { return null; } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletPreferences.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletPreferences.java index 92ee6c0a4650..7c5fef116b03 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletPreferences.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequest.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequest.java index b885f3585267..804e4795f1da 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequest.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java index ca8695f90e26..70fd67c1b139 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletRequestDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletResponse.java index b556209fcd37..8adc809fcfcc 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletResponse.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java index d9632906f76b..97e144a56e6e 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletURL.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletURL.java index 12abdf57c931..d8c5dd3ec9b3 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletURL.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockPortletURL.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockRenderResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockRenderResponse.java index a2feeb3726df..464b889467e9 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockRenderResponse.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockRenderResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceRequest.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceRequest.java index 7cce4ba3c6d0..2148bd3e91d3 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceRequest.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceURL.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceURL.java index cce36b18d552..d9a42c8dce84 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceURL.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockResourceURL.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java index 685365844719..8fe1e42cdcca 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/MockStateAwareResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,4 +151,4 @@ public Serializable getEvent(String name) { return this.events.get(new QName(name)); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java index a333984f48a3..c62935a3ecd9 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/mock/web/portlet/ServletWrappingPortletContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java index fbbdcaefaa31..6ffae0ce8fdf 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/ComplexPortletApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public void refresh() throws BeansException { registerSingleton("standardHandlerAdapter", SimpleControllerHandlerAdapter.class); registerSingleton("portletHandlerAdapter", SimplePortletHandlerAdapter.class); registerSingleton("myHandlerAdapter", MyHandlerAdapter.class); - + registerSingleton("viewController", ViewController.class); registerSingleton("editController", EditController.class); registerSingleton("helpController1", HelpController1.class); @@ -93,21 +93,21 @@ public void refresh() throws BeansException { registerSingleton("testController2", TestController2.class); registerSingleton("requestLocaleCheckingController", RequestLocaleCheckingController.class); registerSingleton("localeContextCheckingController", LocaleContextCheckingController.class); - + registerSingleton("exceptionThrowingHandler1", ExceptionThrowingHandler.class); registerSingleton("exceptionThrowingHandler2", ExceptionThrowingHandler.class); registerSingleton("unknownHandler", Object.class); - + registerSingleton("myPortlet", MyPortlet.class); registerSingleton("portletMultipartResolver", MockMultipartResolver.class); registerSingleton("portletPostProcessor", SimplePortletPostProcessor.class); registerSingleton("testListener", TestApplicationListener.class); - + ConstructorArgumentValues cvs = new ConstructorArgumentValues(); cvs.addIndexedArgumentValue(0, new MockPortletContext()); cvs.addIndexedArgumentValue(1, "complex"); registerBeanDefinition("portletConfig", new RootBeanDefinition(MockPortletConfig.class, cvs, null)); - + UserRoleAuthorizationInterceptor userRoleInterceptor = new UserRoleAuthorizationInterceptor(); userRoleInterceptor.setAuthorizedRoles(new String[] {"role1", "role2"}); @@ -129,7 +129,7 @@ public void refresh() throws BeansException { pvs.add("portletModeMap", portletModeMap); pvs.add("interceptors", interceptors); registerSingleton("handlerMapping3", PortletModeHandlerMapping.class, pvs); - + pvs = new MutablePropertyValues(); Map parameterMap = new ManagedMap(); parameterMap.put("test1", new RuntimeBeanReference("testController1")); @@ -144,7 +144,7 @@ public void refresh() throws BeansException { pvs.add("parameterName", "myParam"); pvs.add("order", "2"); registerSingleton("handlerMapping2", ParameterHandlerMapping.class, pvs); - + pvs = new MutablePropertyValues(); Map innerMap = new ManagedMap(); innerMap.put("help1", new RuntimeBeanReference("helpController1")); @@ -178,7 +178,7 @@ public void refresh() throws BeansException { addMessage("test", Locale.ENGLISH, "test message"); addMessage("test", Locale.CANADA, "Canadian & test message"); addMessage("test.args", Locale.ENGLISH, "test {0} and {1}"); - + super.refresh(); } @@ -214,7 +214,7 @@ public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse re return new ModelAndView("someViewName", "result", "view was here"); } } - + public static class EditController implements Controller { @@ -226,7 +226,7 @@ public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse re return new ModelAndView(request.getParameter("param")); } } - + public static class HelpController1 implements Controller { @@ -250,7 +250,7 @@ public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse re return new ModelAndView("help2-view"); } } - + public static class RequestLocaleCheckingController implements Controller { public void handleActionRequest(ActionRequest request, ActionResponse response) throws PortletException { @@ -258,8 +258,8 @@ public void handleActionRequest(ActionRequest request, ActionResponse response) throw new PortletException("Incorrect Locale in ActionRequest"); } } - - public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) + + public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws PortletException, IOException { if (!Locale.CANADA.equals(request.getLocale())) { throw new PortletException("Incorrect Locale in RenderRequest"); @@ -277,8 +277,8 @@ public void handleActionRequest(ActionRequest request, ActionResponse response) throw new PortletException("Incorrect Locale in LocaleContextHolder"); } } - - public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) + + public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws PortletException, IOException { if (!Locale.CANADA.equals(LocaleContextHolder.getLocale())) { throw new PortletException("Incorrect Locale in LocaleContextHolder"); @@ -304,7 +304,7 @@ public void processAction(ActionRequest request, ActionResponse response) throws public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.getWriter().write("myPortlet was here"); } - + public PortletConfig getPortletConfig() { return this.portletConfig; } @@ -319,7 +319,7 @@ public static interface MyHandler { public void doSomething(PortletRequest request) throws Exception; } - + public static class ExceptionThrowingHandler implements MyHandler { diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java index b624737c1b02..b0a750696ab0 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/DispatcherPortletTests.java @@ -1,18 +1,18 @@ /* -* Copyright 2002-2012 the original author or authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.web.portlet; @@ -24,7 +24,6 @@ import javax.portlet.PortletMode; import javax.portlet.PortletSecurityException; import javax.portlet.PortletSession; - import junit.framework.TestCase; import org.springframework.beans.TestBean; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/GenericPortletBeanTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/GenericPortletBeanTests.java index dd6f8006c012..e0256a341de6 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/GenericPortletBeanTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/GenericPortletBeanTests.java @@ -40,7 +40,7 @@ public void testInitParameterSet() throws Exception { assertNotNull(portletBean.getTestParam()); assertEquals(testValue, portletBean.getTestParam()); } - + public void testInitParameterNotSet() throws Exception { PortletContext portletContext = new MockPortletContext(); MockPortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -112,7 +112,7 @@ public void testRequiredInitParameterNotSet() throws Exception { // expected } } - + public void testRequiredInitParameterNotSetOtherParameterNotSet() throws Exception { PortletContext portletContext = new MockPortletContext(); MockPortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -153,22 +153,22 @@ public void testUnknownRequiredInitParameter() throws Exception { private static class TestPortletBean extends GenericPortletBean { - - private String testParam; + + private String testParam; private String anotherParam; - + public void setTestParam(String value) { this.testParam = value; } - + public String getTestParam() { return this.testParam; } - + public void setAnotherParam(String value) { this.anotherParam = value; } - + public String getAnotherParam() { return this.anotherParam; } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java index 748414ff48aa..b2bc75c7033b 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/SimplePortletApplicationContext.java @@ -47,7 +47,7 @@ public class SimplePortletApplicationContext extends StaticPortletApplicationCon public void refresh() throws BeansException { MutablePropertyValues pvs = new MutablePropertyValues(); registerSingleton("controller1", TestFormController.class, pvs); - + pvs = new MutablePropertyValues(); pvs.add("bindOnNewForm", "true"); registerSingleton("controller2", TestFormController.class, pvs); @@ -65,7 +65,7 @@ public void refresh() throws BeansException { registerSingleton("controller4", TestFormController.class, pvs); pvs = new MutablePropertyValues(); - Map parameterMap = new ManagedMap(); + Map parameterMap = new ManagedMap(); parameterMap.put("form", new RuntimeBeanReference("controller1")); parameterMap.put("form-bind", new RuntimeBeanReference("controller2")); parameterMap.put("form-session-bind", new RuntimeBeanReference("controller3")); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestParameterPropertyValuesTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestParameterPropertyValuesTests.java index 54166c7e91a2..a40f0d47c0ea 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestParameterPropertyValuesTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestParameterPropertyValuesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,14 +30,14 @@ public void testWithNoParams() { PortletRequestParameterPropertyValues pvs = new PortletRequestParameterPropertyValues(request); assertTrue("Should not have any property values", pvs.getPropertyValues().length == 0); } - + public void testWithNoPrefix() { MockPortletRequest request = new MockPortletRequest(); request.addParameter("param", "value"); PortletRequestParameterPropertyValues pvs = new PortletRequestParameterPropertyValues(request); assertEquals("value", pvs.getPropertyValue("param").getValue()); } - + public void testWithPrefix() { MockPortletRequest request = new MockPortletRequest(); request.addParameter("test_param", "value"); @@ -60,5 +60,5 @@ public void testWithPrefixAndOverridingSeparator() { assertFalse(pvs.contains("other")); assertTrue(pvs.contains("param")); assertEquals("value", pvs.getPropertyValue("param").getValue()); - } + } } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java index e82de4420e6c..3730a69e12b3 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java @@ -103,7 +103,7 @@ public void testLongParameter() throws PortletRequestBindingException { assertEquals(PortletRequestUtils.getLongParameter(request, "param1", 6L), 5L); assertEquals(PortletRequestUtils.getRequiredIntParameter(request, "param1"), 5L); assertEquals(PortletRequestUtils.getLongParameter(request, "param2", 6L), 6L); - + try { PortletRequestUtils.getRequiredLongParameter(request, "param2"); fail("Should have thrown PortletRequestBindingException"); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java index 19ed8741eb8d..918160b3f471 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/AbstractXmlWebApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.web.portlet.context; -import java.util.Locale; import javax.servlet.ServletException; import org.springframework.beans.TestBean; @@ -24,16 +23,14 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.context.AbstractApplicationContextTests; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.NoSuchMessageException; import org.springframework.context.TestListener; import org.springframework.web.context.ConfigurableWebApplicationContext; -import org.springframework.web.context.support.XmlWebApplicationContext; /** * Should ideally be eliminated. Copied when splitting .testsuite up into individual bundles. - * + * * @see org.springframework.web.context.XmlWebApplicationContextTests - * + * * @author Rod Johnson * @author Juergen Hoeller * @author Chris Beams @@ -52,7 +49,7 @@ public void testEvents() throws Exception { listener.zeroCounter(); TestListener parentListener = (TestListener) this.applicationContext.getParent().getBean("parentListener"); parentListener.zeroCounter(); - + parentListener.zeroCounter(); assertTrue("0 events before publication", listener.getEventCount() == 0); assertTrue("0 parent events before publication", parentListener.getEventCount() == 0); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java index 452ddb3c5208..5b76f4f4a96a 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletApplicationContextScopeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,4 +125,4 @@ public void testApplicationScope() { assertTrue(bean.wasDestroyed()); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletConfigAwareBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletConfigAwareBean.java index 2b22f26bd7ee..3492556e9a10 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletConfigAwareBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletConfigAwareBean.java @@ -24,11 +24,11 @@ public class PortletConfigAwareBean implements PortletConfigAware { private PortletConfig portletConfig; - + public void setPortletConfig(PortletConfig portletConfig) { this.portletConfig = portletConfig; } - + public PortletConfig getPortletConfig() { return portletConfig; } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareBean.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareBean.java index 87bbe58758e7..b89b393ea78d 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareBean.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareBean.java @@ -22,13 +22,13 @@ * @author Mark Fisher */ public class PortletContextAwareBean implements PortletContextAware { - + private PortletContext portletContext; - + public void setPortletContext(PortletContext portletContext) { this.portletContext = portletContext; } - + public PortletContext getPortletContext() { return portletContext; } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareProcessorTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareProcessorTests.java index d2ad1dd355c6..28b89a96cf79 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareProcessorTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletContextAwareProcessorTests.java @@ -38,7 +38,7 @@ public void testPortletContextAwareWithPortletContext() { assertNotNull("PortletContext should have been set", bean.getPortletContext()); assertEquals(portletContext, bean.getPortletContext()); } - + public void testPortletContextAwareWithPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -47,9 +47,9 @@ public void testPortletContextAwareWithPortletConfig() { assertNull(bean.getPortletContext()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletContext should have been set", bean.getPortletContext()); - assertEquals(portletContext, bean.getPortletContext()); + assertEquals(portletContext, bean.getPortletContext()); } - + public void testPortletContextAwareWithPortletContextAndPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -58,9 +58,9 @@ public void testPortletContextAwareWithPortletContextAndPortletConfig() { assertNull(bean.getPortletContext()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletContext should have been set", bean.getPortletContext()); - assertEquals(portletContext, bean.getPortletContext()); + assertEquals(portletContext, bean.getPortletContext()); } - + public void testPortletContextAwareWithNullPortletContextAndNonNullPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -69,9 +69,9 @@ public void testPortletContextAwareWithNullPortletContextAndNonNullPortletConfig assertNull(bean.getPortletContext()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletContext should have been set", bean.getPortletContext()); - assertEquals(portletContext, bean.getPortletContext()); + assertEquals(portletContext, bean.getPortletContext()); } - + public void testPortletContextAwareWithNonNullPortletContextAndNullPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletContext, null); @@ -79,7 +79,7 @@ public void testPortletContextAwareWithNonNullPortletContextAndNullPortletConfig assertNull(bean.getPortletContext()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletContext should have been set", bean.getPortletContext()); - assertEquals(portletContext, bean.getPortletContext()); + assertEquals(portletContext, bean.getPortletContext()); } public void testPortletContextAwareWithNullPortletContext() { @@ -90,7 +90,7 @@ public void testPortletContextAwareWithNullPortletContext() { processor.postProcessBeforeInitialization(bean, "testBean"); assertNull(bean.getPortletContext()); } - + public void testPortletConfigAwareWithPortletContextOnly() { PortletContext portletContext = new MockPortletContext(); PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletContext); @@ -99,7 +99,7 @@ public void testPortletConfigAwareWithPortletContextOnly() { processor.postProcessBeforeInitialization(bean, "testBean"); assertNull(bean.getPortletConfig()); } - + public void testPortletConfigAwareWithPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -108,9 +108,9 @@ public void testPortletConfigAwareWithPortletConfig() { assertNull(bean.getPortletConfig()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletConfig should have been set", bean.getPortletConfig()); - assertEquals(portletConfig, bean.getPortletConfig()); + assertEquals(portletConfig, bean.getPortletConfig()); } - + public void testPortletConfigAwareWithPortletContextAndPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -119,9 +119,9 @@ public void testPortletConfigAwareWithPortletContextAndPortletConfig() { assertNull(bean.getPortletConfig()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletConfig should have been set", bean.getPortletConfig()); - assertEquals(portletConfig, bean.getPortletConfig()); + assertEquals(portletConfig, bean.getPortletConfig()); } - + public void testPortletConfigAwareWithNullPortletContextAndNonNullPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletConfig portletConfig = new MockPortletConfig(portletContext); @@ -130,9 +130,9 @@ public void testPortletConfigAwareWithNullPortletContextAndNonNullPortletConfig( assertNull(bean.getPortletConfig()); processor.postProcessBeforeInitialization(bean, "testBean"); assertNotNull("PortletConfig should have been set", bean.getPortletConfig()); - assertEquals(portletConfig, bean.getPortletConfig()); + assertEquals(portletConfig, bean.getPortletConfig()); } - + public void testPortletConfigAwareWithNonNullPortletContextAndNullPortletConfig() { PortletContext portletContext = new MockPortletContext(); PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletContext, null); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletRequestAttributesTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletRequestAttributesTests.java index e44f91457572..228e4c2fb9d4 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletRequestAttributesTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletRequestAttributesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletWebRequestTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletWebRequestTests.java index f1a92dd17010..e52c722b2c34 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletWebRequestTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/PortletWebRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ import org.junit.Test; import org.springframework.mock.web.portlet.MockPortletRequest; -import org.springframework.mock.web.portlet.MockPortletResponse; import org.springframework.mock.web.portlet.MockRenderRequest; import org.springframework.mock.web.portlet.MockRenderResponse; import org.springframework.web.multipart.MultipartRequest; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java index d968e5fd3fbe..148943c06de0 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/context/XmlPortletApplicationContextTests.java @@ -40,7 +40,7 @@ public class XmlPortletApplicationContextTests extends AbstractXmlWebApplicationContextTests { private ConfigurablePortletApplicationContext root; - + protected ConfigurableApplicationContext createContext() throws Exception { root = new XmlPortletApplicationContext(); PortletContext portletContext = new MockPortletContext(); @@ -72,7 +72,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw pac.refresh(); return pac; } - + /** * Overridden in order to use MockPortletConfig * @see org.springframework.web.context.XmlWebApplicationContextTests#testWithoutMessageSource() @@ -96,7 +96,7 @@ public void testWithoutMessageSource() throws Exception { String msg = pac.getMessage("someMessage", null, "default", Locale.getDefault()); assertTrue("Default message returned", "default".equals(msg)); } - + /** * Overridden in order to access the root ApplicationContext * @see org.springframework.web.context.XmlWebApplicationContextTests#testContextNesting() @@ -115,12 +115,12 @@ public void testContextNesting() { assertTrue("Bean from root context", "Roderick".equals(rod.getName())); assertTrue("Custom BeanPostProcessor applied", rod.getFriends().contains("myFriend")); } - + public void testCount() { assertTrue("should have 16 beans, not "+ this.applicationContext.getBeanDefinitionCount(), this.applicationContext.getBeanDefinitionCount() == 16); } - + public void testPortletContextAwareBean() { PortletContextAwareBean bean = (PortletContextAwareBean)this.applicationContext.getBean("portletContextAwareBean"); assertNotNull(bean.getPortletContext()); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterHandlerMappingTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterHandlerMappingTests.java index fbacd30f1f6a..8f3c4a539d9c 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterHandlerMappingTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterHandlerMappingTests.java @@ -30,9 +30,9 @@ public class ParameterHandlerMappingTests extends TestCase { public static final String CONF = "/org/springframework/web/portlet/handler/parameterMapping.xml"; - - private ConfigurablePortletApplicationContext pac; - + + private ConfigurablePortletApplicationContext pac; + public void setUp() throws Exception { MockPortletContext portletContext = new MockPortletContext(); pac = new XmlPortletApplicationContext(); @@ -40,55 +40,55 @@ public void setUp() throws Exception { pac.setConfigLocations(new String[] {CONF}); pac.refresh(); } - + public void testParameterMapping() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest addRequest = new MockPortletRequest(); addRequest.addParameter("action", "add"); MockPortletRequest removeRequest = new MockPortletRequest(); removeRequest.addParameter("action", "remove"); - + Object addHandler = hm.getHandler(addRequest).getHandler(); Object removeHandler = hm.getHandler(removeRequest).getHandler(); - + assertEquals(pac.getBean("addItemHandler"), addHandler); assertEquals(pac.getBean("removeItemHandler"), removeHandler); } - + public void testUnregisteredHandlerWithNoDefault() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest request = new MockPortletRequest(); request.addParameter("action", "modify"); - assertNull(hm.getHandler(request)); + assertNull(hm.getHandler(request)); } public void testUnregisteredHandlerWithDefault() throws Exception { ParameterHandlerMapping hm = (ParameterHandlerMapping)pac.getBean("handlerMapping"); Object defaultHandler = new Object(); hm.setDefaultHandler(defaultHandler); - + MockPortletRequest request = new MockPortletRequest(); request.addParameter("action", "modify"); assertNotNull(hm.getHandler(request)); assertEquals(defaultHandler, hm.getHandler(request).getHandler()); } - + public void testConfiguredParameterName() throws Exception { ParameterHandlerMapping hm = (ParameterHandlerMapping)pac.getBean("handlerMapping"); hm.setParameterName("someParam"); - + MockPortletRequest request = new MockPortletRequest(); request.addParameter("someParam", "add"); - + Object handler = hm.getHandler(request).getHandler(); assertEquals(pac.getBean("addItemHandler"), handler); } - + public void testDuplicateMappingAttempt() { ParameterHandlerMapping hm = (ParameterHandlerMapping)pac.getBean("handlerMapping"); try { diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterMappingInterceptorTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterMappingInterceptorTests.java index 644786283c7f..4c071f740230 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterMappingInterceptorTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/ParameterMappingInterceptorTests.java @@ -42,7 +42,7 @@ public void testDefaultParameterMapped() throws Exception { assertNotNull(response.getRenderParameter(param)); assertEquals(value, response.getRenderParameter(param)); } - + public void testNonDefaultParameterNotMapped() throws Exception { ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); Object handler = new Object(); @@ -57,7 +57,7 @@ public void testNonDefaultParameterNotMapped() throws Exception { assertNull(response.getRenderParameter(param)); assertNull(response.getRenderParameter(ParameterHandlerMapping.DEFAULT_PARAMETER_NAME)); } - + public void testNonDefaultParameterMappedWhenHandlerMappingProvided() throws Exception { String param = "myParam"; String value = "someValue"; @@ -88,7 +88,7 @@ public void testNoEffectForRenderRequest() throws Exception { boolean shouldProceed = interceptor.preHandle(request, response, handler); assertTrue(shouldProceed); } - + public void testNoParameterValueSetWithDefaultParameterName() throws Exception { ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); Object handler = new Object(); @@ -100,7 +100,7 @@ public void testNoParameterValueSetWithDefaultParameterName() throws Exception { assertTrue(shouldProceed); assertNull(response.getRenderParameter(param)); } - + public void testNoParameterValueSetWithNonDefaultParameterName() throws Exception { ParameterMappingInterceptor interceptor = new ParameterMappingInterceptor(); Object handler = new Object(); @@ -127,5 +127,5 @@ public void testNoParameterValueSetWithNonDefaultParameterNameWhenHandlerMapping assertTrue(shouldProceed); assertNull(response.getRenderParameter(param)); } - + } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeHandlerMappingTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeHandlerMappingTests.java index f1bda016299d..cff6418b88b0 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeHandlerMappingTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeHandlerMappingTests.java @@ -32,9 +32,9 @@ public class PortletModeHandlerMappingTests extends TestCase { public static final String CONF = "/org/springframework/web/portlet/handler/portletModeMapping.xml"; - - private ConfigurablePortletApplicationContext pac; - + + private ConfigurablePortletApplicationContext pac; + public void setUp() throws Exception { MockPortletContext portletContext = new MockPortletContext(); pac = new XmlPortletApplicationContext(); @@ -42,37 +42,37 @@ public void setUp() throws Exception { pac.setConfigLocations(new String[] {CONF}); pac.refresh(); } - + public void testPortletModeView() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest request = new MockPortletRequest(); request.setPortletMode(PortletMode.VIEW); - + Object handler = hm.getHandler(request).getHandler(); assertEquals(pac.getBean("viewHandler"), handler); } public void testPortletModeEdit() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest request = new MockPortletRequest(); request.setPortletMode(PortletMode.EDIT); - + Object handler = hm.getHandler(request).getHandler(); assertEquals(pac.getBean("editHandler"), handler); } - + public void testPortletModeHelp() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest request = new MockPortletRequest(); request.setPortletMode(PortletMode.HELP); - + Object handler = hm.getHandler(request).getHandler(); assertEquals(pac.getBean("helpHandler"), handler); } - + public void testDuplicateMappingAttempt() { PortletModeHandlerMapping hm = (PortletModeHandlerMapping)pac.getBean("handlerMapping"); try { @@ -83,5 +83,5 @@ public void testDuplicateMappingAttempt() { // expected } } - + } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMappingTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMappingTests.java index 1bf68e45fa44..687e4938e4ad 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMappingTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMappingTests.java @@ -32,9 +32,9 @@ public class PortletModeParameterHandlerMappingTests extends TestCase { public static final String CONF = "/org/springframework/web/portlet/handler/portletModeParameterMapping.xml"; - - private ConfigurablePortletApplicationContext pac; - + + private ConfigurablePortletApplicationContext pac; + public void setUp() throws Exception { MockPortletContext portletContext = new MockPortletContext(); pac = new XmlPortletApplicationContext(); @@ -42,10 +42,10 @@ public void setUp() throws Exception { pac.setConfigLocations(new String[] {CONF}); pac.refresh(); } - + public void testPortletModeViewWithParameter() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest addRequest = new MockPortletRequest(); addRequest.setPortletMode(PortletMode.VIEW); addRequest.setParameter("action", "add"); @@ -53,25 +53,25 @@ public void testPortletModeViewWithParameter() throws Exception { MockPortletRequest removeRequest = new MockPortletRequest(); removeRequest.setPortletMode(PortletMode.VIEW); removeRequest.setParameter("action", "remove"); - + Object addHandler = hm.getHandler(addRequest).getHandler(); Object removeHandler = hm.getHandler(removeRequest).getHandler(); - + assertEquals(pac.getBean("addItemHandler"), addHandler); assertEquals(pac.getBean("removeItemHandler"), removeHandler); } public void testPortletModeEditWithParameter() throws Exception { HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); - + MockPortletRequest request = new MockPortletRequest(); request.setPortletMode(PortletMode.EDIT); request.setParameter("action", "prefs"); - + Object handler = hm.getHandler(request).getHandler(); assertEquals(pac.getBean("preferencesHandler"), handler); } - + public void testDuplicateMappingInSamePortletMode() { PortletModeParameterHandlerMapping hm = (PortletModeParameterHandlerMapping)pac.getBean("handlerMapping"); try { @@ -93,18 +93,18 @@ public void testDuplicateMappingInDifferentPortletMode() { // expected } } - + public void testAllowDuplicateMappingInDifferentPortletMode() throws Exception { PortletModeParameterHandlerMapping hm = (PortletModeParameterHandlerMapping)pac.getBean("handlerMapping"); hm.setAllowDuplicateParameters(true); - + Object editRemoveHandler = new Object(); hm.registerHandler(PortletMode.EDIT, "remove", editRemoveHandler); - + MockPortletRequest request = new MockPortletRequest(); request.setPortletMode(PortletMode.EDIT); request.setParameter("action", "remove"); - + Object handler = hm.getHandler(request).getHandler(); assertEquals(editRemoveHandler, handler); } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolverTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolverTests.java index 8cc1ec1fe937..5539c8eb9378 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolverTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/SimpleMappingExceptionResolverTests.java @@ -33,7 +33,7 @@ * @author Juergen Hoeller */ public class SimpleMappingExceptionResolverTests extends TestCase { - + private static final String DEFAULT_VIEW = "default-view"; private SimpleMappingExceptionResolver exceptionResolver; @@ -51,19 +51,19 @@ protected void setUp() { handler2 = new Object(); genericException = new Exception(); } - + public void testSetOrder() { exceptionResolver.setOrder(2); assertEquals(2, exceptionResolver.getOrder()); } - + public void testDefaultErrorView() { exceptionResolver.setDefaultErrorView(DEFAULT_VIEW); ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertEquals(DEFAULT_VIEW, mav.getViewName()); assertEquals(genericException, mav.getModel().get(SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE)); } - + public void testDefaultErrorViewDifferentHandler() { exceptionResolver.setDefaultErrorView(DEFAULT_VIEW); exceptionResolver.setMappedHandlers(Collections.singleton(handler1)); @@ -90,14 +90,14 @@ public void testNullExceptionAttribute() { assertEquals(DEFAULT_VIEW, mav.getViewName()); assertNull(mav.getModel().get(SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE)); } - + public void testNullExceptionMappings() { exceptionResolver.setExceptionMappings(null); exceptionResolver.setDefaultErrorView(DEFAULT_VIEW); ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertEquals(DEFAULT_VIEW, mav.getViewName()); } - + public void testDefaultNoRenderWhenMinimized() { exceptionResolver.setDefaultErrorView(DEFAULT_VIEW); request.setWindowState(WindowState.MINIMIZED); @@ -113,7 +113,7 @@ public void testDoRenderWhenMinimized() { assertNotNull("ModelAndView should not be null", mav); assertEquals(DEFAULT_VIEW, mav.getViewName()); } - + public void testSimpleExceptionMapping() { Properties props = new Properties(); props.setProperty("Exception", "error"); @@ -122,7 +122,7 @@ public void testSimpleExceptionMapping() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertEquals("error", mav.getViewName()); } - + public void testExactExceptionMappingWithHandlerSpecified() { Properties props = new Properties(); props.setProperty("java.lang.Exception", "error"); @@ -131,7 +131,7 @@ public void testExactExceptionMappingWithHandlerSpecified() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertEquals("error", mav.getViewName()); } - + public void testExactExceptionMappingWithHandlerClassSpecified() { Properties props = new Properties(); props.setProperty("java.lang.Exception", "error"); @@ -176,7 +176,7 @@ public void testMissingExceptionInMapping() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertNull("Exception not mapped - ModelAndView should be null", mav); } - + public void testTwoMappings() { Properties props = new Properties(); props.setProperty("java.lang.Exception", "error"); @@ -186,7 +186,7 @@ public void testTwoMappings() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertEquals("error", mav.getViewName()); } - + public void testTwoMappingsOneShortOneLong() { Properties props = new Properties(); props.setProperty("Exception", "error"); @@ -196,7 +196,7 @@ public void testTwoMappingsOneShortOneLong() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, genericException); assertEquals("error", mav.getViewName()); } - + public void testTwoMappingsOneShortOneLongThrowOddException() { Exception oddException = new SomeOddException(); Properties props = new Properties(); @@ -207,7 +207,7 @@ public void testTwoMappingsOneShortOneLongThrowOddException() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, oddException); assertEquals("error", mav.getViewName()); } - + public void testTwoMappingsThrowOddExceptionUseLongExceptionMapping() { Exception oddException = new SomeOddException(); Properties props = new Properties(); @@ -218,7 +218,7 @@ public void testTwoMappingsThrowOddExceptionUseLongExceptionMapping() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, oddException); assertEquals("another-error", mav.getViewName()); } - + public void testThreeMappings() { Exception oddException = new AnotherOddException(); Properties props = new Properties(); @@ -230,7 +230,7 @@ public void testThreeMappings() { ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, oddException); assertEquals("another-some-error", mav.getViewName()); } - + public void testExceptionWithSubstringMatchingParent() { Exception oddException = new SomeOddExceptionChild(); Properties props = new Properties(); @@ -240,9 +240,9 @@ public void testExceptionWithSubstringMatchingParent() { exceptionResolver.setMappedHandlers(Collections.singleton(handler1)); exceptionResolver.setExceptionMappings(props); ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, oddException); - assertEquals("child-error", mav.getViewName()); + assertEquals("child-error", mav.getViewName()); } - + public void testMostSpecificExceptionInHierarchyWins() { Exception oddException = new NoSubstringMatchesThisException(); Properties props = new Properties(); @@ -251,19 +251,19 @@ public void testMostSpecificExceptionInHierarchyWins() { exceptionResolver.setMappedHandlers(Collections.singleton(handler1)); exceptionResolver.setExceptionMappings(props); ModelAndView mav = exceptionResolver.resolveException(request, response, handler1, oddException); - assertEquals("parent-error", mav.getViewName()); + assertEquals("parent-error", mav.getViewName()); } private static class SomeOddException extends Exception { } - + private static class SomeOddExceptionChild extends SomeOddException { } - + private static class NoSubstringMatchesThisException extends SomeOddException { @@ -273,5 +273,5 @@ private static class NoSubstringMatchesThisException extends SomeOddException { private static class AnotherOddException extends Exception { } - + } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/UserRoleAuthorizationInterceptorTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/UserRoleAuthorizationInterceptorTests.java index 7185dee9860b..ef70c03718ea 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/UserRoleAuthorizationInterceptorTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/handler/UserRoleAuthorizationInterceptorTests.java @@ -91,7 +91,7 @@ public void testRequestWithNoUserRoles() throws Exception { // expected } } - + public void testInterceptorWithNoAuthorizedRoles() throws Exception { UserRoleAuthorizationInterceptor interceptor = new UserRoleAuthorizationInterceptor(); MockRenderRequest request = new MockRenderRequest(); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java index 52a566fd3988..fdf57bb0af27 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java @@ -53,7 +53,7 @@ * @author Mark Fisher */ public class CommandControllerTests extends TestCase { - + private static final String ERRORS_KEY = "errors"; public void testRenderRequestWithNoParams() throws Exception { @@ -71,7 +71,7 @@ public void testRenderRequestWithNoParams() throws Exception { public void testRenderRequestWithParams() throws Exception { TestController tc = new TestController(); - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; int age = 30; @@ -87,10 +87,10 @@ public void testRenderRequestWithParams() throws Exception { assertNotNull(errors); assertEquals("There should be no errors", 0, errors.getErrorCount()); } - + public void testRenderRequestWithMismatch() throws Exception { TestController tc = new TestController(); - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; request.addParameter("name", name); @@ -102,11 +102,11 @@ public void testRenderRequestWithMismatch() throws Exception { assertNotNull(command); assertEquals("Name should be bound", name, command.getName()); BindException errors = (BindException)mav.getModel().get(ERRORS_KEY); - assertEquals("There should be 1 error", 1, errors.getErrorCount()); + assertEquals("There should be 1 error", 1, errors.getErrorCount()); assertNotNull(errors.getFieldError("age")); assertEquals("typeMismatch", errors.getFieldError("age").getCode()); } - + public void testRenderWhenMinimizedReturnsNull() throws Exception { TestController tc = new TestController(); assertFalse(tc.isRenderWhenMinimized()); @@ -125,13 +125,13 @@ public void testAllowRenderWhenMinimized() throws Exception { request.setContextPath("test"); MockRenderResponse response = new MockRenderResponse(); ModelAndView mav = tc.handleRenderRequest(request, response); - assertNotNull("ModelAndView should not be null", mav); + assertNotNull("ModelAndView should not be null", mav); assertEquals("test-view", mav.getViewName()); assertNotNull(mav.getModel().get(tc.getCommandName())); BindException errors = (BindException)mav.getModel().get(ERRORS_KEY); assertEquals("There should be no errors", 0, errors.getErrorCount()); } - + public void testRequiresSessionWithoutSession() throws Exception { TestController tc = new TestController(); tc.setRequireSession(true); @@ -151,7 +151,7 @@ public void testRequiresSessionWithSession() throws Exception { tc.setRequireSession(true); MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); - + // create the session request.getPortletSession(true); try { @@ -161,7 +161,7 @@ public void testRequiresSessionWithSession() throws Exception { fail("Should not have thrown PortletSessionRequiredException"); } } - + public void testRenderRequestWithoutCacheSetting() throws Exception { TestController tc = new TestController(); MockRenderRequest request = new MockRenderRequest(); @@ -176,17 +176,17 @@ public void testRenderRequestWithNegativeCacheSetting() throws Exception { tc.setCacheSeconds(-99); MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); - tc.handleRenderRequest(request, response); + tc.handleRenderRequest(request, response); String cacheProperty = response.getProperty(RenderResponse.EXPIRATION_CACHE); assertNull("Expiration-cache should be null", cacheProperty); } - + public void testRenderRequestWithZeroCacheSetting() throws Exception { TestController tc = new TestController(); tc.setCacheSeconds(0); MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); - tc.handleRenderRequest(request, response); + tc.handleRenderRequest(request, response); String cacheProperty = response.getProperty(RenderResponse.EXPIRATION_CACHE); assertEquals("Expiration-cache should be set to 0 seconds", "0", cacheProperty); } @@ -196,11 +196,11 @@ public void testRenderRequestWithPositiveCacheSetting() throws Exception { tc.setCacheSeconds(30); MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); - tc.handleRenderRequest(request, response); + tc.handleRenderRequest(request, response); String cacheProperty = response.getProperty(RenderResponse.EXPIRATION_CACHE); assertEquals("Expiration-cache should be set to 30 seconds", "30", cacheProperty); } - + public void testActionRequest() throws Exception { TestController tc = new TestController(); MockActionRequest request = new MockActionRequest(); @@ -209,14 +209,14 @@ public void testActionRequest() throws Exception { TestBean command = (TestBean)request.getPortletSession().getAttribute(tc.getRenderCommandSessionAttributeName()); assertTrue(command.isJedi()); } - + public void testSuppressBinding() throws Exception { TestController tc = new TestController() { protected boolean suppressBinding(PortletRequest request) { return true; } }; - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; int age = 30; @@ -232,7 +232,7 @@ protected boolean suppressBinding(PortletRequest request) { BindException errors = (BindException)mav.getModel().get(ERRORS_KEY); assertEquals("There should be no errors", 0, errors.getErrorCount()); } - + public void testWithCustomDateEditor() throws Exception { final DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); TestController tc = new TestController() { @@ -240,7 +240,7 @@ protected void initBinder(PortletRequest request, PortletRequestDataBinder binde binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); } }; - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; int age = 30; @@ -265,7 +265,7 @@ protected void initBinder(PortletRequest request, PortletRequestDataBinder binde binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); } }; - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; int age = 30; @@ -278,7 +278,7 @@ protected void initBinder(PortletRequest request, PortletRequestDataBinder binde assertEquals(name, command.getName()); assertEquals(age, command.getAge()); BindException errors = (BindException)mav.getModel().get(ERRORS_KEY); - assertEquals("There should be 1 error", 1, errors.getErrorCount()); + assertEquals("There should be 1 error", 1, errors.getErrorCount()); assertNotNull(errors.getFieldError("date")); assertEquals("typeMismatch", errors.getFieldError("date").getCode()); assertEquals(emptyString, errors.getFieldError("date").getRejectedValue()); @@ -291,7 +291,7 @@ protected void initBinder(PortletRequest request, PortletRequestDataBinder binde binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } }; - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; int age = 30; @@ -304,10 +304,10 @@ protected void initBinder(PortletRequest request, PortletRequestDataBinder binde assertEquals(name, command.getName()); assertEquals(age, command.getAge()); BindException errors = (BindException)mav.getModel().get(ERRORS_KEY); - assertEquals("There should be 0 errors", 0, errors.getErrorCount()); + assertEquals("There should be 0 errors", 0, errors.getErrorCount()); assertNull("date should be null", command.getDate()); } - + public void testNestedBindingWithPropertyEditor() throws Exception { TestController tc = new TestController() { protected void initBinder(PortletRequest request, PortletRequestDataBinder binder) { @@ -318,7 +318,7 @@ public void setAsText(String text) throws IllegalArgumentException { }); } }; - MockRenderRequest request = new MockRenderRequest(); + MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); String name = "test"; String spouseName = "testSpouse"; @@ -338,7 +338,7 @@ public void setAsText(String text) throws IllegalArgumentException { BindException errors = (BindException)mav.getModel().get(ERRORS_KEY); assertEquals("There should be no errors", 0, errors.getErrorCount()); } - + public void testWithValidatorNotSupportingCommandClass() throws Exception { Validator v = new Validator() { public boolean supports(Class c) { @@ -443,7 +443,7 @@ private static class TestController extends AbstractCommandController { private TestController() { super(TestBean.class, "testBean"); } - + protected void handleAction(ActionRequest request, ActionResponse response, Object command, BindException errors) { ((TestBean)command).setJedi(true); } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/ParameterizableViewControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/ParameterizableViewControllerTests.java index cef2df048c5d..dc35d85acde4 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/ParameterizableViewControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/ParameterizableViewControllerTests.java @@ -56,7 +56,7 @@ public void testInitApplicationContextWithNoViewNameSet() throws Exception { // expected } } - + public void testActionRequestNotHandled() throws Exception { ParameterizableViewController controller = new ParameterizableViewController(); ActionRequest request = new MockActionRequest(); @@ -69,5 +69,5 @@ public void testActionRequestNotHandled() throws Exception { // expected } } - + } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/PortletModeNameViewControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/PortletModeNameViewControllerTests.java index 5fa8569bb67f..008ccfaeeb67 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/PortletModeNameViewControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/PortletModeNameViewControllerTests.java @@ -33,11 +33,11 @@ public class PortletModeNameViewControllerTests extends TestCase { private PortletModeNameViewController controller; - + public void setUp() { controller = new PortletModeNameViewController(); } - + public void testEditPortletMode() throws Exception { MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); @@ -53,7 +53,7 @@ public void testHelpPortletMode() throws Exception { ModelAndView mav = controller.handleRenderRequest(request, response); assertEquals("help", mav.getViewName()); } - + public void testViewPortletMode() throws Exception { MockRenderRequest request = new MockRenderRequest(); MockRenderResponse response = new MockRenderResponse(); @@ -61,7 +61,7 @@ public void testViewPortletMode() throws Exception { ModelAndView mav = controller.handleRenderRequest(request, response); assertEquals("view", mav.getViewName()); } - + public void testActionRequest() throws Exception { MockActionRequest request = new MockActionRequest(); MockActionResponse response = new MockActionResponse(); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java index eb41b5be3f93..49b37aa7d8f8 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java index 6225c2cf7036..d2963656ef75 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/PortletAnnotationControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java index a55e0d8e964b..5a1f94d3d7ce 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/util/PortletUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-20011 the original author or authors. + * Copyright 2002-20121 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -243,7 +243,6 @@ public void testClearAllRenderParameters() throws Exception { @Test public void testClearAllRenderParametersDoesNotPropagateExceptionIfRedirectAlreadySentAtTimeOfCall() throws Exception { MockActionResponse response = new MockActionResponse() { - @SuppressWarnings("unchecked") public void setRenderParameters(Map parameters) { throw new IllegalStateException(); } @@ -300,7 +299,6 @@ public void testExposeRequestAttributesWithNullAttributesMap() throws Exception PortletUtils.exposeRequestAttributes(new MockPortletRequest(), null); } - @SuppressWarnings("unchecked") @Test public void testExposeRequestAttributesSunnyDay() throws Exception { MockPortletRequest request = new MockPortletRequest(); @@ -312,7 +310,6 @@ public void testExposeRequestAttributesSunnyDay() throws Exception { assertEquals("Roy Fokker", request.getAttribute("mentor")); } - @SuppressWarnings("unchecked") @Test public void testExposeRequestAttributesWithEmptyAttributesMapIsAnIdempotentOperation() throws Exception { MockPortletRequest request = new MockPortletRequest(); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerAdapter.java index 3be0e0902b88..27d392e7cd5a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerAdapter.java @@ -46,7 +46,7 @@ * @see org.springframework.web.servlet.handler.SimpleServletHandlerAdapter */ public interface HandlerAdapter { - + /** * Given a handler instance, return whether or not this HandlerAdapter can * support it. Typical HandlerAdapters will base the decision on the handler @@ -58,8 +58,8 @@ public interface HandlerAdapter { * @param handler handler object to check * @return whether or not this object can use the given handler */ - boolean supports(Object handler); - + boolean supports(Object handler); + /** * Use the given handler to handle this request. * The workflow that is required may vary widely. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerMapping.java index 684f54a71a64..d934336ade45 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerMapping.java @@ -93,21 +93,10 @@ public interface HandlerMapping { String URI_TEMPLATE_VARIABLES_ATTRIBUTE = HandlerMapping.class.getName() + ".uriTemplateVariables"; /** - * Name of the {@link HttpServletRequest} attribute that contains a map with - * URI matrix variables. - *

        Note: This attribute is not required to be supported by all - * HandlerMapping implementations and may also not be present depending on - * whether the HandlerMapping is configured to keep matrix variable content - * in the request URI. - */ - String MATRIX_VARIABLES_ATTRIBUTE = HandlerMapping.class.getName() + ".matrixVariables"; - - /** - * Name of the {@link HttpServletRequest} attribute that contains the set of - * producible MediaTypes applicable to the mapped handler. - *

        Note: This attribute is not required to be supported by all - * HandlerMapping implementations. Handlers should not necessarily expect - * this request attribute to be present in all scenarios. + * Name of the {@link HttpServletRequest} attribute that contains the set of producible MediaTypes + * applicable to the mapped handler. + *

        Note: This attribute is not required to be supported by all HandlerMapping implementations. + * Handlers should not necessarily expect this request attribute to be present in all scenarios. */ String PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE = HandlerMapping.class.getName() + ".producibleMediaTypes"; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/HttpServletBean.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/HttpServletBean.java index e35e00ccfa96..1a50f588a407 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/HttpServletBean.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/HttpServletBean.java @@ -86,7 +86,7 @@ public abstract class HttpServletBean extends HttpServlet /** Logger available to subclasses */ protected final Log logger = LogFactory.getLog(getClass()); - /** + /** * Set of required properties (Strings) that must be supplied as * config parameters to this servlet. */ @@ -230,13 +230,13 @@ private static class ServletConfigPropertyValues extends MutablePropertyValues { */ public ServletConfigPropertyValues(ServletConfig config, Set requiredProperties) throws ServletException { - + Set missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ? new HashSet(requiredProperties) : null; - Enumeration en = config.getInitParameterNames(); + Enumeration en = config.getInitParameterNames(); while (en.hasMoreElements()) { - String property = (String) en.nextElement(); + String property = en.nextElement(); Object value = config.getInitParameter(property); addPropertyValue(new PropertyValue(property, value)); if (missingProps != null) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/ModelAndViewDefiningException.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/ModelAndViewDefiningException.java index 36ef10866fc0..52f3d7c29ebf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/ModelAndViewDefiningException.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/ModelAndViewDefiningException.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/ResourceServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/ResourceServlet.java index 3f40bbd08c68..dea8fddc9919 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/ResourceServlet.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/ResourceServlet.java @@ -29,7 +29,7 @@ import org.springframework.web.context.support.ServletContextResource; /** - * Simple servlet that can expose an internal resource, including a + * Simple servlet that can expose an internal resource, including a * default URL if the specified resource is not found. An alternative, * for example, to trying and catching exceptions when using JSP include. * diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/SmartView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/SmartView.java index 3ac6526f669e..209c1bc092c3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/SmartView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/SmartView.java @@ -17,8 +17,8 @@ package org.springframework.web.servlet; /** - * Provides additional information about a View such as whether it - * performs redirects. + * Provides additional information about a View such as whether it + * performs redirects. * * @author Rossen Stoyanchev * @since 3.1 diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/ThemeResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/ThemeResolver.java index c1463fc9e946..c44619e313fc 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/ThemeResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/ThemeResolver.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/ViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/ViewResolver.java index 650c6a6e5f24..12868f403ec6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/ViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/ViewResolver.java @@ -35,12 +35,12 @@ */ public interface ViewResolver { - /** + /** * Resolve the given view by name. *

        Note: To allow for ViewResolver chaining, a ViewResolver should * return null if a view with the given name is not defined in it. * However, this is not required: Some ViewResolvers will always attempt - * to build View objects with the given name, unable to return null + * to build View objects with the given name, unable to return null * (rather throwing an exception when View creation failed). * @param viewName name of the view to resolve * @param locale Locale in which to resolve the view. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java index a13aeacf4d09..50113d7b8d15 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java @@ -433,9 +433,8 @@ else if (jacksonPresent) { return messageConverters; } - private RootBeanDefinition createConverterBeanDefinition( - Class converterClass, Object source) { - + private RootBeanDefinition createConverterBeanDefinition(@SuppressWarnings("rawtypes") Class converterClass, + Object source) { RootBeanDefinition beanDefinition = new RootBeanDefinition(converterClass); beanDefinition.setSource(source); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/DefaultServletHandlerBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/DefaultServletHandlerBeanDefinitionParser.java index c85df5151709..d842b4d689c0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/DefaultServletHandlerBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/DefaultServletHandlerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ import org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler; /** - * {@link BeanDefinitionParser} that parses a {@code default-servlet-handler} element to - * register a {@link DefaultServletHttpRequestHandler}. Will also register a - * {@link SimpleUrlHandlerMapping} for mapping resource requests, and a - * {@link HttpRequestHandlerAdapter}. - * + * {@link BeanDefinitionParser} that parses a {@code default-servlet-handler} element to + * register a {@link DefaultServletHttpRequestHandler}. Will also register a + * {@link SimpleUrlHandlerMapping} for mapping resource requests, and a + * {@link HttpRequestHandlerAdapter}. + * * @author Jeremy Grelle * @author Rossen Stoyanchev * @since 3.0.4 @@ -45,8 +45,8 @@ class DefaultServletHandlerBeanDefinitionParser implements BeanDefinitionParser public BeanDefinition parse(Element element, ParserContext parserContext) { Object source = parserContext.extractSource(element); - - String defaultServletName = element.getAttribute("default-servlet-name"); + + String defaultServletName = element.getAttribute("default-servlet-name"); RootBeanDefinition defaultServletHandlerDef = new RootBeanDefinition(DefaultServletHttpRequestHandler.class); defaultServletHandlerDef.setSource(source); defaultServletHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); @@ -56,20 +56,20 @@ public BeanDefinition parse(Element element, ParserContext parserContext) { String defaultServletHandlerName = parserContext.getReaderContext().generateBeanName(defaultServletHandlerDef); parserContext.getRegistry().registerBeanDefinition(defaultServletHandlerName, defaultServletHandlerDef); parserContext.registerComponent(new BeanComponentDefinition(defaultServletHandlerDef, defaultServletHandlerName)); - + Map urlMap = new ManagedMap(); urlMap.put("/**", defaultServletHandlerName); - + RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class); handlerMappingDef.setSource(source); handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); handlerMappingDef.getPropertyValues().add("urlMap", urlMap); - + String handlerMappingBeanName = parserContext.getReaderContext().generateBeanName(handlerMappingDef); parserContext.getRegistry().registerBeanDefinition(handlerMappingBeanName, handlerMappingDef); parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingBeanName)); - - // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off" + + // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off" MvcNamespaceUtils.registerDefaultComponents(parserContext, source); return null; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java index 167963844d34..54b479558dc2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java @@ -48,8 +48,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) { mappedInterceptorDef.setSource(parserContext.extractSource(interceptor)); mappedInterceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); - ManagedList includePatterns = null; - ManagedList excludePatterns = null; + String[] pathPatterns; Object interceptorBean; if ("interceptor".equals(interceptor.getLocalName())) { includePatterns = getIncludePatterns(interceptor, "mapping"); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceHandler.java index ecf70c794b9d..2b4af21e86f2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceHandler.java @@ -31,7 +31,7 @@ public class MvcNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenBeanDefinitionParser()); registerBeanDefinitionParser("default-servlet-handler", new DefaultServletHandlerBeanDefinitionParser()); - registerBeanDefinitionParser("interceptors", new InterceptorsBeanDefinitionParser()); + registerBeanDefinitionParser("interceptors", new InterceptorsBeanDefinitionParser()); registerBeanDefinitionParser("resources", new ResourcesBeanDefinitionParser()); registerBeanDefinitionParser("view-controller", new ViewControllerBeanDefinitionParser()); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java index 49db0579e4d1..a0defb43f11e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java @@ -26,19 +26,19 @@ /** * Convenience methods for use in MVC namespace BeanDefinitionParsers. - * + * * @author Rossen Stoyanchev * @since 3.1 */ abstract class MvcNamespaceUtils { - private static final String BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME = + private static final String BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME = BeanNameUrlHandlerMapping.class.getName(); - private static final String SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME = + private static final String SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME = SimpleControllerHandlerAdapter.class.getName(); - private static final String HTTP_REQUEST_HANDLER_ADAPTER_BEAN_NAME = + private static final String HTTP_REQUEST_HANDLER_ADAPTER_BEAN_NAME = HttpRequestHandlerAdapter.class.getName(); public static void registerDefaultComponents(ParserContext parserContext, Object source) { @@ -48,7 +48,7 @@ public static void registerDefaultComponents(ParserContext parserContext, Object } /** - * Registers an {@link HttpRequestHandlerAdapter} under a well-known + * Registers an {@link HttpRequestHandlerAdapter} under a well-known * name unless already registered. */ private static void registerBeanNameUrlHandlerMapping(ParserContext parserContext, Object source) { @@ -63,7 +63,7 @@ private static void registerBeanNameUrlHandlerMapping(ParserContext parserContex } /** - * Registers an {@link HttpRequestHandlerAdapter} under a well-known + * Registers an {@link HttpRequestHandlerAdapter} under a well-known * name unless already registered. */ private static void registerHttpRequestHandlerAdapter(ParserContext parserContext, Object source) { @@ -75,9 +75,9 @@ private static void registerHttpRequestHandlerAdapter(ParserContext parserContex parserContext.registerComponent(new BeanComponentDefinition(handlerAdapterDef, HTTP_REQUEST_HANDLER_ADAPTER_BEAN_NAME)); } } - + /** - * Registers a {@link SimpleControllerHandlerAdapter} under a well-known + * Registers a {@link SimpleControllerHandlerAdapter} under a well-known * name unless already registered. */ private static void registerSimpleControllerHandlerAdapter(ParserContext parserContext, Object source) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java index fa44b4628a9f..69dc5290c778 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,9 +88,6 @@ private String registerResourceHandler(ParserContext parserContext, Element elem return null; } - ManagedList locations = new ManagedList(); - locations.addAll(StringUtils.commaDelimitedListToSet(locationAttr)); - RootBeanDefinition resourceHandlerDef = new RootBeanDefinition(ResourceHttpRequestHandler.class); resourceHandlerDef.setSource(source); resourceHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewControllerBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewControllerBeanDefinitionParser.java index a3e423b7f0ac..cf076a038ffb 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewControllerBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewControllerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,24 +39,25 @@ */ class ViewControllerBeanDefinitionParser implements BeanDefinitionParser { - private static final String HANDLER_MAPPING_BEAN_NAME = + private static final String HANDLER_MAPPING_BEAN_NAME = "org.springframework.web.servlet.config.viewControllerHandlerMapping"; + @SuppressWarnings("unchecked") public BeanDefinition parse(Element element, ParserContext parserContext) { Object source = parserContext.extractSource(element); // Register SimpleUrlHandlerMapping for view controllers BeanDefinition handlerMappingDef = registerHandlerMapping(parserContext, source); - // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off" + // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off" MvcNamespaceUtils.registerDefaultComponents(parserContext, source); // Create view controller bean definition RootBeanDefinition viewControllerDef = new RootBeanDefinition(ParameterizableViewController.class); viewControllerDef.setSource(source); if (element.hasAttribute("view-name")) { - viewControllerDef.getPropertyValues().add("viewName", element.getAttribute("view-name")); + viewControllerDef.getPropertyValues().add("viewName", element.getAttribute("view-name")); } Map urlMap; if (handlerMappingDef.getPropertyValues().contains("urlMap")) { @@ -64,13 +65,13 @@ public BeanDefinition parse(Element element, ParserContext parserContext) { } else { urlMap = new ManagedMap(); - handlerMappingDef.getPropertyValues().add("urlMap", urlMap); + handlerMappingDef.getPropertyValues().add("urlMap", urlMap); } urlMap.put(element.getAttribute("path"), viewControllerDef); return null; } - + private BeanDefinition registerHandlerMapping(ParserContext parserContext, Object source) { if (!parserContext.getRegistry().containsBeanDefinition(HANDLER_MAPPING_BEAN_NAME)) { RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/DefaultServletHandlerConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/DefaultServletHandlerConfigurer.java index 1506df31ccd9..77a68a6349e0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/DefaultServletHandlerConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/DefaultServletHandlerConfigurer.java @@ -29,9 +29,9 @@ import org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler; /** - * Configures a request handler for serving static resources by forwarding the request to the Servlet container's - * "default" Servlet. This is intended to be used when the Spring MVC {@link DispatcherServlet} is mapped to "/" - * thus overriding the Servlet container's default handling of static resources. Since this handler is configured + * Configures a request handler for serving static resources by forwarding the request to the Servlet container's + * "default" Servlet. This is indended to be used when the Spring MVC {@link DispatcherServlet} is mapped to "/" + * thus overriding the Servlet container's default handling of static resources. Since this handler is configured * at the lowest precedence, effectively it allows all other handler mappings to handle the request, and if none * of them do, this handler can forward it to the "default" Servlet. * @@ -57,7 +57,7 @@ public DefaultServletHandlerConfigurer(ServletContext servletContext) { /** * Enable forwarding to the "default" Servlet. When this method is used the {@link DefaultServletHttpRequestHandler} - * will try to auto-detect the "default" Servlet name. Alternatively, you can specify the name of the default + * will try to auto-detect the "default" Servlet name. Alternatively, you can specify the name of the default * Servlet via {@link #enable(String)}. * @see DefaultServletHttpRequestHandler */ @@ -78,14 +78,14 @@ public void enable(String defaultServletName) { /** * Return a handler mapping instance ordered at {@link Integer#MAX_VALUE} containing the - * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; or {@code null} if + * {@link DefaultServletHttpRequestHandler} instance mapped to {@code "/**"}; or {@code null} if * default servlet handling was not been enabled. */ protected AbstractHandlerMapping getHandlerMapping() { if (handler == null) { return null; } - + Map urlMap = new HashMap(); urlMap.put("/**", handler); @@ -95,4 +95,4 @@ protected AbstractHandlerMapping getHandlerMapping() { return handlerMapping; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/EnableWebMvc.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/EnableWebMvc.java index 9928410edb2c..2daa59c4761c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/EnableWebMvc.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/EnableWebMvc.java @@ -23,7 +23,7 @@ /** * Add this annotation to an {@code @Configuration} class to have the Spring MVC * configuration defined in {@link WebMvcConfigurationSupport} imported: - * + * *

          * @Configuration
          * @EnableWebMvc
        @@ -33,9 +33,9 @@
          * }
          * 
        *

        Customize the imported configuration by implementing the - * {@link WebMvcConfigurer} interface or more likely by extending the - * {@link WebMvcConfigurerAdapter} base class and overriding individual methods: - * + * {@link WebMvcConfigurer} interface or more likely by extending the + * {@link WebMvcConfigurerAdapter} base class and overriding individual methods: + * *

          * @Configuration
          * @EnableWebMvc
        @@ -56,11 +56,11 @@
          * }
          * 
        * - *

        If the customization options of {@link WebMvcConfigurer} do not expose - * something you need to configure, consider removing the {@code @EnableWebMvc} - * annotation and extending directly from {@link WebMvcConfigurationSupport} + *

        If the customization options of {@link WebMvcConfigurer} do not expose + * something you need to configure, consider removing the {@code @EnableWebMvc} + * annotation and extending directly from {@link WebMvcConfigurationSupport} * overriding selected {@code @Bean} methods: - * + * *

          * @Configuration
          * @ComponentScan(basePackageClasses = { MyConfiguration.class })
        diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistration.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistration.java
        index f1a43d717d89..3fcbd6002bbd 100644
        --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistration.java
        +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistration.java
        @@ -26,7 +26,8 @@
         import org.springframework.web.servlet.handler.MappedInterceptor;
         
         /**
        - * Assists with the creation of a {@link MappedInterceptor}.
        + * Encapsulates a {@link HandlerInterceptor} and an optional list of URL patterns.
        + * Results in the creation of a {@link MappedInterceptor} if URL patterns are provided.
          *
          * @author Rossen Stoyanchev
          * @author Keith Donald
        @@ -36,9 +37,7 @@ public class InterceptorRegistration {
         
         	private final HandlerInterceptor interceptor;
         
        -	private final List includePatterns = new ArrayList();
        -
        -	private final List excludePatterns = new ArrayList();
        +	private final List pathPatterns = new ArrayList();
         
         	/**
         	 * Creates an {@link InterceptorRegistration} instance.
        @@ -56,14 +55,6 @@ public InterceptorRegistration addPathPatterns(String... patterns) {
         		return this;
         	}
         
        -	/**
        -	 * Add URL patterns to which the registered interceptor should not apply to.
        -	 */
        -	public InterceptorRegistration excludePathPatterns(String... patterns) {
        -		this.excludePatterns.addAll(Arrays.asList(patterns));
        -		return this;
        -	}
        -
         	/**
         	 * Returns the underlying interceptor. If URL patterns are provided the returned type is
         	 * {@link MappedInterceptor}; otherwise {@link HandlerInterceptor}.
        diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistry.java
        index 5e2f45eecf66..356a46e85c45 100644
        --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistry.java
        +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/InterceptorRegistry.java
        @@ -24,7 +24,8 @@
         import org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter;
         
         /**
        - * Helps with configuring a list of mapped interceptors.
        + * Stores and provides access to a list of interceptors. For each interceptor you can optionally
        + * specify one or more URL patterns it applies to.
          *
          * @author Rossen Stoyanchev
          * @author Keith Donald
        diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java
        index cbad096879bf..b406d284ae49 100644
        --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java
        +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java
        @@ -27,25 +27,25 @@
         
         /**
          * Encapsulates information required to create a resource handlers.
        - * 
        + *
          * @author Rossen Stoyanchev
          * @author Keith Donald
        - * 
        + *
          * @since 3.1
          */
         public class ResourceHandlerRegistration {
         
         	private final ResourceLoader resourceLoader;
        -	
        +
         	private final String[] pathPatterns;
        -	
        +
         	private final List locations = new ArrayList();
        -	
        +
         	private Integer cachePeriod;
         
         	/**
         	 * Create a {@link ResourceHandlerRegistration} instance.
        -	 * @param resourceLoader a resource loader for turning a String location into a {@link Resource} 
        +	 * @param resourceLoader a resource loader for turning a String location into a {@link Resource}
         	 * @param pathPatterns one or more resource URL path patterns
         	 */
         	public ResourceHandlerRegistration(ResourceLoader resourceLoader, String... pathPatterns) {
        @@ -53,7 +53,7 @@ public ResourceHandlerRegistration(ResourceLoader resourceLoader, String... path
         		this.resourceLoader = resourceLoader;
         		this.pathPatterns = pathPatterns;
         	}
        -	
        +
         	/**
         	 * Add one or more resource locations from which to serve static content. Each location must point to a valid
         	 * directory. Multiple locations may be specified as a comma-separated list, and the locations will be checked
        @@ -69,7 +69,7 @@ public ResourceHandlerRegistration addResourceLocations(String...resourceLocatio
         		}
         		return this;
         	}
        -	
        +
         	/**
         	 * Specify the cache period for the resources served by the resource handler, in seconds. The default is to not
         	 * send any cache headers but to rely on last-modified timestamps only. Set to 0 in order to send cache headers
        diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java
        index e95cc82aacac..d3524153dc1a 100644
        --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java
        +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java
        @@ -32,15 +32,15 @@
         import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
         
         /**
        - * Stores registrations of resource handlers for serving static resources such as images, css files and others 
        - * through Spring MVC including setting cache headers optimized for efficient loading in a web browser. 
        + * Stores registrations of resource handlers for serving static resources such as images, css files and others
        + * through Spring MVC including setting cache headers optimized for efficient loading in a web browser.
          * Resources can be served out of locations under web application root, from the classpath, and others.
          *
        - * 

        To create a resource handler, use {@link #addResourceHandler(String...)} providing the URL path patterns + *

        To create a resource handler, use {@link #addResourceHandler(String...)} providing the URL path patterns * for which the handler should be invoked to serve static resources (e.g. {@code "/resources/**"}). * - *

        Then use additional methods on the returned {@link ResourceHandlerRegistration} to add one or more - * locations from which to serve static content from (e.g. {{@code "/"}, + *

        Then use additional methods on the returned {@link ResourceHandlerRegistration} to add one or more + * locations from which to serve static content from (e.g. {{@code "/"}, * {@code "classpath:/META-INF/public-web-resources/"}}) or to specify a cache period for served resources. * * @author Rossen Stoyanchev @@ -57,7 +57,7 @@ public class ResourceHandlerRegistry { private final List registrations = new ArrayList(); private int order = Integer.MAX_VALUE -1; - + public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext) { Assert.notNull(applicationContext, "ApplicationContext is required"); this.applicationContext = applicationContext; @@ -108,4 +108,4 @@ protected AbstractHandlerMapping getHandlerMapping() { return handlerMapping; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistration.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistration.java index 48700f905d78..155aa38536c1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistration.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistration.java @@ -22,7 +22,7 @@ /** * Encapsulates information required to create a view controller. - * + * * @author Rossen Stoyanchev * @author Keith Donald * @since 3.1 @@ -30,7 +30,7 @@ public class ViewControllerRegistration { private final String urlPath; - + private String viewName; /** @@ -41,11 +41,11 @@ public ViewControllerRegistration(String urlPath) { Assert.notNull(urlPath, "A URL path is required to create a view controller."); this.urlPath = urlPath; } - + /** - * Sets the view name to use for this view controller. This field is optional. If not specified the + * Sets the view name to use for this view controller. This field is optional. If not specified the * view controller will return a {@code null} view name, which will be resolved through the configured - * {@link RequestToViewNameTranslator}. By default that means "/foo/bar" would resolve to "foo/bar". + * {@link RequestToViewNameTranslator}. By default that means "/foo/bar" would resolve to "foo/bar". */ public void setViewName(String viewName) { this.viewName = viewName; @@ -66,5 +66,5 @@ protected Object getViewController() { controller.setViewName(viewName); return controller; } - + } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistry.java index 55d3d457d050..f07e84a33f2e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistry.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistry.java @@ -26,8 +26,8 @@ import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; /** - * Stores registrations of view controllers. A view controller does nothing more than return a specified - * view name. It saves you from having to write a controller when you want to forward the request straight + * Stores registrations of view controllers. A view controller does nothing more than return a specified + * view name. It saves you from having to write a controller when you want to forward the request straight * through to a view such as a JSP. * * @author Rossen Stoyanchev @@ -37,7 +37,7 @@ public class ViewControllerRegistry { private final List registrations = new ArrayList(); - + private int order = 1; public ViewControllerRegistration addViewController(String urlPath) { @@ -45,10 +45,10 @@ public ViewControllerRegistration addViewController(String urlPath) { registrations.add(registration); return registration; } - + /** - * Specify the order to use for ViewControllers mappings relative to other {@link HandlerMapping}s - * configured in the Spring MVC application context. The default value for view controllers is 1, + * Specify the order to use for ViewControllers mappings relative to other {@link HandlerMapping}s + * configured in the Spring MVC application context. The default value for view controllers is 1, * which is 1 higher than the value used for annotated controllers. */ public void setOrder(int order) { @@ -67,11 +67,11 @@ protected AbstractHandlerMapping getHandlerMapping() { for (ViewControllerRegistration registration : registrations) { urlMap.put(registration.getUrlPath(), registration.getViewController()); } - + SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setOrder(order); handlerMapping.setUrlMap(urlMap); return handlerMapping; } - -} \ No newline at end of file + +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java index ac63b1cbca93..6f6c82733c03 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java @@ -128,4 +128,4 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java index 856d0b62db3a..c09aa1b7c375 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,9 +51,9 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti private int order = Ordered.LOWEST_PRECEDENCE; - private Set mappedHandlers; + private Set mappedHandlers; - private Class[] mappedHandlerClasses; + private Class[] mappedHandlerClasses; private Log warnLogger; @@ -76,7 +76,7 @@ public int getOrder() { * as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be * ignored in this case. */ - public void setMappedHandlers(Set mappedHandlers) { + public void setMappedHandlers(Set mappedHandlers) { this.mappedHandlers = mappedHandlers; } @@ -89,7 +89,7 @@ public void setMappedHandlers(Set mappedHandlers) { * as fallback for all exceptions; any further HandlerExceptionResolvers in the chain will be * ignored in this case. */ - public void setMappedHandlerClasses(Class[] mappedHandlerClasses) { + public void setMappedHandlerClasses(Class[] mappedHandlerClasses) { this.mappedHandlerClasses = mappedHandlerClasses; } @@ -158,7 +158,7 @@ protected boolean shouldApplyTo(HttpServletRequest request, Object handler) { return true; } if (this.mappedHandlerClasses != null) { - for (Class handlerClass : this.mappedHandlerClasses) { + for (Class handlerClass : this.mappedHandlerClasses) { if (handlerClass.isInstance(handler)) { return true; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodExceptionResolver.java index 1f31c9f17253..80420aff4fed 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodExceptionResolver.java @@ -33,9 +33,9 @@ public abstract class AbstractHandlerMethodExceptionResolver extends AbstractHandlerExceptionResolver { /** - * Checks if the handler is a {@link HandlerMethod} and then delegates to the - * base class implementation of {@link #shouldApplyTo(HttpServletRequest, Object)} - * passing the bean of the {@code HandlerMethod}. Otherwise returns {@code false}. + * Checks if the handler is a {@link HandlerMethod} instance and performs the check against the bean + * instance it contains. If the provided handler is not an instance of {@link HandlerMethod}, + * {@code false} is returned instead. */ @Override protected boolean shouldApplyTo(HttpServletRequest request, Object handler) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/ConversionServiceExposingInterceptor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/ConversionServiceExposingInterceptor.java index f32c255c01a2..40e5e6025dd9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/ConversionServiceExposingInterceptor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/ConversionServiceExposingInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ * @since 3.0.1 */ public class ConversionServiceExposingInterceptor extends HandlerInterceptorAdapter { - + private final ConversionService conversionService; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/DispatcherServletWebRequest.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/DispatcherServletWebRequest.java index 7d039a15b0fc..46a8438fc0a6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/DispatcherServletWebRequest.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/DispatcherServletWebRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java index 47463cad5528..f9e1e7c393ba 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java @@ -47,7 +47,7 @@ public int getOrder() { } /** - * Set the list of exception resolvers to delegate to. + * Set the list of exception resolvers to delegate to. */ public void setExceptionResolvers(List exceptionResolvers) { this.resolvers = exceptionResolvers; @@ -61,7 +61,7 @@ public List getExceptionResolvers() { } /** - * Resolve the exception by iterating over the list of configured exception resolvers. + * Resolve the exception by iterating over the list of configured exception resolvers. * The first one to return a ModelAndView instance wins. Otherwise {@code null} is returned. */ public ModelAndView resolveException(HttpServletRequest request, diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java index 2af452e0bf2e..d6b4d427d405 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java @@ -30,9 +30,7 @@ */ public final class MappedInterceptor { - private final String[] includePatterns; - - private final String[] excludePatterns; + private final String[] pathPatterns; private final HandlerInterceptor interceptor; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletHandlerAdapter.java index 189e674d75ff..a0ce3299fbf9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletHandlerAdapter.java @@ -59,7 +59,7 @@ public boolean supports(Object handler) { public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - + ((Servlet) handler).service(request, response); return null; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java index a6dccad59003..6ff515edf77e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.java index 383c6d20e509..9d798afc3356 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.java @@ -54,7 +54,7 @@ * @see BeanNameUrlHandlerMapping */ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping { - + private final Map urlMap = new HashMap(); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java index 050d7d7927bf..9e09881ee774 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java index 638133a71e0f..56a7b29f3edc 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java @@ -45,5 +45,5 @@ public void setLocale(HttpServletRequest request, HttpServletResponse response, throw new UnsupportedOperationException( "Cannot change HTTP accept header - use a different locale resolution strategy"); } - + } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/SessionLocaleResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/SessionLocaleResolver.java index 021272717786..230e1cc7b6c1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/SessionLocaleResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/SessionLocaleResolver.java @@ -50,7 +50,7 @@ public class SessionLocaleResolver extends AbstractLocaleResolver { * @see org.springframework.web.servlet.support.RequestContextUtils#getLocale */ public static final String LOCALE_SESSION_ATTRIBUTE_NAME = SessionLocaleResolver.class.getName() + ".LOCALE"; - + public Locale resolveLocale(HttpServletRequest request) { Locale locale = (Locale) WebUtils.getSessionAttribute(request, LOCALE_SESSION_ATTRIBUTE_NAME); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractCommandController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractCommandController.java index 81df88d30875..375e61535212 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractCommandController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractCommandController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public AbstractCommandController() { * Create a new AbstractCommandController. * @param commandClass class of the command bean */ - public AbstractCommandController(Class commandClass) { + public AbstractCommandController(Class commandClass) { setCommandClass(commandClass); } @@ -71,7 +71,7 @@ public AbstractCommandController(Class commandClass) { * @param commandClass class of the command bean * @param commandName name of the command bean */ - public AbstractCommandController(Class commandClass, String commandName) { + public AbstractCommandController(Class commandClass, String commandName) { setCommandClass(commandClass); setCommandName(commandName); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java index f20d4df337fb..ab85c87aa926 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractController.java @@ -27,7 +27,7 @@ /** *

        Convenient superclass for controller implementations, using the Template * Method design pattern.

        - * + * *

        As stated in the {@link org.springframework.web.servlet.mvc.Controller Controller} * interface, a lot of functionality is already provided by certain abstract * base controllers. The AbstractController is one of the most important @@ -149,7 +149,7 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletRespons } } } - + return handleRequestInternal(request, response); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractFormController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractFormController.java index 4b1518f1c9ff..c31b1eeac449 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractFormController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractFormController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ * gets applied to populate the new form object with initial request parameters and the * {@link #onBindOnNewForm(HttpServletRequest, Object, BindException)} callback method is * called. Note: any defined Validators are not applied at this point, to allow - * partial binding. However be aware that any Binder customizations applied via + * partial binding. However be aware that any Binder customizations applied via * initBinder() (such as * {@link org.springframework.validation.DataBinder#setRequiredFields(String[])} will * still apply. As such, if using bindOnNewForm=true and initBinder() customizations are @@ -556,7 +556,7 @@ protected final ModelAndView showForm(HttpServletRequest request, BindException * @throws Exception in case of invalid state or arguments */ protected final ModelAndView showForm( - HttpServletRequest request, BindException errors, String viewName, Map controlModel) + HttpServletRequest request, BindException errors, String viewName, Map controlModel) throws Exception { // In session form mode, re-expose form object as HTTP session attribute. @@ -572,10 +572,10 @@ protected final ModelAndView showForm( // Fetch errors model as starting point, containing form object under // "commandName", and corresponding Errors instance under internal key. - Map model = errors.getModel(); + Map model = errors.getModel(); // Merge reference data into model, if any. - Map referenceData = referenceData(request, errors.getTarget(), errors); + Map referenceData = referenceData(request, errors.getTarget(), errors); if (referenceData != null) { model.putAll(referenceData); } @@ -601,7 +601,7 @@ protected final ModelAndView showForm( * @throws Exception in case of invalid state or arguments * @see ModelAndView */ - protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { + protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { return null; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractWizardFormController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractWizardFormController.java index c9aafcab00b0..c62482dd3c9a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractWizardFormController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/AbstractWizardFormController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -265,7 +265,7 @@ protected boolean isFormSubmission(HttpServletRequest request) { * Calls page-specific referenceData method. */ @Override - protected final Map referenceData(HttpServletRequest request, Object command, Errors errors) + protected final Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { return referenceData(request, command, errors, getCurrentPage(request)); @@ -285,7 +285,7 @@ protected final Map referenceData(HttpServletRequest request, Object command, Er * @see #referenceData(HttpServletRequest, int) * @see ModelAndView */ - protected Map referenceData(HttpServletRequest request, Object command, Errors errors, int page) + protected Map referenceData(HttpServletRequest request, Object command, Errors errors, int page) throws Exception { return referenceData(request, page); @@ -302,7 +302,7 @@ protected Map referenceData(HttpServletRequest request, Object command, Errors e * @throws Exception in case of invalid state or arguments * @see ModelAndView */ - protected Map referenceData(HttpServletRequest request, int page) throws Exception { + protected Map referenceData(HttpServletRequest request, int page) throws Exception { return null; } @@ -350,7 +350,7 @@ protected final ModelAndView showPage(HttpServletRequest request, BindException request.setAttribute(pageAttrName, pageInteger); // Set page request attribute for evaluation by views. - Map controlModel = new HashMap(); + Map controlModel = new HashMap(); if (this.pageAttribute != null) { controlModel.put(this.pageAttribute, new Integer(page)); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/BaseCommandController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/BaseCommandController.java index 9082bbf993bf..accb9a4efa9f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/BaseCommandController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/BaseCommandController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ * JavaBeans based on request parameters, validate the content of such * JavaBeans using {@link org.springframework.validation.Validator Validators} * and use custom editors (in the form of - * {@link java.beans.PropertyEditor PropertyEditors}) to transform + * {@link java.beans.PropertyEditor PropertyEditors}) to transform * objects into strings and vice versa, for example. Three notions are mentioned here:

        * *

        Command class:
        @@ -50,7 +50,7 @@ * Upon receiving a request, any BaseCommandController will attempt to fill the * command object using the request parameters. This is done using the typical * and well-known JavaBeans property notation. When a request parameter named - * 'firstName' exists, the framework will attempt to call + * 'firstName' exists, the framework will attempt to call * setFirstName([value]) passing the value of the parameter. Nested properties * are of course supported. For instance a parameter named 'address.city' * will result in a getAddress().setCity([value]) call on the @@ -142,7 +142,7 @@ public abstract class BaseCommandController extends AbstractController { private String commandName = DEFAULT_COMMAND_NAME; - private Class commandClass; + private Class commandClass; private Validator[] validators; @@ -176,14 +176,14 @@ public final String getCommandName() { * Set the command class for this controller. * An instance of this class gets populated and validated on each request. */ - public final void setCommandClass(Class commandClass) { + public final void setCommandClass(Class commandClass) { this.commandClass = commandClass; } /** * Return the command class for this controller. */ - public final Class getCommandClass() { + public final Class getCommandClass() { return this.commandClass; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java index 68499f29455c..657d5fb05967 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ParameterizableViewController.java @@ -68,7 +68,7 @@ * @author Keith Donald */ public class ParameterizableViewController extends AbstractController { - + private String viewName; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletForwardingController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletForwardingController.java index 3ddaa4fb6941..5322957ce52a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletForwardingController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletForwardingController.java @@ -90,7 +90,7 @@ public class ServletForwardingController extends AbstractController implements B private String servletName; private String beanName; - + /** * Set the name of the servlet to forward to, diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletWrappingController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletWrappingController.java index f258c9652ed7..3ee001feeca9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletWrappingController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/ServletWrappingController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,7 +87,7 @@ public class ServletWrappingController extends AbstractController implements BeanNameAware, InitializingBean, DisposableBean { - private Class servletClass; + private Class servletClass; private String servletName; @@ -103,7 +103,7 @@ public class ServletWrappingController extends AbstractController * Needs to implement javax.servlet.Servlet. * @see javax.servlet.Servlet */ - public void setServletClass(Class servletClass) { + public void setServletClass(Class servletClass) { this.servletClass = servletClass; } @@ -189,6 +189,7 @@ public String getInitParameter(String paramName) { return initParameters.getProperty(paramName); } + @SuppressWarnings({ "unchecked", "rawtypes" }) public Enumeration getInitParameterNames() { return initParameters.keys(); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/SimpleFormController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/SimpleFormController.java index dda32c093a70..6ad2ae1a87d6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/SimpleFormController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/SimpleFormController.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -195,7 +195,7 @@ protected ModelAndView showForm( * @see #setFormView */ protected ModelAndView showForm( - HttpServletRequest request, HttpServletResponse response, BindException errors, Map controlModel) + HttpServletRequest request, HttpServletResponse response, BindException errors, Map controlModel) throws Exception { return showForm(request, errors, getFormView(), controlModel); @@ -214,7 +214,7 @@ protected ModelAndView showForm( * @see ModelAndView */ @Override - protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { + protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { return referenceData(request); } @@ -230,7 +230,7 @@ protected Map referenceData(HttpServletRequest request, Object command, Errors e * @see #referenceData(HttpServletRequest, Object, Errors) * @see ModelAndView */ - protected Map referenceData(HttpServletRequest request) throws Exception { + protected Map referenceData(HttpServletRequest request) throws Exception { return null; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/UrlFilenameViewController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/UrlFilenameViewController.java index 00d4f03035b6..faff41fb9f41 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/UrlFilenameViewController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/UrlFilenameViewController.java @@ -26,7 +26,7 @@ /** * Simple Controller implementation that transforms the virtual * path of a URL into a view name and returns that view. - * + * *

        Can optionally prepend a {@link #setPrefix prefix} and/or append a * {@link #setSuffix suffix} to build the viewname from the URL filename. * diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java index f78fa50f7bd9..b051b7c9aa1b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,7 +117,7 @@ public void setUrlPathHelper(UrlPathHelper urlPathHelper) { */ public void setCacheMappings(Properties cacheMappings) { this.cacheMappings.clear(); - Enumeration propNames = cacheMappings.propertyNames(); + Enumeration propNames = cacheMappings.propertyNames(); while (propNames.hasMoreElements()) { String path = (String) propNames.nextElement(); this.cacheMappings.put(path, Integer.valueOf(cacheMappings.getProperty(path))); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index 29859d39b958..2c72a86ca5da 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -42,6 +42,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.xml.transform.Source; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -200,7 +201,7 @@ public AnnotationMethodHandlerAdapter() { StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); stringHttpMessageConverter.setWriteAcceptCharset(false); this.messageConverters = new HttpMessageConverter[]{new ByteArrayHttpMessageConverter(), stringHttpMessageConverter, - new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()}; + new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()}; } @@ -460,7 +461,7 @@ public long getLastModified(HttpServletRequest request, Object handler) { * Build a HandlerMethodResolver for the given handler type. */ private ServletHandlerMethodResolver getMethodResolver(Object handler) { - Class handlerClass = ClassUtils.getUserClass(handler); + Class handlerClass = ClassUtils.getUserClass(handler); ServletHandlerMethodResolver resolver = this.methodResolverCache.get(handlerClass); if (resolver == null) { synchronized (this.methodResolverCache) { @@ -774,7 +775,7 @@ private ServletHandlerMethodInvoker(HandlerMethodResolver resolver) { } @Override - protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception { + protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception { throw new MissingServletRequestParameterException(paramName, paramType.getSimpleName()); } @@ -823,7 +824,7 @@ protected Object resolveDefaultValue(String value) { } @Override - protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) + protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) throws Exception { HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); @@ -841,7 +842,7 @@ else if (cookieValue != null) { @Override @SuppressWarnings({"unchecked"}) - protected String resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest) + protected String resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest) throws Exception { HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); @@ -904,7 +905,7 @@ else if (Writer.class.isAssignableFrom(parameterType)) { } @SuppressWarnings("unchecked") - public ModelAndView getModelAndView(Method handlerMethod, Class handlerType, Object returnValue, + public ModelAndView getModelAndView(Method handlerMethod, Class handlerType, Object returnValue, ExtendedModelMap implicitModel, ServletWebRequest webRequest) throws Exception { ResponseStatus responseStatusAnn = AnnotationUtils.findAnnotation(handlerMethod, ResponseStatus.class); @@ -959,7 +960,7 @@ else if (AnnotationUtils.findAnnotation(handlerMethod, ModelAttribute.class) != return new ModelAndView().addAllObjects(implicitModel); } else if (returnValue instanceof Map) { - return new ModelAndView().addAllObjects(implicitModel).addAllObjects((Map) returnValue); + return new ModelAndView().addAllObjects(implicitModel).addAllObjects((Map) returnValue); } else if (returnValue instanceof String) { return new ModelAndView((String) returnValue).addAllObjects(implicitModel); @@ -1002,7 +1003,7 @@ private void handleHttpEntityResponse(HttpEntity responseEntity, ServletWebRe HttpInputMessage inputMessage = createHttpInputMessage(webRequest); HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest); if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) { - ((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode()); + ((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode()); } HttpHeaders entityHeaders = responseEntity.getHeaders(); if (!entityHeaders.isEmpty()) { @@ -1018,7 +1019,7 @@ private void handleHttpEntityResponse(HttpEntity responseEntity, ServletWebRe } } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private void writeWithMessageConverters(Object returnValue, HttpInputMessage inputMessage, HttpOutputMessage outputMessage) throws IOException, HttpMediaTypeNotAcceptableException { @@ -1031,9 +1032,9 @@ private void writeWithMessageConverters(Object returnValue, List allSupportedMediaTypes = new ArrayList(); if (getMessageConverters() != null) { for (MediaType acceptedMediaType : acceptedMediaTypes) { - for (HttpMessageConverter messageConverter : getMessageConverters()) { + for (HttpMessageConverter messageConverter : getMessageConverters()) { if (messageConverter.canWrite(returnValueType, acceptedMediaType)) { - messageConverter.write(returnValue, acceptedMediaType, outputMessage); + ((HttpMessageConverter)messageConverter).write(returnValue, acceptedMediaType, outputMessage); if (logger.isDebugEnabled()) { MediaType contentType = outputMessage.getHeaders().getContentType(); if (contentType == null) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java index 58b740106982..22d38fe1eec3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.xml.transform.Source; import org.springframework.core.ExceptionDepthComparator; import org.springframework.core.GenericTypeResolver; @@ -96,7 +97,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc private HttpMessageConverter[] messageConverters = new HttpMessageConverter[] {new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter(), - new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()}; + new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()}; /** @@ -413,7 +414,7 @@ else if (returnValue == null) { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private ModelAndView handleResponseBody(Object returnValue, ServletWebRequest webRequest) throws ServletException, IOException { @@ -427,9 +428,9 @@ private ModelAndView handleResponseBody(Object returnValue, ServletWebRequest we Class returnValueType = returnValue.getClass(); if (this.messageConverters != null) { for (MediaType acceptedMediaType : acceptedMediaTypes) { - for (HttpMessageConverter messageConverter : this.messageConverters) { + for (HttpMessageConverter messageConverter : this.messageConverters) { if (messageConverter.canWrite(returnValueType, acceptedMediaType)) { - messageConverter.write(returnValue, acceptedMediaType, outputMessage); + ((HttpMessageConverter)messageConverter).write(returnValue, acceptedMediaType, outputMessage); return new ModelAndView(); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ModelAndViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ModelAndViewResolver.java index a6e25594b378..33d87a40e4ba 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ModelAndViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ModelAndViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ public interface ModelAndViewResolver { ModelAndView UNRESOLVED = new ModelAndView(); ModelAndView resolveModelAndView(Method handlerMethod, - Class handlerType, + Class handlerType, Object returnValue, ExtendedModelMap implicitModel, NativeWebRequest webRequest); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.java index c898e413cf59..d59c9002914a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java index 15aee22ec259..bc65b27de2a5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java @@ -107,4 +107,4 @@ public String toString() { return builder.toString(); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractNameValueExpression.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractNameValueExpression.java index b6ebb6d717b7..dd050ca81c31 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractNameValueExpression.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractNameValueExpression.java @@ -19,8 +19,8 @@ import javax.servlet.http.HttpServletRequest; /** - * Supports "name=value" style expressions as described in: - * {@link org.springframework.web.bind.annotation.RequestMapping#params()} and + * Supports "name=value" style expressions as described in: + * {@link org.springframework.web.bind.annotation.RequestMapping#params()} and * {@link org.springframework.web.bind.annotation.RequestMapping#headers()}. * * @author Rossen Stoyanchev @@ -48,7 +48,7 @@ abstract class AbstractNameValueExpression implements NameValueExpression this.value = parseValue(expression.substring(separator + 1)); } } - + public String getName() { return this.name; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java index 98385ae91152..5328d5e799a0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java @@ -20,21 +20,21 @@ import java.util.Iterator; /** - * A base class for {@link RequestCondition} types providing implementations of - * {@link #equals(Object)}, {@link #hashCode()}, and {@link #toString()}. - * + * A base class for {@link RequestCondition} types providing implementations of + * {@link #equals(Object)}, {@link #hashCode()}, and {@link #toString()}. + * * @author Rossen Stoyanchev * @since 3.1 */ public abstract class AbstractRequestCondition> implements RequestCondition { - + /** * Return the discrete items a request condition is composed of. * For example URL patterns, HTTP request methods, param expressions, etc. * @return a collection of objects, never {@code null} */ protected abstract Collection getContent(); - + @Override public boolean equals(Object o) { if (this == o) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/HeadersRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/HeadersRequestCondition.java index ab005ad2bf66..20b4ee8381a4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/HeadersRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/HeadersRequestCondition.java @@ -26,13 +26,13 @@ import org.springframework.web.bind.annotation.RequestMapping; /** - * A logical conjunction (' && ') request condition that matches a request against + * A logical conjunction (' && ') request condition that matches a request against * a set of header expressions with syntax defined in {@link RequestMapping#headers()}. - * - *

        Expressions passed to the constructor with header names 'Accept' or + * + *

        Expressions passed to the constructor with header names 'Accept' or * 'Content-Type' are ignored. See {@link ConsumesRequestCondition} and - * {@link ProducesRequestCondition} for those. - * + * {@link ProducesRequestCondition} for those. + * * @author Arjen Poutsma * @author Rossen Stoyanchev * @since 3.1 @@ -42,20 +42,20 @@ public final class HeadersRequestCondition extends AbstractRequestCondition expressions; /** - * Create a new instance from the given header expressions. Expressions with - * header names 'Accept' or 'Content-Type' are ignored. See {@link ConsumesRequestCondition} - * and {@link ProducesRequestCondition} for those. + * Create a new instance from the given header expressions. Expressions with + * header names 'Accept' or 'Content-Type' are ignored. See {@link ConsumesRequestCondition} + * and {@link ProducesRequestCondition} for those. * @param headers media type expressions with syntax defined in {@link RequestMapping#headers()}; * if 0, the condition will match to every request. */ public HeadersRequestCondition(String... headers) { this(parseExpressions(headers)); } - + private HeadersRequestCondition(Collection conditions) { this.expressions = Collections.unmodifiableSet(new LinkedHashSet(conditions)); } - + private static Collection parseExpressions(String... headers) { Set expressions = new LinkedHashSet(); if (headers != null) { @@ -76,7 +76,7 @@ private static Collection parseExpressions(String... headers) public Set> getExpressions() { return new LinkedHashSet>(this.expressions); } - + @Override protected Collection getContent() { return this.expressions; @@ -88,7 +88,7 @@ protected String getToStringInfix() { } /** - * Returns a new instance with the union of the header expressions + * Returns a new instance with the union of the header expressions * from "this" and the "other" instance. */ public HeadersRequestCondition combine(HeadersRequestCondition other) { @@ -96,9 +96,9 @@ public HeadersRequestCondition combine(HeadersRequestCondition other) { set.addAll(other.expressions); return new HeadersRequestCondition(set); } - + /** - * Returns "this" instance if the request matches all expressions; + * Returns "this" instance if the request matches all expressions; * or {@code null} otherwise. */ public HeadersRequestCondition getMatchingCondition(HttpServletRequest request) { @@ -116,10 +116,10 @@ public HeadersRequestCondition getMatchingCondition(HttpServletRequest request) *

      2. 0 if the two conditions have the same number of header expressions *
      3. Less than 0 if "this" instance has more header expressions *
      4. Greater than 0 if the "other" instance has more header expressions - * - * - *

        It is assumed that both instances have been obtained via - * {@link #getMatchingCondition(HttpServletRequest)} and each instance + * + * + *

        It is assumed that both instances have been obtained via + * {@link #getMatchingCondition(HttpServletRequest)} and each instance * contains the matching header expression only or is otherwise empty. */ public int compareTo(HeadersRequestCondition other, HttpServletRequest request) { @@ -127,7 +127,7 @@ public int compareTo(HeadersRequestCondition other, HttpServletRequest request) } /** - * Parses and matches a single header expression to a request. + * Parses and matches a single header expression to a request. */ static class HeaderExpression extends AbstractNameValueExpression { @@ -157,5 +157,5 @@ public int hashCode() { result = 31 * result + (isNegated ? 1 : 0); return result; } - } + } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/MediaTypeExpression.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/MediaTypeExpression.java index 660f59481a8c..3b2c7f5c0560 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/MediaTypeExpression.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/MediaTypeExpression.java @@ -20,13 +20,13 @@ import org.springframework.web.bind.annotation.RequestMapping; /** - * A contract for media type expressions (e.g. "text/plain", "!text/plain") as - * defined in the {@code @RequestMapping} annotation for "consumes" and + * A contract for media type expressions (e.g. "text/plain", "!text/plain") as + * defined in the {@code @RequestMapping} annotation for "consumes" and * "produces" conditions. * * @author Rossen Stoyanchev * @since 3.1 - * + * * @see RequestMapping#consumes() * @see RequestMapping#produces() */ @@ -36,4 +36,4 @@ public interface MediaTypeExpression { boolean isNegated(); -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/NameValueExpression.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/NameValueExpression.java index 670aae0ee92d..8db1e46ee04b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/NameValueExpression.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/NameValueExpression.java @@ -20,12 +20,12 @@ /** - * A contract for {@code "name!=value"} style expression used to specify request + * A contract for {@code "name!=value"} style expression used to specify request * parameters and request header conditions in {@code @RequestMapping}. * * @author Rossen Stoyanchev * @since 3.1 - * + * * @see RequestMapping#params() * @see RequestMapping#headers() */ @@ -37,4 +37,4 @@ public interface NameValueExpression { boolean isNegated(); -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java index c4c199133d5b..66d6e51009a6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java @@ -27,9 +27,9 @@ import org.springframework.web.util.WebUtils; /** - * A logical conjunction (' && ') request condition that matches a request against - * a set parameter expressions with syntax defined in {@link RequestMapping#params()}. - * + * A logical conjunction (' && ') request condition that matches a request against + * a set parameter expressions with syntax defined in {@link RequestMapping#params()}. + * * @author Arjen Poutsma * @author Rossen Stoyanchev * @since 3.1 @@ -37,16 +37,16 @@ public final class ParamsRequestCondition extends AbstractRequestCondition { private final Set expressions; - + /** - * Create a new instance from the given param expressions. - * @param params expressions with syntax defined in {@link RequestMapping#params()}; + * Create a new instance from the given param expressions. + * @param params expressions with syntax defined in {@link RequestMapping#params()}; * if 0, the condition will match to every request. */ public ParamsRequestCondition(String... params) { this(parseExpressions(params)); } - + private ParamsRequestCondition(Collection conditions) { this.expressions = Collections.unmodifiableSet(new LinkedHashSet(conditions)); } @@ -79,7 +79,7 @@ protected String getToStringInfix() { } /** - * Returns a new instance with the union of the param expressions + * Returns a new instance with the union of the param expressions * from "this" and the "other" instance. */ public ParamsRequestCondition combine(ParamsRequestCondition other) { @@ -89,7 +89,7 @@ public ParamsRequestCondition combine(ParamsRequestCondition other) { } /** - * Returns "this" instance if the request matches all param expressions; + * Returns "this" instance if the request matches all param expressions; * or {@code null} otherwise. */ public ParamsRequestCondition getMatchingCondition(HttpServletRequest request) { @@ -107,10 +107,10 @@ public ParamsRequestCondition getMatchingCondition(HttpServletRequest request) { *

      5. 0 if the two conditions have the same number of parameter expressions *
      6. Less than 0 if "this" instance has more parameter expressions *
      7. Greater than 0 if the "other" instance has more parameter expressions - * - * - *

        It is assumed that both instances have been obtained via - * {@link #getMatchingCondition(HttpServletRequest)} and each instance + * + * + *

        It is assumed that both instances have been obtained via + * {@link #getMatchingCondition(HttpServletRequest)} and each instance * contains the matching parameter expressions only or is otherwise empty. */ public int compareTo(ParamsRequestCondition other, HttpServletRequest request) { @@ -118,7 +118,7 @@ public int compareTo(ParamsRequestCondition other, HttpServletRequest request) { } /** - * Parses and matches a single param expression to a request. + * Parses and matches a single param expression to a request. */ static class ParamExpression extends AbstractNameValueExpression { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java index 357e31fe368c..1355fbdd7024 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java @@ -52,11 +52,9 @@ public final class PatternsRequestCondition extends AbstractRequestCondition fileExtensions = new ArrayList(); - /** * Creates a new instance with the given URL patterns. - * Each pattern that is not empty and does not start with "/" is prepended with "/". + * Each pattern that is not empty and does not start with "/" is pre-pended with "/". * @param patterns 0 or more URL patterns; if 0 the condition will match to every request. */ public PatternsRequestCondition(String... patterns) { @@ -89,21 +87,23 @@ public PatternsRequestCondition(String[] patterns, UrlPathHelper urlPathHelper, * @param useTrailingSlashMatch whether to match irrespective of a trailing slash * @param fileExtensions a list of file extensions to consider for path matching */ - public PatternsRequestCondition(String[] patterns, UrlPathHelper urlPathHelper, - PathMatcher pathMatcher, boolean useSuffixPatternMatch, boolean useTrailingSlashMatch, - List fileExtensions) { - - this(asList(patterns), urlPathHelper, pathMatcher, useSuffixPatternMatch, useTrailingSlashMatch, fileExtensions); + public PatternsRequestCondition(String[] patterns, + UrlPathHelper urlPathHelper, + PathMatcher pathMatcher, + boolean useSuffixPatternMatch, + boolean useTrailingSlashMatch) { + this(asList(patterns), urlPathHelper, pathMatcher, useSuffixPatternMatch, useTrailingSlashMatch); } /** * Private constructor accepting a collection of patterns. * @param fileExtensionResolver */ - private PatternsRequestCondition(Collection patterns, UrlPathHelper urlPathHelper, - PathMatcher pathMatcher, boolean useSuffixPatternMatch, boolean useTrailingSlashMatch, - List fileExtensions) { - + private PatternsRequestCondition(Collection patterns, + UrlPathHelper urlPathHelper, + PathMatcher pathMatcher, + boolean useSuffixPatternMatch, + boolean useTrailingSlashMatch) { this.patterns = Collections.unmodifiableSet(prependLeadingSlash(patterns)); this.urlPathHelper = urlPathHelper != null ? urlPathHelper : new UrlPathHelper(); this.pathMatcher = pathMatcher != null ? pathMatcher : new AntPathMatcher(); @@ -251,14 +251,6 @@ private String getMatchingPattern(String pattern, String lookupPath) { return null; } - /** - * Whether to match by known file extensions. Return "true" if file extensions - * are configured, and the lookup path has a suffix. - */ - private boolean useSmartSuffixPatternMatch(String pattern, String lookupPath) { - return (!this.fileExtensions.isEmpty() && lookupPath.indexOf('.') != -1) ; - } - /** * Compare the two conditions based on the URL patterns they contain. * Patterns are compared one at a time, from top to bottom via diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java index 13292f1a7662..8f46329cde12 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java @@ -60,12 +60,11 @@ public ProducesRequestCondition(String... produces) { } /** - * Creates a new instance with "produces" and "header" expressions. "Header" - * expressions where the header name is not 'Accept' or have no header value - * defined are ignored. If 0 expressions are provided in total, this condition - * will match to any request. - * @param produces expressions with syntax defined by {@link RequestMapping#produces()} - * @param headers expressions with syntax defined by {@link RequestMapping#headers()} + * Creates a new instance with "produces" and "header" expressions. "Header" expressions + * where the header name is not 'Accept' or have no header value defined are ignored. + * If 0 expressions are provided in total, the condition matches to every request + * @param produces expressions with the syntax described in {@link RequestMapping#produces()} + * @param headers expressions with the syntax described in {@link RequestMapping#headers()} */ public ProducesRequestCondition(String[] produces, String[] headers) { this(produces, headers, null); @@ -232,6 +231,8 @@ public int compareTo(ProducesRequestCondition other, HttpServletRequest request) // should never happen throw new IllegalStateException("Cannot compare without having any requested media types"); } + + return 0; } private List getAcceptedMediaTypes(HttpServletRequest request) throws HttpMediaTypeNotAcceptableException { @@ -280,17 +281,17 @@ else if (index1 != -1 && index2 != -1) { * with a {@code MediaType_ALL} expression. */ private List getExpressionsToCompare() { - return this.expressions.isEmpty() ? MEDIA_TYPE_ALL_LIST : this.expressions; + return this.expressions.isEmpty() ? DEFAULT_EXPRESSION_LIST : this.expressions; } - private final List MEDIA_TYPE_ALL_LIST = - Collections.singletonList(new ProduceMediaTypeExpression("*/*")); + private static final List DEFAULT_EXPRESSION_LIST = + Arrays.asList(new ProduceMediaTypeExpression("*/*")); /** * Parses and matches a single media type expression to a request's 'Accept' header. */ - class ProduceMediaTypeExpression extends AbstractMediaTypeExpression { + static class ProduceMediaTypeExpression extends AbstractMediaTypeExpression { ProduceMediaTypeExpression(MediaType mediaType, boolean negated) { super(mediaType, negated); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestCondition.java index fd99e6ffced9..d4c69a9360d9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestCondition.java @@ -67,5 +67,5 @@ public interface RequestCondition { * to ensure they have content relevant to current request only. */ int compareTo(T other, HttpServletRequest request); - + } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java index 22d5e3b8b5aa..7cef11e90211 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java @@ -87,12 +87,12 @@ public RequestMethodsRequestCondition combine(RequestMethodsRequestCondition oth } /** - * Check if any of the HTTP request methods match the given request and - * return an instance that contains the matching HTTP request method only. - * + * Checks if any of the HTTP request methods match the given request and returns + * an instance that contains the matching request method only. * @param request the current request - * @return the same instance if the condition is empty, a new condition with - * the matched request method, or {@code null} if no request methods match + * @return the same instance if the condition contains no request method; + * or a new condition with the matching request method; + * or {@code null} if no request methods match. */ public RequestMethodsRequestCondition getMatchingCondition(HttpServletRequest request) { if (this.methods.isEmpty()) { @@ -121,9 +121,9 @@ private RequestMethod getRequestMethod(HttpServletRequest request) { /** * Returns: *

          - *
        • 0 if the two conditions contain the same number of HTTP request methods - *
        • Less than 0 if "this" instance has an HTTP request method but "other" doesn't - *
        • Greater than 0 "other" has an HTTP request method but "this" doesn't + *
        • 0 if the two conditions contain the same number of HTTP request methods. + *
        • Less than 0 if "this" instance has an HTTP request method but "other" doesn't. + *
        • Greater than 0 "other" has an HTTP request method but "this" doesn't. *
        * *

        It is assumed that both instances have been obtained via diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java index 653628ceaa25..b6028a667ee5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java @@ -26,7 +26,7 @@ import org.springframework.web.servlet.support.WebContentGenerator; /** - * Abstract base class for {@link HandlerAdapter} implementations that support + * Abstract base class for {@link HandlerAdapter} implementations that support * handlers of type {@link HandlerMethod}. * * @author Arjen Poutsma @@ -53,7 +53,7 @@ public void setOrder(int order) { public int getOrder() { return this.order; } - + /** * {@inheritDoc}

        This implementation expects the handler to be an {@link HandlerMethod}. * @@ -85,9 +85,9 @@ public final ModelAndView handle(HttpServletRequest request, HttpServletResponse * * @param request current HTTP request * @param response current HTTP response - * @param handlerMethod handler method to use. This object must have previously been passed to the + * @param handlerMethod handler method to use. This object must have previously been passed to the * {@link #supportsInternal(HandlerMethod)} this interface, which must have returned {@code true}. - * @return ModelAndView object with the name of the view and the required model data, or {@code null} if + * @return ModelAndView object with the name of the view and the required model data, or {@code null} if * the request has been handled directly * @throws Exception in case of errors */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java index 26ffe935792f..765ed74a6450 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java @@ -38,7 +38,7 @@ *

      8. {@link ProducesRequestCondition} *
      9. {@code RequestCondition} (optional, custom request condition) * - * + * * @author Arjen Poutsma * @author Rossen Stoyanchev * @since 3.1 @@ -56,7 +56,7 @@ public final class RequestMappingInfo implements RequestCondition custom) { @@ -89,7 +89,7 @@ public RequestMappingInfo(RequestMappingInfo info, RequestCondition customReq } /** - * Returns the URL patterns of this {@link RequestMappingInfo}; + * Returns the URL patterns of this {@link RequestMappingInfo}; * or instance with 0 patterns, never {@code null} */ public PatternsRequestCondition getPatternsCondition() { @@ -97,7 +97,7 @@ public PatternsRequestCondition getPatternsCondition() { } /** - * Returns the HTTP request methods of this {@link RequestMappingInfo}; + * Returns the HTTP request methods of this {@link RequestMappingInfo}; * or instance with 0 request methods, never {@code null} */ public RequestMethodsRequestCondition getMethodsCondition() { @@ -161,9 +161,9 @@ public RequestMappingInfo combine(RequestMappingInfo other) { } /** - * Checks if all conditions in this request mapping info match the provided request and returns - * a potentially new request mapping info with conditions tailored to the current request. - *

        For example the returned instance may contain the subset of URL patterns that match to + * Checks if all conditions in this request mapping info match the provided request and returns + * a potentially new request mapping info with conditions tailored to the current request. + *

        For example the returned instance may contain the subset of URL patterns that match to * the current request, sorted with best matching patterns on top. * @return a new instance in case all conditions match; or {@code null} otherwise */ @@ -173,27 +173,27 @@ public RequestMappingInfo getMatchingCondition(HttpServletRequest request) { HeadersRequestCondition headers = headersCondition.getMatchingCondition(request); ConsumesRequestCondition consumes = consumesCondition.getMatchingCondition(request); ProducesRequestCondition produces = producesCondition.getMatchingCondition(request); - + if (methods == null || params == null || headers == null || consumes == null || produces == null) { return null; } - + PatternsRequestCondition patterns = patternsCondition.getMatchingCondition(request); if (patterns == null) { return null; } - + RequestConditionHolder custom = customConditionHolder.getMatchingCondition(request); if (custom == null) { return null; } - + return new RequestMappingInfo(patterns, methods, params, headers, consumes, produces, custom.getCondition()); } - + /** - * Compares "this" info (i.e. the current instance) with another info in the context of a request. - *

        Note: it is assumed both instances have been obtained via + * Compares "this" info (i.e. the current instance) with another info in the context of a request. + *

        Note: it is assumed both instances have been obtained via * {@link #getMatchingCondition(HttpServletRequest)} to ensure they have conditions with * content relevant to current request. */ @@ -241,7 +241,7 @@ public boolean equals(Object obj) { this.paramsCondition.equals(other.paramsCondition) && this.headersCondition.equals(other.headersCondition) && this.consumesCondition.equals(other.consumesCondition) && - this.producesCondition.equals(other.producesCondition) && + this.producesCondition.equals(other.producesCondition) && this.customConditionHolder.equals(other.customConditionHolder)); } return false; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java index b462214e0241..f73eb89e7a5d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java @@ -46,8 +46,8 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver; /** - * A base class for resolving method argument values by reading from the body of - * a request with {@link HttpMessageConverter}s. + * A base class for resolving method argument values by reading from the body of a request + * with {@link HttpMessageConverter}s. * * @author Arjen Poutsma * @author Rossen Stoyanchev @@ -68,8 +68,8 @@ public AbstractMessageConverterMethodArgumentResolver(List getAllSupportedMediaTypes(List> messageConverters) { Set allSupportedMediaTypes = new LinkedHashSet(); @@ -82,8 +82,7 @@ private static List getAllSupportedMediaTypes(List the expected type of the argument value to be created * @param webRequest the current request @@ -93,16 +92,15 @@ private static List getAllSupportedMediaTypes(List Object readWithMessageConverters(NativeWebRequest webRequest, - MethodParameter methodParam, Type paramType) throws IOException, HttpMediaTypeNotSupportedException { + protected Object readWithMessageConverters(NativeWebRequest webRequest, MethodParameter methodParam, Class paramType) throws IOException, + HttpMediaTypeNotSupportedException { - HttpInputMessage inputMessage = createInputMessage(webRequest); - return readWithMessageConverters(inputMessage, methodParam, paramType); - } + HttpInputMessage inputMessage = createInputMessage(webRequest); + return readWithMessageConverters(inputMessage, methodParam, paramType); + } /** - * Creates the method argument value of the expected parameter type by reading - * from the given HttpInputMessage. + * Creates the method argument value of the expected parameter type by reading from the given HttpInputMessage. * * @param the expected type of the argument value to be created * @param inputMessage the HTTP input message representing the current request @@ -115,36 +113,19 @@ protected Object readWithMessageConverters(NativeWebRequest webRequest, * @throws HttpMediaTypeNotSupportedException if no suitable message converter is found */ @SuppressWarnings("unchecked") - protected Object readWithMessageConverters(HttpInputMessage inputMessage, - MethodParameter methodParam, Type targetType) throws IOException, HttpMediaTypeNotSupportedException { + protected Object readWithMessageConverters(HttpInputMessage inputMessage, MethodParameter methodParam, Class paramType) throws IOException, + HttpMediaTypeNotSupportedException { MediaType contentType = inputMessage.getHeaders().getContentType(); if (contentType == null) { contentType = MediaType.APPLICATION_OCTET_STREAM; } - Class contextClass = methodParam.getDeclaringClass(); - Map map = GenericTypeResolver.getTypeVariableMap(contextClass); - Class targetClass = (Class) GenericTypeResolver.resolveType(targetType, map); - - for (HttpMessageConverter converter : this.messageConverters) { - if (converter instanceof GenericHttpMessageConverter) { - GenericHttpMessageConverter genericConverter = (GenericHttpMessageConverter) converter; - if (genericConverter.canRead(targetType, contextClass, contentType)) { - if (logger.isDebugEnabled()) { - logger.debug("Reading [" + targetType + "] as \"" + - contentType + "\" using [" + converter + "]"); - } - return (T) genericConverter.read(targetType, contextClass, inputMessage); - } - } - if (targetClass != null) { - if (converter.canRead(targetClass, contentType)) { - if (logger.isDebugEnabled()) { - logger.debug("Reading [" + targetClass.getName() + "] as \"" + - contentType + "\" using [" + converter + "]"); - } - return ((HttpMessageConverter) converter).read(targetClass, inputMessage); + for (HttpMessageConverter messageConverter : this.messageConverters) { + if (messageConverter.canRead(paramType, contentType)) { + if (logger.isDebugEnabled()) { + logger.debug("Reading [" + paramType.getName() + "] as \"" + contentType + "\" using [" + + messageConverter + "]"); } } } @@ -163,4 +144,4 @@ protected ServletServerHttpRequest createInputMessage(NativeWebRequest webReques return new ServletServerHttpRequest(servletRequest); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java index 7e37632960b6..95b217e10300 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java @@ -199,4 +199,4 @@ private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produ return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType : produceType; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinder.java index 51c021abd75a..5278b263cbd5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExtendedServletRequestDataBinder.java @@ -62,18 +62,7 @@ public ExtendedServletRequestDataBinder(Object target, String objectName) { @SuppressWarnings("unchecked") protected void addBindValues(MutablePropertyValues mpvs, ServletRequest request) { String attr = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE; - Map uriVars = (Map) request.getAttribute(attr); - if (uriVars != null) { - for (Entry entry : uriVars.entrySet()) { - if (mpvs.contains(entry.getKey())) { - logger.warn("Skipping URI variable '" + entry.getKey() - + "' since the request contains a bind value with the same name."); - } - else { - mpvs.addPropertyValue(entry.getKey(), entry.getValue()); - } - } - } + mpvs.addPropertyValues((Map) request.getAttribute(attr)); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandler.java index d1ede55c5764..a39649551aa1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandler.java @@ -52,9 +52,9 @@ * @since 3.1 */ public class ModelAndViewResolverMethodReturnValueHandler implements HandlerMethodReturnValueHandler { - + private final List mavResolvers; - + private final ModelAttributeMethodProcessor modelAttributeProcessor = new ModelAttributeMethodProcessor(true); /** @@ -94,7 +94,7 @@ public void handleReturnValue( } // No suitable ModelAndViewResolver.. - + if (this.modelAttributeProcessor.supportsReturnType(returnType)) { this.modelAttributeProcessor.handleReturnValue(returnValue, returnType, mavContainer, request); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolver.java index 52af8e427af1..514df9100228 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolver.java @@ -67,4 +67,4 @@ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolver.java index d93b7746a7a3..7b960f001ce5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolver.java @@ -119,4 +119,4 @@ private PathVariableNamedValueInfo(PathVariable annotation) { super(annotation.value(), true, ValueConstants.DEFAULT_NONE); } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java index 1b8da1a5eefe..e837e77cbc66 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java @@ -880,4 +880,4 @@ public boolean matches(Method method) { } }; -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java index cea6c55783f9..80b7678571db 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java index 9b320cedb960..a7473a60f185 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java @@ -190,4 +190,4 @@ public void handleReturnValue(Object returnValue, MethodParameter returnType, } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolver.java index d2a64b7987d8..d84539494bf4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolver.java @@ -29,7 +29,7 @@ /** * An {@link org.springframework.web.method.annotation.AbstractCookieValueMethodArgumentResolver} that resolves cookie * values from an {@link HttpServletRequest}. - * + * * @author Rossen Stoyanchev * @since 3.1 */ @@ -60,4 +60,4 @@ else if (cookieValue != null) { return null; } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletModelAttributeMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletModelAttributeMethodProcessor.java index 56c45e033b7b..3cfd087e334b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletModelAttributeMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletModelAttributeMethodProcessor.java @@ -80,7 +80,7 @@ protected final Object createAttribute(String attributeName, return super.createAttribute(attributeName, parameter, binderFactory, request); } - + /** * Obtain a value from the request that may be used to instantiate the * model attribute through type conversion from String to the target type. @@ -140,7 +140,7 @@ protected Object createAttributeFromRequestValue(String sourceValue, } return null; } - + /** * {@inheritDoc} *

        Downcast {@link WebDataBinder} to {@link ServletRequestDataBinder} before binding. @@ -153,4 +153,4 @@ protected void bindRequestParameters(WebDataBinder binder, NativeWebRequest requ servletBinder.bind(servletRequest); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java index a6e9f7f93334..d0c3a020247f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolver.java @@ -71,12 +71,12 @@ public Object resolveArgument( MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws IOException { - + Class paramType = parameter.getParameterType(); if (WebRequest.class.isAssignableFrom(paramType)) { return webRequest; } - + HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class); if (ServletRequest.class.isAssignableFrom(paramType) || MultipartRequest.class.isAssignableFrom(paramType)) { Object nativeRequest = webRequest.getNativeRequest(paramType); @@ -107,5 +107,5 @@ else if (Reader.class.isAssignableFrom(paramType)) { throw new UnsupportedOperationException("Unknown parameter type: " + paramType + " in method: " + method); } } - + } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolver.java index f1eaa6607da3..14c216258f70 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolver.java @@ -89,5 +89,5 @@ else if (Writer.class.isAssignableFrom(paramType)) { throw new UnsupportedOperationException("Unknown parameter type: " + paramType + " in method: " + method); } } - + } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletWebArgumentResolverAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletWebArgumentResolverAdapter.java index b19d0f362aa1..b7d5653ab42a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletWebArgumentResolverAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ServletWebArgumentResolverAdapter.java @@ -27,12 +27,12 @@ /** * A Servlet-specific {@link org.springframework.web.method.annotation.AbstractWebArgumentResolverAdapter} that creates a * {@link NativeWebRequest} from {@link ServletRequestAttributes}. - * + * *

        Note: This class is provided for backwards compatibility. - * However it is recommended to re-write a {@code WebArgumentResolver} as - * {@code HandlerMethodArgumentResolver}. For more details see javadoc of + * However it is recommended to re-write a {@code WebArgumentResolver} as + * {@code HandlerMethodArgumentResolver}. For more details see javadoc of * {@link org.springframework.web.method.annotation.AbstractWebArgumentResolverAdapter}. - * + * * @author Rossen Stoyanchev * @since 3.1 */ @@ -51,4 +51,4 @@ protected NativeWebRequest getWebRequest() { } return null; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/package-info.java index d266fe365da1..be2b821dee1d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/package-info.java @@ -1,4 +1,3 @@ - /** * MVC infrastructure for annotation-based handler method processing, * building on the org.springframework.web.method.annotation package. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java index a43cece2df18..c62e2ceca43b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java index d073b3207318..53740ed959f5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java @@ -30,7 +30,7 @@ * @see MultiActionController#setMethodNameResolver */ public interface MethodNameResolver { - + /** * Return a method name that can handle this request. Such * mappings are typically, but not necessarily, based on URL. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java index f88c921c9194..d67ed3215650 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java @@ -168,7 +168,7 @@ public class MultiActionController extends AbstractController implements LastMod private final Map lastModifiedMethodMap = new HashMap(); /** Methods, keyed by exception class */ - private final Map exceptionHandlerMap = new HashMap(); + private final Map, Method> exceptionHandlerMap = new HashMap, Method>(); /** @@ -287,10 +287,10 @@ else if (isHandlerMethod(method)) { * as handler method (to avoid potential stack overflow). */ private boolean isHandlerMethod(Method method) { - Class returnType = method.getReturnType(); + Class returnType = method.getReturnType(); if (ModelAndView.class.equals(returnType) || Map.class.equals(returnType) || String.class.equals(returnType) || void.class.equals(returnType)) { - Class[] parameterTypes = method.getParameterTypes(); + Class[] parameterTypes = method.getParameterTypes(); return (parameterTypes.length >= 2 && HttpServletRequest.class.equals(parameterTypes[0]) && HttpServletResponse.class.equals(parameterTypes[1]) && @@ -328,7 +328,7 @@ private void registerLastModifiedMethodIfExists(Object delegate, Method method) Method lastModifiedMethod = delegate.getClass().getMethod( method.getName() + LAST_MODIFIED_METHOD_SUFFIX, new Class[] {HttpServletRequest.class}); - Class returnType = lastModifiedMethod.getReturnType(); + Class returnType = lastModifiedMethod.getReturnType(); if (!(long.class.equals(returnType) || Long.class.equals(returnType))) { throw new IllegalStateException("last-modified method [" + lastModifiedMethod + "] declares an invalid return type - needs to be 'long' or 'Long'"); @@ -446,7 +446,7 @@ protected final ModelAndView invokeNamedMethod( } try { - Class[] paramTypes = method.getParameterTypes(); + Class[] paramTypes = method.getParameterTypes(); List params = new ArrayList(4); params.add(request); params.add(response); @@ -492,7 +492,7 @@ private ModelAndView massageReturnValueIfNecessary(Object returnValue) { return (ModelAndView) returnValue; } else if (returnValue instanceof Map) { - return new ModelAndView().addAllObjects((Map) returnValue); + return new ModelAndView().addAllObjects((Map) returnValue); } else if (returnValue instanceof String) { return new ModelAndView((String) returnValue); @@ -602,7 +602,7 @@ protected void initBinder(HttpServletRequest request, ServletRequestDataBinder b * @param exception the exception to handle */ protected Method getExceptionHandler(Throwable exception) { - Class exceptionClass = exception.getClass(); + Class exceptionClass = exception.getClass(); if (logger.isDebugEnabled()) { logger.debug("Trying to find handler for exception class [" + exceptionClass.getName() + "]"); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java index 2e110ed9df68..fa93efe721b7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public NoSuchRequestHandlingMethodException(HttpServletRequest request) { * @param method the HTTP request method of the request * @param parameterMap the request's parameters as map */ - public NoSuchRequestHandlingMethodException(String urlPath, String method, Map parameterMap) { + public NoSuchRequestHandlingMethodException(String urlPath, String method, Map parameterMap) { super("No matching handler method found for servlet request: path '" + urlPath + "', method '" + method + "', parameters " + StylerUtils.style(parameterMap)); } @@ -61,7 +61,7 @@ public NoSuchRequestHandlingMethodException(String urlPath, String method, Map p * @param methodName the name of the handler method that wasn't found * @param controllerClass the class the handler method was expected to be in */ - public NoSuchRequestHandlingMethodException(String methodName, Class controllerClass) { + public NoSuchRequestHandlingMethodException(String methodName, Class controllerClass) { super("No request handling method with name '" + methodName + "' in class [" + controllerClass.getName() + "]"); this.methodName = methodName; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java index 81f622235694..714e26a9168a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,12 +30,12 @@ /** * Implementation of {@link MethodNameResolver} which supports several strategies * for mapping parameter values to the names of methods to invoke. - * + * *

        The simplest strategy looks for a specific named parameter, whose value is * considered the name of the method to invoke. The name of the parameter may be * specified as a JavaBean property, if the default action is not * acceptable. - * + * *

        The alternative strategy uses the very existence of a request parameter ( * i.e. a request parameter with a certain name is found) as an indication that a * method with the same name should be dispatched to. In this case, the actual @@ -47,18 +47,18 @@ * button should be set to the mapped method name, while the 'value' attribute * is normally displayed as the button label by the browser, and will be * ignored by the resolver. - * + * *

        Note that the second strategy also supports the use of submit buttons of * type 'image'. That is, an image submit button named 'reset' will normally be * submitted by the browser as two request paramters called 'reset.x', and - * 'reset.y'. When checking for the existence of a paramter from the + * 'reset.y'. When checking for the existence of a paramter from the * methodParamNames list, to indicate that a specific method should * be called, the code will look for request parameter in the "reset" form * (exactly as spcified in the list), and in the "reset.x" form ('.x' appended to * the name in the list). In this way it can handle both normal and image submit * buttons. The actual method name resolved if there is a match will always be - * the bare form without the ".x". - * + * the bare form without the ".x". + * *

        Note: If both strategies are configured, i.e. both "paramName" * and "methodParamNames" are specified, then both will be checked for any given * request. A match for an explicit request parameter in the "methodParamNames" @@ -66,7 +66,7 @@ * *

        For use with either strategy, the name of a default handler method to use * when there is no match, can be specified as a JavaBean property. - * + * *

        For both resolution strategies, the method name is of course coming from * some sort of view code, (such as a JSP page). While this may be acceptable, * it is sometimes desireable to treat this only as a 'logical' method name, diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java index 62759f96e64f..9fbf36c0f564 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ */ public class PropertiesMethodNameResolver extends AbstractUrlMethodNameResolver implements InitializingBean { - + private Properties mappings; private PathMatcher pathMatcher = new AntPathMatcher(); @@ -85,7 +85,7 @@ protected String getHandlerMethodNameForUrlPath(String urlPath) { if (methodName != null) { return methodName; } - Enumeration propNames = this.mappings.propertyNames(); + Enumeration propNames = this.mappings.propertyNames(); while (propNames.hasMoreElements()) { String registeredPath = (String) propNames.nextElement(); if (this.pathMatcher.match(registeredPath, urlPath)) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/package-info.java index d84339fd05f0..320384a29f55 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/package-info.java @@ -5,18 +5,18 @@ * at method rather than class level. This is useful when * we want to avoid having many trivial controller classes, as can * easily happen when using an MVC framework. - * + * *

        Typically a controller that handles multiple request types will * extend MultiActionController, and implement multiple request handling * methods that will be invoked by reflection if they follow this class' * naming convention. Classes are analyzed at startup and methods cached, * so the performance overhead of reflection in this approach is negligible. - * + * *

        This approach is analogous to the Struts 1.1 DispatcherAction * class, but more sophisticated, as it supports configurable mapping from * requests to URLs and allows for delegation as well as subclassing. - * - *

        This package is discussed in Chapter 12 of Expert One-On-One J2EE Design and Development + * + *

        This package is discussed in Chapter 12 of Expert One-On-One J2EE Design and Development * by Rod Johnson, and used in the sample application. * */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/package-info.java index d6b21ffa3895..3f8948780b78 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/package-info.java @@ -6,7 +6,7 @@ * with Spring. Provides both abstract base classes and concrete implementations * for often seen use cases. *

        - * + * *

        * A Controller - as defined in this package - is analogous to a Struts * Action. Usually Controllers are JavaBeans @@ -18,7 +18,7 @@ * independent of the view, PDF views are possible, as well as for instance Excel * views. *

        - * + * *

        * How to actually set up a (web)application using the MVC framework Spring * provides is explained in more detail in the @@ -29,7 +29,7 @@ * workflow of some of the abstract and concrete controller and how to extend * and fully use their functionality. *

        - * + * *

        * Especially useful to read, while getting into the Spring MVC framework * are the following: diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java index 478752851c0c..81ee73d82287 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect private Set excludedPackages = Collections.singleton("org.springframework.web.servlet.mvc"); - private Set excludedClasses = Collections.emptySet(); + private Set> excludedClasses = Collections.emptySet(); /** @@ -69,9 +69,9 @@ public void setExcludedPackages(String[] excludedPackages) { * Specify controller classes that should be excluded from this mapping. * Any such classes will simply be ignored by this HandlerMapping. */ - public void setExcludedClasses(Class[] excludedClasses) { + public void setExcludedClasses(Class[] excludedClasses) { this.excludedClasses = (excludedClasses != null) ? - new HashSet(Arrays.asList(excludedClasses)) : new HashSet(); + new HashSet>(Arrays.asList(excludedClasses)) : new HashSet>(); } @@ -81,7 +81,7 @@ public void setExcludedClasses(Class[] excludedClasses) { */ @Override protected String[] determineUrlsForHandler(String beanName) { - Class beanClass = getApplicationContext().getType(beanName); + Class beanClass = getApplicationContext().getType(beanName); if (isEligibleForMapping(beanName, beanClass)) { return buildUrlsForHandler(beanName, beanClass); } @@ -98,7 +98,7 @@ protected String[] determineUrlsForHandler(String beanName) { * @see #setExcludedPackages * @see #setExcludedClasses */ - protected boolean isEligibleForMapping(String beanName, Class beanClass) { + protected boolean isEligibleForMapping(String beanName, Class beanClass) { if (beanClass == null) { if (logger.isDebugEnabled()) { logger.debug("Excluding controller bean '" + beanName + "' from class name mapping " + @@ -131,7 +131,7 @@ protected boolean isEligibleForMapping(String beanName, Class beanClass) { * that is supported by this mapping strategy. * @param beanClass the class to introspect */ - protected boolean isControllerType(Class beanClass) { + protected boolean isControllerType(Class beanClass) { return this.predicate.isControllerType(beanClass); } @@ -140,7 +140,7 @@ protected boolean isControllerType(Class beanClass) { * that dispatches to multiple action methods. * @param beanClass the class to introspect */ - protected boolean isMultiActionControllerType(Class beanClass) { + protected boolean isMultiActionControllerType(Class beanClass) { return this.predicate.isMultiActionControllerType(beanClass); } @@ -151,6 +151,6 @@ protected boolean isMultiActionControllerType(Class beanClass) { * @param beanClass the type of the bean * @return the URLs determined for the bean */ - protected abstract String[] buildUrlsForHandler(String beanName, Class beanClass); + protected abstract String[] buildUrlsForHandler(String beanName, Class beanClass); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java index 7be0a9e65f95..f5d5146d1669 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,13 @@ class AnnotationControllerTypePredicate extends ControllerTypePredicate { @Override - public boolean isControllerType(Class beanClass) { + public boolean isControllerType(Class beanClass) { return (super.isControllerType(beanClass) || AnnotationUtils.findAnnotation(beanClass, Controller.class) != null); } @Override - public boolean isMultiActionControllerType(Class beanClass) { + public boolean isMultiActionControllerType(Class beanClass) { return (super.isMultiActionControllerType(beanClass) || AnnotationUtils.findAnnotation(beanClass, Controller.class) != null); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java index 357834ca2923..3b93a670f50d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ public void setUrlSuffix(String urlSuffix) { @Override - protected String[] buildUrlsForHandler(String beanName, Class beanClass) { + protected String[] buildUrlsForHandler(String beanName, Class beanClass) { List urls = new ArrayList(); urls.add(generatePathMapping(beanName)); String[] aliases = getApplicationContext().getAliases(beanName); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java index 119f9e953d36..7fb8a61390e5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -122,7 +122,7 @@ public void setBasePackage(String basePackage) { @Override - protected String[] buildUrlsForHandler(String beanName, Class beanClass) { + protected String[] buildUrlsForHandler(String beanName, Class beanClass) { return generatePathMappings(beanClass); } @@ -133,7 +133,7 @@ protected String[] buildUrlsForHandler(String beanName, Class beanClass) { * @param beanClass the controller bean class to generate a mapping for * @return the URL path mappings for the given controller */ - protected String[] generatePathMappings(Class beanClass) { + protected String[] generatePathMappings(Class beanClass) { StringBuilder pathMapping = buildPathPrefix(beanClass); String className = ClassUtils.getShortName(beanClass); String path = (className.endsWith(CONTROLLER_SUFFIX) ? @@ -159,7 +159,7 @@ protected String[] generatePathMappings(Class beanClass) { * @param beanClass the controller bean class to generate a mapping for * @return the path prefix, potentially including subpackage names as path elements */ - private StringBuilder buildPathPrefix(Class beanClass) { + private StringBuilder buildPathPrefix(Class beanClass) { StringBuilder pathMapping = new StringBuilder(); if (this.pathPrefix != null) { pathMapping.append(this.pathPrefix); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java index fb0c149968ca..677ca641fef9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,11 +27,11 @@ */ class ControllerTypePredicate { - public boolean isControllerType(Class beanClass) { + public boolean isControllerType(Class beanClass) { return Controller.class.isAssignableFrom(beanClass); } - public boolean isMultiActionControllerType(Class beanClass) { + public boolean isMultiActionControllerType(Class beanClass) { return MultiActionController.class.isAssignableFrom(beanClass); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java index ccd9aa03f00b..0b625fd97a11 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java @@ -384,8 +384,8 @@ protected ModelAndView handleMethodArgumentNotValidException(MethodArgumentNotVa } /** - * Handle the case where an {@linkplain RequestPart @RequestPart}, a {@link MultipartFile}, - * or a {@code javax.servlet.http.Part} argument is required but is missing. + * Handle the case where an @{@link RequestPart}, a {@link MultipartFile}, + * or a {@code javax.servlet.http.Part} argument is required but missing. * An HTTP 400 error is sent back to the client. * @param request current HTTP request * @param response current HTTP response diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributes.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributes.java index 4e2d8d5acf76..daeaa970c516 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributes.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributes.java @@ -24,17 +24,17 @@ /** * A specialization of the {@link Model} interface that controllers can use to - * select attributes for a redirect scenario. Since the intent of adding - * redirect attributes is very explicit -- i.e. to be used for a redirect URL, - * attribute values may be formatted as Strings and stored that way to make - * them eligible to be appended to the query string or expanded as URI + * select attributes for a redirect scenario. Since the intent of adding + * redirect attributes is very explicit -- i.e. to be used for a redirect URL, + * attribute values may be formatted as Strings and stored that way to make + * them eligible to be appended to the query string or expanded as URI * variables in {@code org.springframework.web.servlet.view.RedirectView}. - * - *

        This interface also provides a way to add flash attributes. For a - * general overview of flash attributes see {@link FlashMap}. You can use - * {@link RedirectAttributes} to store flash attributes and they will be - * automatically propagated to the "output" FlashMap of the current request. - * + * + *

        This interface also provides a way to add flash attributes. For a + * general overview of flash attributes see {@link FlashMap}. You can use + * {@link RedirectAttributes} to store flash attributes and they will be + * automatically propagated to the "output" FlashMap of the current request. + * *

        Example usage in an {@code @Controller}: *

          * @RequestMapping(value = "/accounts", method = RequestMethod.POST)
        @@ -47,13 +47,13 @@
          *   return "redirect:/accounts/{id}";
          * }
          * 
        - * + * *

        A RedirectAttributes model is empty when the method is called and is never * used unless the method returns a redirect view name or a RedirectView. - * + * *

        After the redirect, flash attributes are automatically added to the model * of the controller that serves the target URL. - * + * * @author Rossen Stoyanchev * @since 3.1 */ @@ -64,11 +64,11 @@ public interface RedirectAttributes extends Model { RedirectAttributes addAttribute(Object attributeValue); RedirectAttributes addAllAttributes(Collection attributeValues); - + RedirectAttributes mergeAttributes(Map attributes); /** - * Add the given flash attribute. + * Add the given flash attribute. * @param attributeName the attribute name; never {@code null} * @param attributeValue the attribute value; may be {@code null} */ @@ -76,7 +76,7 @@ public interface RedirectAttributes extends Model { /** * Add the given flash storage using a - * {@link org.springframework.core.Conventions#getVariableName generated name}. + * {@link org.springframework.core.Conventions#getVariableName generated name}. * @param attributeValue the flash attribute value; never {@code null} */ RedirectAttributes addFlashAttribute(Object attributeValue); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMap.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMap.java index 7b28b729b6ca..27c0e25bbc8b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMap.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMap.java @@ -24,10 +24,10 @@ /** * A {@link ModelMap} implementation of {@link RedirectAttributes} that formats - * values as Strings using a {@link DataBinder}. Also provides a place to store - * flash attributes so they can survive a redirect without the need to be + * values as Strings using a {@link DataBinder}. Also provides a place to store + * flash attributes so they can survive a redirect without the need to be * embedded in the redirect URL. - * + * * @author Rossen Stoyanchev * @since 3.1 */ @@ -45,9 +45,9 @@ public class RedirectAttributesModelMap extends ModelMap implements RedirectAttr public RedirectAttributesModelMap(DataBinder dataBinder) { this.dataBinder = dataBinder; } - + /** - * Default constructor without a DataBinder. + * Default constructor without a DataBinder. * Attribute values are converted to String via {@link #toString()}. */ public RedirectAttributesModelMap() { @@ -153,7 +153,7 @@ public RedirectAttributes addFlashAttribute(String attributeName, Object attribu this.flashAttributes.addAttribute(attributeName, attributeValue); return this; } - + public RedirectAttributes addFlashAttribute(Object attributeValue) { this.flashAttributes.addAttribute(attributeValue); return this; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/package-info.java index 3913b20d49ad..117cbb726edc 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/package-info.java @@ -4,7 +4,7 @@ * Provides servlets that integrate with the application context * infrastructure, and the core interfaces and classes for the * Spring web MVC framework. - * + * *

        This package and related packages are discussed in Chapters 12 and 13 of * Expert One-On-One J2EE Design and Development * by Rod Johnson (Wrox, 2002). diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/DefaultServletHttpRequestHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/DefaultServletHttpRequestHandler.java index e31262c43770..eadd19b0ac02 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/DefaultServletHttpRequestHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/DefaultServletHttpRequestHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java index a4cc6669a5a0..6c4c48bd9c0f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/BindStatus.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/BindStatus.java index 123632c6b311..e667ac4eb4dc 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/BindStatus.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/BindStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -214,7 +214,7 @@ public Object getValue() { * 'getValue().getClass()' since 'getValue()' may * return 'null'. */ - public Class getValueType() { + public Class getValueType() { return this.valueType; } @@ -318,7 +318,7 @@ public PropertyEditor getEditor() { * @param valueClass the value class that an editor is needed for * @return the associated PropertyEditor, or null if none */ - public PropertyEditor findEditor(Class valueClass) { + public PropertyEditor findEditor(Class valueClass) { return (this.bindingResult != null ? this.bindingResult.findEditor(this.expression, valueClass) : null); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/JspAwareRequestContext.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/JspAwareRequestContext.java index 0db0668ab51d..83ac3b596a47 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/JspAwareRequestContext.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/JspAwareRequestContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java index 8de20780525f..2f22d48cc773 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -231,7 +231,7 @@ protected void initContext(HttpServletRequest request, HttpServletResponse respo // Ignored } } - + /** * Determine the fallback locale for this context.

        The default implementation checks for a JSTL locale attribute * in request, session or application scope; if not found, returns the HttpServletRequest.getLocale(). @@ -488,7 +488,7 @@ public String getMessage(String code, Object[] args, String defaultMessage) { * @param defaultMessage String to return if the lookup fails * @return the message */ - public String getMessage(String code, List args, String defaultMessage) { + public String getMessage(String code, List args, String defaultMessage) { return getMessage(code, (args != null ? args.toArray() : null), defaultMessage, isDefaultHtmlEscape()); } @@ -533,7 +533,7 @@ public String getMessage(String code, Object[] args) throws NoSuchMessageExcepti * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ - public String getMessage(String code, List args) throws NoSuchMessageException { + public String getMessage(String code, List args) throws NoSuchMessageException { return getMessage(code, (args != null ? args.toArray() : null), isDefaultHtmlEscape()); } @@ -603,7 +603,7 @@ public String getThemeMessage(String code, Object[] args, String defaultMessage) * @param defaultMessage String to return if the lookup fails * @return the message */ - public String getThemeMessage(String code, List args, String defaultMessage) { + public String getThemeMessage(String code, List args, String defaultMessage) { return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), defaultMessage, this.locale); } @@ -639,7 +639,7 @@ public String getThemeMessage(String code, Object[] args) throws NoSuchMessageEx * @return the message * @throws org.springframework.context.NoSuchMessageException if not found */ - public String getThemeMessage(String code, List args) throws NoSuchMessageException { + public String getThemeMessage(String code, List args) throws NoSuchMessageException { return getTheme().getMessageSource().getMessage(code, (args != null ? args.toArray() : null), this.locale); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java index 8c284e37edf7..87be6bcedbcd 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java @@ -158,9 +158,9 @@ public static Theme getTheme(HttpServletRequest request) { /** * Return a read-only {@link Map} with "input" flash attributes saved on a - * previous request. + * previous request. * @param request the current request - * @return a read-only Map, or {@code null} + * @return a read-only Map, or {@code null} * @see FlashMap */ @SuppressWarnings("unchecked") diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestDataValueProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestDataValueProcessor.java index 82bd0398f5f7..a8ca8ca2562a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestDataValueProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestDataValueProcessor.java @@ -22,17 +22,17 @@ /** * A contract for inspecting and potentially modifying request data values such - * as URL query parameters or form field values before they are rendered by a + * as URL query parameters or form field values before they are rendered by a * view or before a redirect. - * - *

        Implementations may use this contract for example as part of a solution - * to provide data integrity, confidentiality, protection against cross-site + * + *

        Implementations may use this contract for example as part of a solution + * to provide data integrity, confidentiality, protection against cross-site * request forgery (CSRF), and others or for other tasks such as automatically * adding a hidden field to all forms and URLs. - * + * *

        View technologies that support this contract can obtain an instance to * delegate to via {@link RequestContext#getRequestDataValueProcessor()}. - * + * * @author Rossen Stoyanchev * @since 3.1 */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java index 1a3755e4e05e..7b9116654dda 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/package-info.java index 35f4258dd676..bea2cac64c18 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/support/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/support/package-info.java @@ -3,7 +3,7 @@ * * Support classes for Spring's web MVC framework. * Provides easy evaluation of the request context in views, - * and miscellaneous HandlerInterceptor implementations. + * and miscellaneous HandlerInterceptor implementations. * */ package org.springframework.web.servlet.support; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/EvalTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/EvalTag.java index 2d3e74b52473..4c4555068973 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/EvalTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/EvalTag.java @@ -147,7 +147,7 @@ private EvaluationContext createEvaluationContext(PageContext pageContext) { } return context; } - + private ConversionService getConversionService(PageContext pageContext) { return (ConversionService) pageContext.getRequest().getAttribute(ConversionService.class.getName()); } @@ -188,7 +188,7 @@ public boolean canWrite(EvaluationContext context, Object target, String name) { public void write(EvaluationContext context, Object target, String name, Object newValue) { throw new UnsupportedOperationException(); } - + private Object resolveImplicitVariable(String name) throws AccessException { if (this.variableResolver == null) { return null; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/HtmlEscapeTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/HtmlEscapeTag.java index b7dfb13d813c..9107a16d0b4e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/HtmlEscapeTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/HtmlEscapeTag.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/MessageTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/MessageTag.java index 3ad705419008..b79327d70fbd 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/MessageTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/MessageTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,9 +68,9 @@ public class MessageTag extends HtmlEscapingAwareTag { private String argumentSeparator = DEFAULT_ARGUMENT_SEPARATOR; private String text; - + private String var; - + private String scope = TagUtils.SCOPE_PAGE; private boolean javaScriptEscape = false; @@ -118,7 +118,7 @@ public void setArgumentSeparator(String argumentSeparator) { public void setText(String text) { this.text = text; } - + /** * Set PageContext attribute name under which to expose * a variable that contains the resolved message. @@ -128,7 +128,7 @@ public void setText(String text) { public void setVar(String var) { this.var = var; } - + /** * Set the scope to export the variable to. * Default is SCOPE_PAGE ("page"). @@ -266,7 +266,7 @@ else if (arguments instanceof Object[]) { return (Object[]) arguments; } else if (arguments instanceof Collection) { - return ((Collection) arguments).toArray(); + return ((Collection) arguments).toArray(); } else if (arguments != null) { // Assume a single argument object. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/Param.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/Param.java index 0dfa4b24bfd0..d37d05a9eb2b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/Param.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/Param.java @@ -1,12 +1,12 @@ /* * Copyright 2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,10 +19,10 @@ /** * Bean used to pass name-value pair parameters from a {@link ParamTag} to a * {@link ParamAware} tag. - * - *

        Attributes are the raw values passed to the spring:param tag and have not - * been encoded or escaped. - * + * + *

        Attributes are the raw values passed to the spring:param tag and have not + * been encoded or escaped. + * * @author Scott Andrews * @since 3.0 * @see ParamTag diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/ParamTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/ParamTag.java index 3d085074017e..b502de7fe357 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/ParamTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/ParamTag.java @@ -1,12 +1,12 @@ /* * Copyright 2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,9 +22,9 @@ /** * JSP tag for collecting name-value parameters and passing them to a * {@link ParamAware} ancestor in the tag hierarchy. - * + * *

        This tag must be nested under a param aware tag. - * + * * @author Scott Andrews * @since 3.0 * @see Param @@ -69,10 +69,10 @@ else if (getBodyContent() != null) { /** * Sets the name of the parameter - * + * *

        * Required - * + * * @param name the parameter name */ public void setName(String name) { @@ -81,10 +81,10 @@ public void setName(String name) { /** * Sets the value of the parameter - * + * *

        * Optional. If not set, the tag's body content is evaluated - * + * * @param value the parameter value */ public void setValue(String value) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/RequestContextAwareTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/RequestContextAwareTag.java index 959d7f953263..4b1970de1858 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/RequestContextAwareTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/RequestContextAwareTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ /** * Superclass for all tags that require a {@link RequestContext}. - * + * *

        The RequestContext instance provides easy access * to current state like the * {@link org.springframework.web.context.WebApplicationContext}, @@ -54,7 +54,7 @@ public abstract class RequestContextAwareTag extends TagSupport implements TryCa public static final String REQUEST_CONTEXT_PAGE_ATTRIBUTE = "org.springframework.web.servlet.tags.REQUEST_CONTEXT"; - + /** Logger available to subclasses */ protected final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java index 034339c14e2b..18c58d91a6b2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/UrlTag.java @@ -40,37 +40,37 @@ /** * JSP tag for creating URLs. Modeled after the JSTL c:url tag with backwards * compatibility in mind. - * + * *

        Enhancements to the JSTL functionality include: *

          *
        • URL encoded template URI variables
        • *
        • HTML/XML escaping of URLs
        • *
        • JavaScript escaping of URLs
        • *
        - * + * *

        Template URI variables are indicated in the {@link #setValue(String) 'value'} * attribute and marked by braces '{variableName}'. The braces and attribute name are - * replaced by the URL encoded value of a parameter defined with the spring:param tag - * in the body of the url tag. If no parameter is available the literal value is - * passed through. Params matched to template variables will not be added to the query + * replaced by the URL encoded value of a parameter defined with the spring:param tag + * in the body of the url tag. If no parameter is available the literal value is + * passed through. Params matched to template variables will not be added to the query * string. - * - *

        Use of the spring:param tag for URI template variables is strongly recommended - * over direct EL substitution as the values are URL encoded. Failure to properly + * + *

        Use of the spring:param tag for URI template variables is strongly recommended + * over direct EL substitution as the values are URL encoded. Failure to properly * encode URL can leave an application vulnerable to XSS and other injection attacks. - * - *

        URLs can be HTML/XML escaped by setting the {@link #setHtmlEscape(String) - * 'htmlEscape'} attribute to 'true'. Detects an HTML escaping setting, either on - * this tag instance, the page level, or the web.xml level. The default + * + *

        URLs can be HTML/XML escaped by setting the {@link #setHtmlEscape(String) + * 'htmlEscape'} attribute to 'true'. Detects an HTML escaping setting, either on + * this tag instance, the page level, or the web.xml level. The default * is 'false'. When setting the URL value into a variable, escaping is not recommended. - * + * *

        Example usage: *

        <spring:url value="/url/path/{variableName}">
          *   <spring:param name="variableName" value="more than JSTL c:url" />
          * </spring:url>
        * Results in: * /currentApplicationContext/url/path/more%20than%20JSTL%20c%3Aurl - * + * * @author Scott Andrews * @since 3.0 * @see ParamTag @@ -171,13 +171,13 @@ public int doStartTagInternal() throws JspException { @Override public int doEndTag() throws JspException { String url = createUrl(); - + RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor(); ServletRequest request = this.pageContext.getRequest(); if ((processor != null) && (request instanceof HttpServletRequest)) { url = processor.processUrl((HttpServletRequest) request, url); } - + if (this.var == null) { // print the url to the writer try { @@ -229,7 +229,7 @@ private String createUrl() throws JspException { // HTML and/or JavaScript escape, if demanded. urlStr = isHtmlEscape() ? HtmlUtils.htmlEscape(urlStr) : urlStr; urlStr = this.javaScriptEscape ? JavaScriptUtils.javaScriptEscape(urlStr) : urlStr; - + return urlStr; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java index ff1420f401bc..10a31b974d7e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java @@ -96,7 +96,7 @@ protected String autogenerateId() throws JspException { protected boolean isValidDynamicAttribute(String localName, Object value) { return !"type".equals(localName); } - + /** * Return the type of the HTML input element to generate: * "checkbox" or "radio". diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractFormTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractFormTag.java index 7e898f8be914..6a5f725a19e3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractFormTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractFormTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java index bc098505a17f..438fab446829 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementBodyTag.java @@ -27,7 +27,7 @@ /** * Convenient super class for many html tags that render content using the databinding * features of the {@link AbstractHtmlElementTag AbstractHtmlElementTag}. The only thing sub tags - * need to do is override {@link #renderDefaultContent(TagWriter)}. + * need to do is override {@link #renderDefaultContent(TagWriter)}. * * @author Rob Harrop * @author Juergen Hoeller diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java index 32b5f206538d..fb98a889e521 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.DynamicAttributes; -import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; @@ -29,13 +28,13 @@ /** * Base class for databinding-aware JSP tags that render HTML element. Provides * a set of properties corresponding to the set of HTML attributes that are common - * across elements. - * - *

        Additionally, this base class allows for rendering non-standard attributes - * as part of the tag's output. These attributes are accessible to subclasses if - * needed via the {@link AbstractHtmlElementTag#getDynamicAttributes() dynamicAttributes} + * across elements. + * + *

        Additionally, this base class allows for rendering non-standard attributes + * as part of the tag's output. These attributes are accessible to subclasses if + * needed via the {@link AbstractHtmlElementTag#getDynamicAttributes() dynamicAttributes} * map. - * + * * @author Rob Harrop * @author Jeremy Grelle * @author Rossen Stoyanchev @@ -109,7 +108,7 @@ public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElemen private String onkeyup; private String onkeydown; - + private Map dynamicAttributes; @@ -383,14 +382,14 @@ public void setOnkeydown(String onkeydown) { protected String getOnkeydown() { return this.onkeydown; } - + /** - * Get the map of dynamic attributes. + * Get the map of dynamic attributes. */ protected Map getDynamicAttributes() { return this.dynamicAttributes; } - + /** * {@inheritDoc} */ @@ -404,7 +403,7 @@ public void setDynamicAttribute(String uri, String localName, Object value ) thr } dynamicAttributes.put(localName, value); } - + /** * Whether the given name-value pair is a valid dynamic attribute. */ @@ -445,7 +444,7 @@ protected void writeOptionalAttributes(TagWriter tagWriter) throws JspException writeOptionalAttribute(tagWriter, ONKEYPRESS_ATTRIBUTE, getOnkeypress()); writeOptionalAttribute(tagWriter, ONKEYUP_ATTRIBUTE, getOnkeyup()); writeOptionalAttribute(tagWriter, ONKEYDOWN_ATTRIBUTE, getOnkeydown()); - + if (!CollectionUtils.isEmpty(this.dynamicAttributes)) { for (String attr : this.dynamicAttributes.keySet()) { tagWriter.writeOptionalAttributeValue(attr, getDisplayString(this.dynamicAttributes.get(attr))); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlInputElementTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlInputElementTag.java index c5a3d549ae28..4d9ca3fb011d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlInputElementTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlInputElementTag.java @@ -162,7 +162,7 @@ public void setReadonly(String readonly) { /** * Gets the value of the 'readonly' attribute. * May be a runtime expression. - * @see #isReadonly() + * @see #isReadonly() */ protected String getReadonly() { return this.readonly; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java index 6cf8af15712a..eb4412eef811 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -199,7 +199,7 @@ protected int writeTagContent(TagWriter tagWriter) throws JspException { if (itemsObject == null && boundType != null && boundType.isEnum()) { itemsObject = boundType.getEnumConstants(); } - + if (itemsObject == null) { throw new IllegalArgumentException("Attribute 'items' is required and must be a Collection, an Array or a Map"); } @@ -212,18 +212,19 @@ protected int writeTagContent(TagWriter tagWriter) throws JspException { } } else if (itemsObject instanceof Collection) { - final Collection optionCollection = (Collection) itemsObject; + final Collection optionCollection = (Collection) itemsObject; int itemIndex = 0; - for (Iterator it = optionCollection.iterator(); it.hasNext(); itemIndex++) { + for (Iterator it = optionCollection.iterator(); it.hasNext(); itemIndex++) { Object item = it.next(); writeObjectEntry(tagWriter, valueProperty, labelProperty, item, itemIndex); } } else if (itemsObject instanceof Map) { - final Map optionMap = (Map) itemsObject; + final Map optionMap = (Map) itemsObject; int itemIndex = 0; - for (Iterator it = optionMap.entrySet().iterator(); it.hasNext(); itemIndex++) { - Map.Entry entry = (Map.Entry) it.next(); + for (@SuppressWarnings("rawtypes") + Iterator it = optionMap.entrySet().iterator(); it.hasNext(); itemIndex++) { + Map.Entry entry = (Map.Entry) it.next(); writeMapEntry(tagWriter, valueProperty, labelProperty, entry, itemIndex); } } @@ -241,10 +242,10 @@ private void writeObjectEntry(TagWriter tagWriter, String valueProperty, Object renderValue; if (valueProperty != null) { renderValue = wrapper.getPropertyValue(valueProperty); - } + } else if (item instanceof Enum) { renderValue = ((Enum) item).name(); - } + } else { renderValue = item; } @@ -253,7 +254,7 @@ else if (item instanceof Enum) { } private void writeMapEntry(TagWriter tagWriter, String valueProperty, - String labelProperty, Map.Entry entry, int itemIndex) throws JspException { + String labelProperty, Map.Entry entry, int itemIndex) throws JspException { Object mapKey = entry.getKey(); Object mapValue = entry.getValue(); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java index e96b1eecba7e..22a3971cb9fa 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ButtonTag.java @@ -21,7 +21,7 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor; /** - * An HTML button tag. This tag is provided for completeness if the application + * An HTML button tag. This tag is provided for completeness if the application * relies on a {@link RequestDataValueProcessor}. * * @author Rossen Stoyanchev @@ -38,7 +38,7 @@ public class ButtonTag extends AbstractHtmlElementTag { private TagWriter tagWriter; private String name; - + private String value; private String disabled; @@ -63,21 +63,21 @@ public void setName(String name) { public String getValue() { return this.value; } - + /** * Set the value of the 'value' attribute. */ public void setValue(String value) { this.value = value; } - + /** * Get the value of the 'disabled' attribute. */ public String getDisabled() { return this.disabled; } - + /** * Set the value of the 'disabled' attribute. * May be a runtime expression. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java index cd4ff0e5150b..acd1b1ad7153 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ protected void writeTagDetails(TagWriter tagWriter) throws JspException { tagWriter.writeAttribute("type", getInputType()); Object boundValue = getBoundValue(); - Class valueType = getBindStatus().getValueType(); + Class valueType = getBindStatus().getValueType(); if (Boolean.class.equals(valueType) || boolean.class.equals(valueType)) { // the concrete type may not be a Boolean - can be String @@ -85,7 +85,7 @@ protected void writeTagDetails(TagWriter tagWriter) throws JspException { if (value == null) { throw new IllegalArgumentException("Attribute 'value' is required when binding to non-boolean values"); } - Object resolvedValue = (value instanceof String ? evaluate("value", (String) value) : value); + Object resolvedValue = (value instanceof String ? evaluate("value", value) : value); renderFromValue(resolvedValue, tagWriter); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ErrorsTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ErrorsTag.java index 2a8d0f5ba511..fb8b1ff78f31 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ErrorsTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/ErrorsTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/HiddenInputTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/HiddenInputTag.java index 1afec35d8a74..70ccd7d34732 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/HiddenInputTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/HiddenInputTag.java @@ -48,7 +48,7 @@ public class HiddenInputTag extends AbstractHtmlElementTag { public String getDisabled() { return this.disabled; } - + /** * Set the value of the 'disabled' attribute. * May be a runtime expression. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java index 258da68648ef..0306aac63690 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/InputTag.java @@ -21,7 +21,7 @@ /** * Data-binding-aware JSP tag for rendering an HTML 'input' * element with a 'type' of 'text'. - * + * * @author Rob Harrop * @author Juergen Hoeller * @author Rossen Stoyanchev @@ -172,7 +172,7 @@ protected void writeValue(TagWriter tagWriter) throws JspException { } /** - * Flags {@code type="checkbox"} and {@code type="radio"} as illegal + * Flags {@code type="checkbox"} and {@code type="radio"} as illegal * dynamic attributes. */ @Override @@ -184,7 +184,7 @@ protected boolean isValidDynamicAttribute(String localName, Object value) { } return true; } - + /** * Get the value of the 'type' attribute. Subclasses * can override this to change the type of 'input' element diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/LabelTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/LabelTag.java index b2237cad903a..2dcf87a747be 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/LabelTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/LabelTag.java @@ -62,7 +62,7 @@ public class LabelTag extends AbstractHtmlElementTag { /** * Set the value of the 'for' attribute. *

        Defaults to the value of {@link #getPath}; may be a runtime expression. - * @throws IllegalArgumentException if the supplied value is null + * @throws IllegalArgumentException if the supplied value is null */ public void setFor(String forId) { Assert.notNull(forId, "'forId' must not be null"); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java index 0fa3de81d97b..57d2d75cef40 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java @@ -26,9 +26,9 @@ /** * JSP tag for rendering an HTML 'option' tag. - * + * *

        Must be used nested inside a {@link SelectTag}. - * + * *

        Provides full support for databinding by marking an * 'option' as 'selected' if the {@link #setValue value} * matches the value bound to the out {@link SelectTag}. @@ -67,7 +67,7 @@ public class OptionTag extends AbstractHtmlElementBodyTag implements BodyTag { * The name of the 'value' attribute. */ private static final String VALUE_ATTRIBUTE = VALUE_VARIABLE_NAME; - + /** * The name of the 'disabled' attribute. */ @@ -87,7 +87,7 @@ public class OptionTag extends AbstractHtmlElementBodyTag implements BodyTag { private Object oldValue; private Object oldDisplayValue; - + private String disabled; @@ -105,7 +105,7 @@ public void setValue(Object value) { protected Object getValue() { return this.value; } - + /** * Set the value of the 'disabled' attribute. *

        May be a runtime expression. @@ -121,10 +121,10 @@ public void setDisabled(String disabled) { protected String getDisabled() { return this.disabled; } - + /** * Is the current HTML tag disabled? - * @return true if this tag is disabled + * @return true if this tag is disabled */ protected boolean isDisabled() throws JspException { return evaluateBoolean(DISABLED_ATTRIBUTE, getDisabled()); @@ -239,7 +239,7 @@ private String getLabelValue(Object resolvedValue) throws JspException { private void assertUnderSelectTag() { TagUtils.assertHasAncestorOfType(this, SelectTag.class, "option", "select"); } - + private SelectTag getSelectTag() { return (SelectTag) findAncestorWithClass(this, SelectTag.class); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java index 8fb4edbd5cea..bfba0ac42a13 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,18 +20,12 @@ import java.util.Collection; import java.util.Map; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; -import javax.servlet.jsp.PageContext; - import org.springframework.beans.BeanWrapper; import org.springframework.beans.PropertyAccessorFactory; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.web.servlet.support.BindStatus; -import org.springframework.web.servlet.support.RequestDataValueProcessor; -import org.springframework.web.servlet.support.RequestContext; /** * Provides supporting functionality to render a list of 'option' @@ -47,7 +41,7 @@ * the labelProperty). These properties are then used when * rendering each element of the array/{@link Collection} as an 'option'. * If either property name is omitted, the value of {@link Object#toString()} of - * the corresponding array/{@link Collection} element is used instead. However, + * the corresponding array/{@link Collection} element is used instead. However, * if the item is an enum, {@link Enum#name()} is used as the default value. *

        *

        Using a {@link Map}:

        @@ -141,7 +135,7 @@ else if (this.optionSource instanceof Collection) { else if (this.optionSource instanceof Map) { renderFromMap(tagWriter); } - else if (this.optionSource instanceof Class && ((Class) this.optionSource).isEnum()) { + else if (this.optionSource instanceof Class && ((Class) this.optionSource).isEnum()) { renderFromEnum(tagWriter); } else { @@ -164,8 +158,8 @@ private void renderFromArray(TagWriter tagWriter) throws JspException { * @see #renderOption(TagWriter, Object, Object, Object) */ private void renderFromMap(TagWriter tagWriter) throws JspException { - Map optionMap = (Map) this.optionSource; - for (Map.Entry entry : optionMap.entrySet()) { + Map optionMap = (Map) this.optionSource; + for (Map.Entry entry : optionMap.entrySet()) { Object mapKey = entry.getKey(); Object mapValue = entry.getValue(); Object renderValue = (this.valueProperty != null ? @@ -183,7 +177,7 @@ private void renderFromMap(TagWriter tagWriter) throws JspException { * @see #doRenderFromCollection(java.util.Collection, TagWriter) */ private void renderFromCollection(TagWriter tagWriter) throws JspException { - doRenderFromCollection((Collection) this.optionSource, tagWriter); + doRenderFromCollection((Collection) this.optionSource, tagWriter); } /** @@ -191,7 +185,7 @@ private void renderFromCollection(TagWriter tagWriter) throws JspException { * @see #doRenderFromCollection(java.util.Collection, TagWriter) */ private void renderFromEnum(TagWriter tagWriter) throws JspException { - doRenderFromCollection(CollectionUtils.arrayToList(((Class) this.optionSource).getEnumConstants()), tagWriter); + doRenderFromCollection(CollectionUtils.arrayToList(((Class) this.optionSource).getEnumConstants()), tagWriter); } /** @@ -200,7 +194,7 @@ private void renderFromEnum(TagWriter tagWriter) throws JspException { * when rendering the 'value' of the 'option' and the value of the * {@link #labelProperty} property is used when rendering the label. */ - private void doRenderFromCollection(Collection optionCollection, TagWriter tagWriter) throws JspException { + private void doRenderFromCollection(Collection optionCollection, TagWriter tagWriter) throws JspException { for (Object item : optionCollection) { BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(item); Object value; @@ -228,7 +222,7 @@ private void renderOption(TagWriter tagWriter, Object item, Object value, Object String valueDisplayString = getDisplayString(value); String labelDisplayString = getDisplayString(label); - + valueDisplayString = processOptionValue(valueDisplayString); // allows render values to handle some strange browser compat issues. @@ -254,13 +248,13 @@ private String getDisplayString(Object value) { } /** - * Process the option value before it is written. - * The default implementation simply returns the same value unchanged. + * Process the option value before it is written. + * The default implementation simply returns the same value unchanged. */ protected String processOptionValue(String resolvedValue) { return resolvedValue; } - + /** * Determine whether the supplied values matched the selected value. * Delegates to {@link SelectedValueComparator#isSelected}. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java index bf145a9c9cee..8048b65cac07 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ package org.springframework.web.servlet.tags.form; import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.TagSupport; - import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; @@ -29,16 +27,16 @@ * Convenient tag that allows one to supply a collection of objects * that are to be rendered as 'option' tags within a * 'select' tag. - * + * *

        Must be used within a {@link SelectTag 'select' tag}. - * + * * @author Rob Harrop * @author Juergen Hoeller * @author Scott Andrews * @since 2.0 */ public class OptionsTag extends AbstractHtmlElementTag { - + /** * The {@link java.util.Collection}, {@link java.util.Map} or array of * objects used to generate the inner 'option' tags. @@ -200,8 +198,8 @@ protected BindStatus getBindStatus() { * Inner class that adapts OptionWriter for multiple options to be rendered. */ private class OptionsWriter extends OptionWriter { - - private final String selectName; + + private final String selectName; public OptionsWriter(String selectName, Object optionSource, String valueProperty, String labelProperty) { super(optionSource, getBindStatus(), valueProperty, labelProperty, isHtmlEscape()); @@ -223,7 +221,7 @@ protected void writeCommonAttributes(TagWriter tagWriter) throws JspException { protected String processOptionValue(String value) { return processFieldValue(this.selectName, value, "option"); } - + } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/RadioButtonTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/RadioButtonTag.java index e2014ed7146c..44c650ab10e6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/RadioButtonTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/RadioButtonTag.java @@ -27,7 +27,7 @@ * *

        A typical usage pattern will involved multiple tag instances bound * to the same property but with different values. - * + * * @author Rob Harrop * @author Juergen Hoeller * @since 2.0 diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java index aab847886da3..c697e57c34ba 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -268,7 +268,7 @@ else if (this.multiple instanceof String) { */ private boolean forceMultiple() throws JspException { BindStatus bindStatus = getBindStatus(); - Class valueType = bindStatus.getValueType(); + Class valueType = bindStatus.getValueType(); if (valueType != null && typeRequiresMultiple(valueType)) { return true; } @@ -285,7 +285,7 @@ else if (bindStatus.getEditor() != null) { * Returns 'true' for arrays, {@link Collection Collections} * and {@link Map Maps}. */ - private static boolean typeRequiresMultiple(Class type) { + private static boolean typeRequiresMultiple(Class type) { return (type.isArray() || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)); } @@ -312,5 +312,5 @@ public void doFinally() { this.tagWriter = null; this.pageContext.removeAttribute(LIST_VALUE_PAGE_ATTRIBUTE); } - + } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java index 510c2f16a010..9306933ce134 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/SelectedValueComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,14 +32,14 @@ * inequality, logical (String-representation-based) equality and {@link PropertyEditor}-based comparison. * *

        Full support is provided for comparing arrays, {@link Collection Collections} and {@link Map Maps}. - * + * *

        Equality Contract

        * For single-valued objects equality is first tested using standard {@link Object#equals Java equality}. As * such, user code should endeavour to implement {@link Object#equals} to speed up the comparison process. If * {@link Object#equals} returns false then an attempt is made at an * {@link #exhaustiveCompare exhaustive comparison} with the aim being to prove equality rather * than disprove it. - * + * *

        Special support is given for instances of {@link LabeledEnum} with a String-based * comparison of the candidate value against the code of the {@link LabeledEnum}. This can be useful when a * {@link LabeledEnum} is used to define a list of '<option>' elements in HTML. @@ -47,7 +47,7 @@ *

        Next, an attempt is made to compare the String representations of both the candidate and bound * values. This may result in true in a number of cases due to the fact both values will be represented * as Strings when shown to the user. - * + * *

        Next, if the candidate value is a String, an attempt is made to compare the bound value to * result of applying the corresponding {@link PropertyEditor} to the candidate. This comparison may be * executed twice, once against the direct String instances, and then against the String @@ -94,10 +94,10 @@ else if (boundValue == null) { selected = collectionCompare(CollectionUtils.arrayToList(boundValue), candidateValue, bindStatus); } else if (boundValue instanceof Collection) { - selected = collectionCompare((Collection) boundValue, candidateValue, bindStatus); + selected = collectionCompare((Collection) boundValue, candidateValue, bindStatus); } else if (boundValue instanceof Map) { - selected = mapCompare((Map) boundValue, candidateValue, bindStatus); + selected = mapCompare((Map) boundValue, candidateValue, bindStatus); } if (!selected) { selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null); @@ -105,7 +105,7 @@ else if (boundValue instanceof Map) { return selected; } - private static boolean collectionCompare(Collection boundCollection, Object candidateValue, BindStatus bindStatus) { + private static boolean collectionCompare(Collection boundCollection, Object candidateValue, BindStatus bindStatus) { try { if (boundCollection.contains(candidateValue)) { return true; @@ -117,7 +117,7 @@ private static boolean collectionCompare(Collection boundCollection, Object cand return exhaustiveCollectionCompare(boundCollection, candidateValue, bindStatus); } - private static boolean mapCompare(Map boundMap, Object candidateValue, BindStatus bindStatus) { + private static boolean mapCompare(Map boundMap, Object candidateValue, BindStatus bindStatus) { try { if (boundMap.containsKey(candidateValue)) { return true; @@ -130,7 +130,7 @@ private static boolean mapCompare(Map boundMap, Object candidateValue, BindStatu } private static boolean exhaustiveCollectionCompare( - Collection collection, Object candidateValue, BindStatus bindStatus) { + Collection collection, Object candidateValue, BindStatus bindStatus) { Map convertedValueCache = new HashMap(1); PropertyEditor editor = null; @@ -165,7 +165,7 @@ private static boolean exhaustiveCompare(Object boundValue, Object candidate, } } else if (boundValue.getClass().isEnum()) { - Enum boundEnum = (Enum) boundValue; + Enum boundEnum = (Enum) boundValue; String enumCodeAsString = ObjectUtils.getDisplayString(boundEnum.name()); if (enumCodeAsString.equals(candidateDisplayString)) { return true; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java index 0c5dfa5e9bed..21c6ae46a46c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/TagWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public class TagWriter { /** * Stores {@link TagStateEntry tag state}. Stack model naturally supports tag nesting. */ - private final Stack tagState = new Stack(); + private final Stack tagState = new Stack(); /** @@ -194,7 +194,7 @@ private boolean inTag() { } private TagStateEntry currentState() { - return (TagStateEntry) this.tagState.peek(); + return this.tagState.peek(); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/CookieThemeResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/CookieThemeResolver.java index 7ff5301bd53d..c01fde5f5167 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/CookieThemeResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/CookieThemeResolver.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/SessionThemeResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/SessionThemeResolver.java index 5de95d1ab1f6..b810a51f6711 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/SessionThemeResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/SessionThemeResolver.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/package-info.java index ffe608db9147..a29b6a030430 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/theme/package-info.java @@ -4,17 +4,17 @@ * Theme support classes for Spring's web MVC framework. * Provides standard ThemeResolver implementations, * and a HandlerInterceptor for theme changes. - * + * *

        *

          - *
        • If you don't provide a bean of one of these classes as themeResolver, + *
        • If you don't provide a bean of one of these classes as themeResolver, * a FixedThemeResolver will be provided with the default theme name 'theme'.
        • - *
        • If you use a defined FixedThemeResolver, you will able to use another theme + *
        • If you use a defined FixedThemeResolver, you will able to use another theme * name for default, but the users will stick on this theme.
        • *
        • With a CookieThemeResolver or SessionThemeResolver, you can allow * the user to change his current theme.
        • *
        • Generally, you will put in the themes resource bundles the paths of CSS files, images and HTML constructs.
        • - *
        • For retrieving themes data, you can either use the spring:theme tag in JSP or access via the + *
        • For retrieving themes data, you can either use the spring:theme tag in JSP or access via the * RequestContext for other view technologies.
        • *
        • The pagedlist demo application uses themes
        • *
        diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractCachingViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractCachingViewResolver.java index 71706e805235..b26ba0e8bd32 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractCachingViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractCachingViewResolver.java @@ -159,8 +159,8 @@ protected Object getCacheKey(String viewName, Locale locale) { * @param locale the locale for which the view object should be removed */ public void removeFromCache(String viewName, Locale locale) { - if (!isCache()) { - logger.warn("View caching is SWITCHED OFF -- removal not necessary"); + if (!this.cache) { + logger.warn("View caching is SWITCHED OFF -- removal not necessary"); } else { Object cacheKey = getCacheKey(viewName, locale); @@ -173,7 +173,7 @@ public void removeFromCache(String viewName, Locale locale) { if (logger.isDebugEnabled()) { logger.debug("No cached instance for view '" + cacheKey + "' was found"); } - } + } else { if (logger.isDebugEnabled()) { logger.debug("Cache for view " + cacheKey + " has been cleared"); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateView.java index c613e2124c78..6c5400a9e9e3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,8 +117,8 @@ protected final void renderMergedOutputModel( Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { if (this.exposeRequestAttributes) { - for (Enumeration en = request.getAttributeNames(); en.hasMoreElements();) { - String attribute = (String) en.nextElement(); + for (Enumeration en = request.getAttributeNames(); en.hasMoreElements();) { + String attribute = en.nextElement(); if (model.containsKey(attribute) && !this.allowRequestOverride) { throw new ServletException("Cannot expose request attribute '" + attribute + "' because of an existing model object of the same name"); @@ -135,8 +135,8 @@ protected final void renderMergedOutputModel( if (this.exposeSessionAttributes) { HttpSession session = request.getSession(false); if (session != null) { - for (Enumeration en = session.getAttributeNames(); en.hasMoreElements();) { - String attribute = (String) en.nextElement(); + for (Enumeration en = session.getAttributeNames(); en.hasMoreElements();) { + String attribute = en.nextElement(); if (model.containsKey(attribute) && !this.allowSessionOverride) { throw new ServletException("Cannot expose session attribute '" + attribute + "' because of an existing model object of the same name"); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateViewResolver.java index 7a13309b67f3..691a19ad0bdf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/AbstractTemplateViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public class AbstractTemplateViewResolver extends UrlBasedViewResolver { @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return AbstractTemplateView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java index 94595d54b9ce..a8ca84e66454 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public View resolveViewName(String viewName, Locale locale) throws BeansExceptio // Allow for ViewResolver chaining. return null; } - return (View) context.getBean(viewName, View.class); + return context.getBean(viewName, View.class); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceView.java index 36f0af33aed8..fb4875d684ff 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java index d55850765118..0dc5c17d8078 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/InternalResourceViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver { * is present. */ public InternalResourceViewResolver() { - Class viewClass = requiredViewClass(); + Class viewClass = requiredViewClass(); if (viewClass.equals(InternalResourceView.class) && jstlPresent) { viewClass = JstlView.class; } @@ -74,7 +74,7 @@ public InternalResourceViewResolver() { * This resolver requires {@link InternalResourceView}. */ @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return InternalResourceView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/RedirectView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/RedirectView.java index 14adcfa3ea82..47b165009b0e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/RedirectView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/RedirectView.java @@ -54,13 +54,13 @@ /** *

        View that redirects to an absolute, context relative, or current request - * relative URL. The URL may be a URI template in which case the URI template - * variables will be replaced with values available in the model. By default - * all primitive model attributes (or collections thereof) are exposed as HTTP - * query parameters (assuming they've not been used as URI template variables), - * but this behavior can be changed by overriding the + * relative URL. The URL may be a URI template in which case the URI template + * variables will be replaced with values available in the model. By default + * all primitive model attributes (or collections thereof) are exposed as HTTP + * query parameters (assuming they've not been used as URI template variables), + * but this behavior can be changed by overriding the * {@link #isEligibleProperty(String, Object)} method. - * + * *

        A URL for this view is supposed to be a HTTP redirect URL, i.e. * suitable for HttpServletResponse's sendRedirect method, which * is what actually does the redirect if the HTTP 1.0 flag is on, or via sending @@ -262,7 +262,7 @@ protected void renderMergedOutputModel( String targetUrl = createTargetUrl(model, request); targetUrl = updateTargetUrl(targetUrl, model, request, response); - + FlashMap flashMap = RequestContextUtils.getOutputFlashMap(request); if (!CollectionUtils.isEmpty(flashMap)) { UriComponents uriComponents = UriComponentsBuilder.fromUriString(targetUrl).build(); @@ -277,13 +277,13 @@ protected void renderMergedOutputModel( } /** - * Creates the target URL by checking if the redirect string is a URI template first, - * expanding it with the given model, and then optionally appending simple type model + * Creates the target URL by checking if the redirect string is a URI template first, + * expanding it with the given model, and then optionally appending simple type model * attributes as query String parameters. */ protected final String createTargetUrl(Map model, HttpServletRequest request) throws UnsupportedEncodingException { - + // Prepare target URL. StringBuilder targetUrl = new StringBuilder(); if (this.contextRelative && getUrl().startsWith("/")) { @@ -304,7 +304,7 @@ protected final String createTargetUrl(Map model, HttpServletReq Map variables = getCurrentRequestUriVariables(request); targetUrl = replaceUriTemplateVariables(targetUrl.toString(), model, variables, enc); } - + if (this.exposeModelAttributes) { appendQueryProperties(targetUrl, model, enc); } @@ -313,9 +313,9 @@ protected final String createTargetUrl(Map model, HttpServletReq } /** - * Replace URI template variables in the target URL with encoded model + * Replace URI template variables in the target URL with encoded model * attributes or URI variables from the current request. Model attributes - * referenced in the URL are removed from the model. + * referenced in the URL are removed from the model. * @param targetUrl the redirect URL * @param model Map that contains model attributes * @param currentUriVariables current request URI variables to use @@ -325,7 +325,7 @@ protected final String createTargetUrl(Map model, HttpServletReq protected StringBuilder replaceUriTemplateVariables( String targetUrl, Map model, Map currentUriVariables, String encodingScheme) throws UnsupportedEncodingException { - + StringBuilder result = new StringBuilder(); Matcher m = URI_TEMPLATE_VARIABLE_PATTERN.matcher(targetUrl); int endLastMatch = 0; @@ -343,11 +343,11 @@ protected StringBuilder replaceUriTemplateVariables( @SuppressWarnings("unchecked") private Map getCurrentRequestUriVariables(HttpServletRequest request) { - Map uriVars = + Map uriVars = (Map) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); return (uriVars != null) ? uriVars : Collections. emptyMap(); } - + /** * Append query properties to the redirect URL. * Stringifies, URL-encodes and formats model attributes as query properties. @@ -373,12 +373,12 @@ protected void appendQueryProperties(StringBuilder targetUrl, Map entry : queryProperties(model).entrySet()) { Object rawValue = entry.getValue(); - Iterator valueIter; + Iterator valueIter; if (rawValue != null && rawValue.getClass().isArray()) { valueIter = Arrays.asList(ObjectUtils.toObjectArray(rawValue)).iterator(); } else if (rawValue instanceof Collection) { - valueIter = ((Collection) rawValue).iterator(); + valueIter = ((Collection) rawValue).iterator(); } else { valueIter = Collections.singleton(rawValue).iterator(); @@ -457,7 +457,7 @@ protected boolean isEligibleProperty(String key, Object value) { } if (value instanceof Collection) { - Collection coll = (Collection) value; + Collection coll = (Collection) value; if (coll.isEmpty()) { return false; } @@ -503,9 +503,9 @@ protected String urlEncode(String input, String encodingScheme) throws Unsupport * it to update the redirect target URL. * @return the updated URL or the same as URL as the one passed in */ - protected String updateTargetUrl(String targetUrl, Map model, + protected String updateTargetUrl(String targetUrl, Map model, HttpServletRequest request, HttpServletResponse response) { - + RequestContext requestContext = null; if (getWebApplicationContext() != null) { requestContext = createRequestContext(request, response, model); @@ -523,10 +523,10 @@ protected String updateTargetUrl(String targetUrl, Map model, targetUrl = processor.processUrl(request, targetUrl); } } - + return targetUrl; } - + /** * Send a redirect back to the HTTP client * @param request current HTTP request (allows for reacting to request method) @@ -540,7 +540,7 @@ protected void sendRedirect( throws IOException { String encodedRedirectURL = response.encodeRedirectURL(targetUrl); - + if (http10Compatible) { if (this.statusCode != null) { response.setStatus(this.statusCode.value()); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java index 93959d2ded8d..ff5315a4a3d9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java @@ -36,10 +36,10 @@ import org.springframework.web.servlet.View; /** - * {@link org.springframework.web.servlet.ViewResolver} implementation + * {@link org.springframework.web.servlet.ViewResolver} implementation * that uses bean definitions in a {@link ResourceBundle}, specified by * the bundle basename. - * + * *

        The bundle is typically defined in a properties file, located in * the class path. The default bundle basename is "views". * diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java index b9a6b6bf1191..e12d5d3bccb4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements public static final String FORWARD_URL_PREFIX = "forward:"; - private Class viewClass; + private Class viewClass; private String prefix = ""; @@ -129,7 +129,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements * (by default, AbstractUrlBasedView) * @see AbstractUrlBasedView */ - public void setViewClass(Class viewClass) { + public void setViewClass(Class viewClass) { if (viewClass == null || !requiredViewClass().isAssignableFrom(viewClass)) { throw new IllegalArgumentException( "Given view class [" + (viewClass != null ? viewClass.getName() : null) + @@ -141,7 +141,7 @@ public void setViewClass(Class viewClass) { /** * Return the view class to be used to create views. */ - protected Class getViewClass() { + protected Class getViewClass() { return this.viewClass; } @@ -150,7 +150,7 @@ protected Class getViewClass() { * This implementation returns AbstractUrlBasedView. * @see AbstractUrlBasedView */ - protected Class requiredViewClass() { + protected Class requiredViewClass() { return AbstractUrlBasedView.class; } @@ -341,13 +341,13 @@ public int getOrder() { /** * Whether views resolved by this resolver should add path variables the model or not. * The default setting is to allow each View decide (see {@link AbstractView#setExposePathVariables(boolean)}. - * However, you can use this property to override that. + * However, you can use this property to override that. * @param exposePathVariables *

          *
        • {@code true} - all Views resolved by this resolver will expose path variables *
        • {@code false} - no Views resolved by this resolver will expose path variables - *
        • {@code null} - individual Views can decide for themselves (this is used by the default) - *
            + *
          • {@code null} - individual Views can decide for themselves (this is used by the default) + *
              * @see AbstractView#setExposePathVariables(boolean) */ public void setExposePathVariables(Boolean exposePathVariables) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java index 35dc231f508f..59b45a8a8007 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ protected Object getCacheKey(String viewName, Locale locale) { protected View loadView(String viewName, Locale locale) throws BeansException { BeanFactory factory = initFactory(); try { - return (View) factory.getBean(viewName, View.class); + return factory.getBean(viewName, View.class); } catch (NoSuchBeanDefinitionException ex) { // to allow for ViewResolver chaining diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractExcelView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractExcelView.java index 9bfb9c5300b5..a0f6d1447a16 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractExcelView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractExcelView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractJExcelView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractJExcelView.java index 2a920bc6349f..0050f40313cb 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractJExcelView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractJExcelView.java @@ -33,7 +33,7 @@ /** * Convenient superclass for Excel document views. - * + * *

              This class uses the JExcelAPI instead of POI. More * information on JExcelAPI can be found on their website. @@ -43,19 +43,19 @@ *

            • url (optional): The url of an existing Excel document to pick as a * starting point. It is done without localization part nor the .xls extension. *
            - * + * *

            The file will be searched with locations in the following order: *

              *
            • [url]_[language]_[country].xls *
            • [url]_[language].xls *
            • [url].xls *
            - * + * *

            For working with the workbook in the subclass, see Java Excel API site - * + * *

            As an example, you can try this snippet: - * + * *

              * protected void buildExcelDocument(
              *      Map<String, Object> model, WritableWorkbook workbook,
            @@ -64,15 +64,15 @@
              * 	 if (workbook.getNumberOfSheets() == 0) {
              * 	     workbook.createSheet("Spring", 0);
              *   }
            - * 
            + *
              * 	 WritableSheet sheet = workbook.getSheet("Spring");
              * 	 Label label = new Label(0, 0, "This is a nice label");
              * 	 sheet.addCell(label);
              * }
            - * + * * The use of this view is close to the AbstractExcelView class, * just using the JExcel API instead of the Apache POI API. - * + * * @author Bram Smeets * @author Alef Arendsen * @author Juergen Hoeller @@ -120,7 +120,7 @@ protected boolean generatesDownloadContent() { @Override protected final void renderMergedOutputModel( Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { - + // Set the content type and get the output stream. response.setContentType(getContentType()); OutputStream out = response.getOutputStream(); @@ -129,7 +129,7 @@ protected final void renderMergedOutputModel( if (this.url != null) { Workbook template = getTemplateSource(this.url, request); workbook = Workbook.createWorkbook(out, template); - } + } else { logger.debug("Creating Excel Workbook from scratch"); workbook = Workbook.createWorkbook(out); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java index 79883878ccfa..9cca85de63fd 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java index 1f4fd24a9bdf..ee40f5d3a524 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java index acfa709977da..1a7cb958778a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractFeedView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractFeedView.java index 656bd32bbe2a..f18c311c6412 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractFeedView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractFeedView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java index 04d24b56621a..800f225dfe96 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfig.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfig.java index 595a3bea3f3e..68011c3308d7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfig.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurer.java index 1f04244b7c49..3769cecf3575 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java index 8f492adfda42..ca4538e7f233 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewResolver.java index a6129a5dedd2..591f1afc8c6b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public FreeMarkerViewResolver() { * Requires {@link FreeMarkerView}. */ @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return FreeMarkerView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java index 865b9f38556b..f9e49b3de29d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java @@ -312,7 +312,7 @@ protected final void initApplicationContext() throws ApplicationContextException "'reportDataKey' for main report is required when specifying a value for 'subReportDataKeys'"); } this.subReports = new HashMap(this.subReportUrls.size()); - for (Enumeration urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) { + for (Enumeration urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) { String key = (String) urls.nextElement(); String path = this.subReportUrls.getProperty(key); Resource resource = getApplicationContext().getResource(path); @@ -432,7 +432,7 @@ protected JRExporterParameter convertToExporterParameter(String fqFieldName) { String fieldName = fqFieldName.substring(index + 1); try { - Class cls = ClassUtils.forName(className, getApplicationContext().getClassLoader()); + Class cls = ClassUtils.forName(className, getApplicationContext().getClassLoader()); Field field = cls.getField(fieldName); if (JRExporterParameter.class.isAssignableFrom(field.getType())) { @@ -637,7 +637,7 @@ protected JasperPrint fillReport(Map model) throws Exception { } } else { - Collection values = model.values(); + Collection values = model.values(); jrDataSource = CollectionUtils.findValueOfType(values, JRDataSource.class); if (jrDataSource == null) { JRDataSourceProvider provider = CollectionUtils.findValueOfType(values, JRDataSourceProvider.class); @@ -705,7 +705,7 @@ private JasperPrint doFillReport(JasperReport report, Map model, */ private void populateHeaders(HttpServletResponse response) { // Apply the headers to the response. - for (Enumeration en = this.headers.propertyNames(); en.hasMoreElements();) { + for (Enumeration en = this.headers.propertyNames(); en.hasMoreElements();) { String key = (String) en.nextElement(); response.addHeader(key, this.headers.getProperty(key)); } @@ -795,7 +795,7 @@ protected JRDataSource createReport(JRDataSourceProvider provider) { *

            Default value types are: java.util.Collection and Object array. * @return the value types in prioritized order */ - protected Class[] getReportDataTypes() { + protected Class[] getReportDataTypes() { return new Class[] {Collection.class, Object[].class}; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsCsvView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsCsvView.java index 3ae0db1826a2..9f49d29b3169 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsCsvView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsCsvView.java @@ -43,4 +43,4 @@ protected boolean useWriter() { return true; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsMultiFormatView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsMultiFormatView.java index 8f28671ccf98..84dad31b330e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsMultiFormatView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsMultiFormatView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsViewResolver.java index c24fc71cf1dd..7f2dc072f7c5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ * {@link org.springframework.web.servlet.ViewResolver} implementation that * resolves instances of {@link AbstractJasperReportsView} by translating * the supplied view name into the URL of the report file. - * + * * @author Rob Harrop * @since 1.2.6 */ @@ -51,7 +51,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver { * Requires the view class to be a subclass of {@link AbstractJasperReportsView}. */ @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return AbstractJasperReportsView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/package-info.java index d71ad9134f8d..c6250f65dfde 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/package-info.java @@ -3,7 +3,7 @@ * * Provides standard View and ViewResolver implementations, * including abstract base classes for custom implementations. - * + * *

            Application developers don't usually need to implement views, * as the framework provides standard views for JSPs, Velocity, * XSLT, etc. However, the ability to implement custom views easily diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java index 776032c42b1f..ef4faaf2e0a9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,7 @@ import org.apache.tiles.context.TilesRequestContext; import org.apache.tiles.preparer.PreparerFactory; import org.apache.tiles.preparer.ViewPreparer; -import org.apache.tiles.servlet.context.ServletTilesRequestContext; - import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.servlet.DispatcherServlet; /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java index 527177951c94..b32a63e0d0eb 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringLocaleResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringLocaleResolver.java index 3bae928db5e5..c9ccf200c077 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringLocaleResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringLocaleResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringTilesApplicationContextFactory.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringTilesApplicationContextFactory.java index da6383a73475..477d7792d1f7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringTilesApplicationContextFactory.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/SpringTilesApplicationContextFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,9 +69,9 @@ private static class SpringWildcardServletTilesApplicationContext extends Servle public SpringWildcardServletTilesApplicationContext(ServletContext servletContext, Map params) { super(servletContext); this.mergedInitParams = new LinkedHashMap(); - Enumeration initParamNames = servletContext.getInitParameterNames(); + Enumeration initParamNames = servletContext.getInitParameterNames(); while (initParamNames.hasMoreElements()) { - String initParamName = (String) initParamNames.nextElement(); + String initParamName = initParamNames.nextElement(); this.mergedInitParams.put(initParamName, servletContext.getInitParameter(initParamName)); } if (params != null) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesConfigurer.java index ef3dcdcab0e7..c409fb2d1ee8 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -196,7 +196,7 @@ public void setTilesInitializer(TilesInitializer tilesInitializer) { public void setCompleteAutoload(boolean completeAutoload) { if (completeAutoload) { try { - Class clazz = getClass().getClassLoader().loadClass( + Class clazz = getClass().getClassLoader().loadClass( "org.apache.tiles.extras.complete.CompleteAutoloadTilesInitializer"); this.tilesInitializer = (TilesInitializer) clazz.newInstance(); } @@ -526,9 +526,9 @@ public void registerEvaluator(BasicTilesContainer container) { logger.debug("Registering Tiles 2.2 AttributeEvaluatorFactory for JSP 2.1"); try { ClassLoader cl = TilesElActivator.class.getClassLoader(); - Class aef = cl.loadClass("org.apache.tiles.evaluator.AttributeEvaluatorFactory"); - Class baef = cl.loadClass("org.apache.tiles.evaluator.BasicAttributeEvaluatorFactory"); - Constructor baefCtor = baef.getConstructor(AttributeEvaluator.class); + Class aef = cl.loadClass("org.apache.tiles.evaluator.AttributeEvaluatorFactory"); + Class baef = cl.loadClass("org.apache.tiles.evaluator.BasicAttributeEvaluatorFactory"); + Constructor baefCtor = baef.getConstructor(AttributeEvaluator.class); ELAttributeEvaluator evaluator = new ELAttributeEvaluator(); evaluator.setApplicationContext(container.getApplicationContext()); evaluator.init(new HashMap()); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesView.java index 3fad8fa775cd..a0e5d0262bf3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesViewResolver.java index 593776d68ab2..7f685c1acec6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/tiles2/TilesViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public TilesViewResolver() { * Requires {@link TilesView}. */ @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return TilesView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java index dd767b5a4a03..f8b7c4759216 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ * @see VelocityView */ public interface VelocityConfig { - + /** * Return the VelocityEngine for the current web application context. * May be unique to one servlet, or shared in the root context. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java index c476eb454694..8ff3f6f0a1b5 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java index 3e8ac3d4faee..4263a0c15b1a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java index fb358e16316c..ca5df505828d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class VelocityLayoutViewResolver extends VelocityViewResolver { * @see VelocityLayoutView */ @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return VelocityLayoutView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java index 2cc58f360bdd..bbe591af96f1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ protected Context createVelocityContext( if (getToolboxConfigLocation() != null) { ToolboxManager toolboxManager = ServletToolboxManager.getInstance( getServletContext(), getToolboxConfigLocation()); - Map toolboxContext = toolboxManager.getToolbox(velocityContext); + Map toolboxContext = toolboxManager.getToolbox(velocityContext); velocityContext.setToolbox(toolboxContext); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java index 3637c8799f1b..a1656c7ec7b0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ */ public class VelocityView extends AbstractTemplateView { - private Map toolAttributes; + private Map> toolAttributes; private String dateToolAttribute; @@ -127,7 +127,7 @@ public class VelocityView extends AbstractTemplateView { * @see #setDateToolAttribute * @see #setNumberToolAttribute */ - public void setToolAttributes(Map toolAttributes) { + public void setToolAttributes(Map> toolAttributes) { this.toolAttributes = toolAttributes; } @@ -392,9 +392,9 @@ protected void exposeHelpers(Context velocityContext, HttpServletRequest request protected void exposeToolAttributes(Context velocityContext, HttpServletRequest request) throws Exception { // Expose generic attributes. if (this.toolAttributes != null) { - for (Map.Entry entry : this.toolAttributes.entrySet()) { + for (Map.Entry> entry : this.toolAttributes.entrySet()) { String attributeName = entry.getKey(); - Class toolClass = entry.getValue(); + Class toolClass = entry.getValue(); try { Object tool = toolClass.newInstance(); initTool(tool, velocityContext); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java index 41f50bd3b41f..c6c9957843ec 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public VelocityViewResolver() { * Requires {@link VelocityView}. */ @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return VelocityView.class; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/AbstractXsltView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/AbstractXsltView.java index f1937dea7fc6..9f429d1a92a0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/AbstractXsltView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/AbstractXsltView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ /** * Convenient superclass for views rendered using an XSLT stylesheet. - * + * *

            Subclasses typically must provide the {@link Source} to transform * by overriding {@link #createXsltSource}. Subclasses do not need to * concern themselves with XSLT other than providing a valid stylesheet location. @@ -67,7 +67,7 @@ * the {@link ErrorListener} implementation instance for custom handling of warnings and errors during TransformerFactory operations *

          • {@link #setIndent(boolean) indent} (optional): whether additional whitespace * may be added when outputting the result; defaults to true - *
          • {@link #setCache(boolean) cache} (optional): are templates to be cached; debug setting only; defaults to true + *
          • {@link #setCache(boolean) cache} (optional): are templates to be cached; debug setting only; defaults to true *
          * *

          Note that setting {@link #setCache(boolean) "cache"} to false @@ -93,7 +93,7 @@ public abstract class AbstractXsltView extends AbstractView { private boolean customContentTypeSet = false; - private Class transformerFactoryClass; + private Class transformerFactoryClass; private Resource stylesheetLocation; @@ -139,7 +139,7 @@ public void setContentType(String contentType) { *

          The default constructor of the specified class will be called * to build the TransformerFactory for this view. */ - public void setTransformerFactoryClass(Class transformerFactoryClass) { + public void setTransformerFactoryClass(Class transformerFactoryClass) { Assert.isAssignable(TransformerFactory.class, transformerFactoryClass); this.transformerFactoryClass = transformerFactoryClass; } @@ -293,7 +293,7 @@ protected final void initApplicationContext() throws ApplicationContextException * @see #setTransformerFactoryClass * @see #getTransformerFactory() */ - protected TransformerFactory newTransformerFactory(Class transformerFactoryClass) { + protected TransformerFactory newTransformerFactory(Class transformerFactoryClass) { if (transformerFactoryClass != null) { try { return (TransformerFactory) transformerFactoryClass.newInstance(); @@ -394,7 +394,7 @@ protected void doTransform( Map model, Source source, HttpServletRequest request, HttpServletResponse response) throws Exception { - Map parameters = getParameters(model, request); + Map parameters = getParameters(model, request); Result result = (useWriter() ? new StreamResult(response.getWriter()) : new StreamResult(new BufferedOutputStream(response.getOutputStream()))); @@ -413,7 +413,7 @@ protected void doTransform( * @return a Map of parameters to apply to the transformation process * @see javax.xml.transform.Transformer#setParameter */ - protected Map getParameters(Map model, HttpServletRequest request) { + protected Map getParameters(Map model, HttpServletRequest request) { return getParameters(request); } @@ -427,7 +427,7 @@ protected Map getParameters(Map model, HttpServletRequest reques * @see #getParameters(Map, HttpServletRequest) * @see javax.xml.transform.Transformer#setParameter */ - protected Map getParameters(HttpServletRequest request) { + protected Map getParameters(HttpServletRequest request) { return null; } @@ -456,7 +456,7 @@ protected boolean useWriter() { * @param encoding the preferred character encoding that the underlying Transformer should use * @throws Exception if an error occurs */ - protected void doTransform(Source source, Map parameters, Result result, String encoding) + protected void doTransform(Source source, Map parameters, Result result, String encoding) throws Exception { try { @@ -475,7 +475,7 @@ protected void doTransform(Source source, Map parameters, Result // Apply any arbitrary output properties, if specified. if (this.outputProperties != null) { - Enumeration propsEnum = this.outputProperties.propertyNames(); + Enumeration propsEnum = this.outputProperties.propertyNames(); while (propsEnum.hasMoreElements()) { String propName = (String) propsEnum.nextElement(); trans.setOutputProperty(propName, this.outputProperties.getProperty(propName)); @@ -504,7 +504,7 @@ protected void doTransform(Source source, Map parameters, Result * @throws TransformerConfigurationException if the Transformer object * could not be built */ - protected Transformer buildTransformer(Map parameters) throws TransformerConfigurationException { + protected Transformer buildTransformer(Map parameters) throws TransformerConfigurationException { Templates templates = getTemplates(); Transformer transformer = (templates != null ? templates.newTransformer() : getTransformerFactory().newTransformer()); @@ -547,9 +547,9 @@ protected Templates getTemplates() throws TransformerConfigurationException { * (as determined by {@link #getParameters(Map, HttpServletRequest)}) * @param transformer the Transformer to aply the parameters */ - protected void applyTransformerParameters(Map parameters, Transformer transformer) { + protected void applyTransformerParameters(Map parameters, Transformer transformer) { if (parameters != null) { - for (Map.Entry entry : parameters.entrySet()) { + for (Map.Entry entry : parameters.entrySet()) { transformer.setParameter(entry.getKey(), entry.getValue()); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java index 0dbb27b025eb..1a08aa935eef 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ */ public class XsltView extends AbstractUrlBasedView { - private Class transformerFactoryClass; + private Class transformerFactoryClass; private String sourceKey; @@ -97,7 +97,7 @@ public class XsltView extends AbstractUrlBasedView { *

          The default constructor of the specified class will be called * to build the TransformerFactory for this view. */ - public void setTransformerFactoryClass(Class transformerFactoryClass) { + public void setTransformerFactoryClass(Class transformerFactoryClass) { Assert.isAssignable(TransformerFactory.class, transformerFactoryClass); this.transformerFactoryClass = transformerFactoryClass; } @@ -195,7 +195,7 @@ protected void initApplicationContext() throws BeansException { * @see #setTransformerFactoryClass * @see #getTransformerFactory() */ - protected TransformerFactory newTransformerFactory(Class transformerFactoryClass) { + protected TransformerFactory newTransformerFactory(Class transformerFactoryClass) { if (transformerFactoryClass != null) { try { return (TransformerFactory) transformerFactoryClass.newInstance(); @@ -283,7 +283,7 @@ protected Source locateSource(Map model) throws Exception { * {@link Reader}, {@link InputStream} and {@link Resource}. * @return the supported source types */ - protected Class[] getSourceTypes() { + protected Class[] getSourceTypes() { return new Class[] {Source.class, Document.class, Node.class, Reader.class, InputStream.class, Resource.class}; } @@ -362,7 +362,7 @@ protected final void configureIndentation(Transformer transformer) { */ protected final void copyOutputProperties(Transformer transformer) { if (this.outputProperties != null) { - Enumeration en = this.outputProperties.propertyNames(); + Enumeration en = this.outputProperties.propertyNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); transformer.setOutputProperty(name, this.outputProperties.getProperty(name)); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltViewResolver.java index 3943e5347298..76176a20e4d4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ public void setCacheTemplates(boolean cacheTemplates) { @Override - protected Class requiredViewClass() { + protected Class requiredViewClass() { return XsltView.class; } diff --git a/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java b/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java index bb5e71f5cd07..18ddbd3b78be 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java +++ b/spring-webmvc/src/test/java/org/springframework/beans/BeanWithObjectProperty.java @@ -32,4 +32,4 @@ public void setObject(Object object) { this.object = object; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/Colour.java b/spring-webmvc/src/test/java/org/springframework/beans/Colour.java index 60dc333e0b47..4db722187d9d 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/Colour.java +++ b/spring-webmvc/src/test/java/org/springframework/beans/Colour.java @@ -32,4 +32,4 @@ private Colour(int code, String label) { super(code, label); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java b/spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java index 1e43492191b0..f1d7879132cc 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java +++ b/spring-webmvc/src/test/java/org/springframework/beans/CustomEnum.java @@ -27,4 +27,4 @@ public String toString() { return "CustomEnum: " + name(); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java b/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java index 2bb41a9d5b68..db326041c361 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java +++ b/spring-webmvc/src/test/java/org/springframework/beans/DerivedTestBean.java @@ -82,4 +82,4 @@ public boolean wasDestroyed() { return destroyed; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java b/spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java index 61f911902c7b..f367fb5d6e32 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java +++ b/spring-webmvc/src/test/java/org/springframework/beans/FieldAccessBean.java @@ -41,4 +41,4 @@ public TestBean getSpouse() { return spouse; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java b/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java index 00dd127e47cf..392805199fe1 100644 --- a/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java +++ b/spring-webmvc/src/test/java/org/springframework/beans/GenericBean.java @@ -244,4 +244,4 @@ public static GenericBean createInstance(boolean someFlag, Map params = new LinkedMultiValueMap(); params.add(" ", "abc"); params.add(null, " "); - + FlashMap flashMap = new FlashMap(); flashMap.addTargetRequestParams(params); - + assertTrue(flashMap.getTargetRequestParams().isEmpty()); } - + } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java index 36824364d0f5..b82fbad46327 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/SimpleWebApplicationContext.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2005 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java index 0e08da83bde2..2e9454c7e6cd 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,7 +143,7 @@ private void verifyMessageConverters(Object bean, boolean hasDefaultRegistration assertTrue(converters.get(0) instanceof StringHttpMessageConverter); assertTrue(converters.get(1) instanceof ResourceHttpMessageConverter); } - + } class TestWebArgumentResolver implements WebArgumentResolver { @@ -176,7 +176,7 @@ public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception { } - + } class TestMessageCodesResolver implements MessageCodesResolver { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java index 639d503d0e07..680708462530 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java @@ -121,11 +121,6 @@ public void testDefaultConfig() throws Exception { assertEquals(0, mapping.getOrder()); mapping.setDefaultHandler(handlerMethod); - MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo.json"); - NativeWebRequest webRequest = new ServletWebRequest(request); - ContentNegotiationManager manager = mapping.getContentNegotiationManager(); - assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(webRequest)); - RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class); assertNotNull(adapter); assertEquals(false, new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect")); @@ -461,39 +456,6 @@ public void testViewControllersDefaultConfig() { assertEquals(2, beanNameMapping.getOrder()); } - @Test - public void testContentNegotiationManager() throws Exception { - loadBeanDefinitions("mvc-config-content-negotiation-manager.xml", 12); - - RequestMappingHandlerMapping mapping = appContext.getBean(RequestMappingHandlerMapping.class); - ContentNegotiationManager manager = mapping.getContentNegotiationManager(); - - MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo.xml"); - NativeWebRequest webRequest = new ServletWebRequest(request); - assertEquals(Arrays.asList(MediaType.valueOf("application/rss+xml")), manager.resolveMediaTypes(webRequest)); - } - - @Test - public void testAsyncSupportOptions() throws Exception { - loadBeanDefinitions("mvc-config-async-support.xml", 13); - - RequestMappingHandlerAdapter adapter = appContext.getBean(RequestMappingHandlerAdapter.class); - assertNotNull(adapter); - - DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(adapter); - assertEquals(ConcurrentTaskExecutor.class, fieldAccessor.getPropertyValue("taskExecutor").getClass()); - assertEquals(2500L, fieldAccessor.getPropertyValue("asyncRequestTimeout")); - - CallableProcessingInterceptor[] callableInterceptors = - (CallableProcessingInterceptor[]) fieldAccessor.getPropertyValue("callableInterceptors"); - assertEquals(1, callableInterceptors.length); - - DeferredResultProcessingInterceptor[] deferredResultInterceptors = - (DeferredResultProcessingInterceptor[]) fieldAccessor.getPropertyValue("deferredResultInterceptors"); - assertEquals(1, deferredResultInterceptors.length); - } - - private void loadBeanDefinitions(String fileName, int expectedBeanCount) { XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext); ClassPathResource resource = new ClassPathResource(fileName, AnnotationDrivenBeanDefinitionParserTests.class); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java index 54c2e0bc0cb4..816cdc822250 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java @@ -37,7 +37,7 @@ public class ResourceHandlerRegistryTests { private ResourceHandlerRegistry registry; - + private ResourceHandlerRegistration registration; private MockHttpServletResponse response; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistryTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistryTests.java index b6e3ad28385d..888cdfe9b288 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistryTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewControllerRegistryTests.java @@ -63,7 +63,7 @@ public void addViewControllerWithViewName() { assertNotNull(controller); assertEquals("viewName", controller.getViewName()); } - + @Test public void order() { registry.addViewController("/path"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/BeanNameUrlHandlerMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/BeanNameUrlHandlerMappingTests.java index 18ec7f90685a..6e018218fd78 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/BeanNameUrlHandlerMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/BeanNameUrlHandlerMappingTests.java @@ -35,7 +35,7 @@ public class BeanNameUrlHandlerMappingTests extends TestCase { public static final String CONF = "/org/springframework/web/servlet/handler/map1.xml"; - + private ConfigurableWebApplicationContext wac; public void setUp() throws Exception { @@ -82,7 +82,7 @@ private void doTestRequestsWithSubPaths(HandlerMapping hm) throws Exception { req.setContextPath("/myapp"); hec = hm.getHandler(req); assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean); - + req = new MockHttpServletRequest("GET", "/myapp/mypath/welcome.html"); req.setContextPath("/myapp"); req.setServletPath("/mypath/welcome.html"); @@ -109,7 +109,7 @@ private void doTestRequestsWithSubPaths(HandlerMapping hm) throws Exception { hec = hm.getHandler(req); assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean); } - + public void testRequestsWithFullPaths() throws Exception { BeanNameUrlHandlerMapping hm = new BeanNameUrlHandlerMapping(); hm.setAlwaysUseFullPath(true); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/HandlerMethodMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/HandlerMethodMappingTests.java index a96fe8a3c8a2..27d0242c174d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/HandlerMethodMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/HandlerMethodMappingTests.java @@ -157,4 +157,4 @@ public void handlerMethod1() { public void handlerMethod2() { } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/PathMatchingUrlHandlerMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/PathMatchingUrlHandlerMappingTests.java index 3be63ed6bc23..d5ac8bdb1943 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/PathMatchingUrlHandlerMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/PathMatchingUrlHandlerMappingTests.java @@ -16,10 +16,8 @@ package org.springframework.web.servlet.handler; -import junit.framework.TestCase; - -import org.springframework.mock.web.test.MockHttpServletRequest; -import org.springframework.mock.web.test.MockServletContext; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockServletContext; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext; import org.springframework.web.servlet.HandlerExecutionChain; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMappingTests.java index e2d017609d4e..e2d2e695a3da 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMappingTests.java @@ -19,8 +19,6 @@ import java.util.Map; import java.util.LinkedHashMap; -import junit.framework.TestCase; - import org.springframework.beans.FatalBeanException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/i18n/LocaleResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/i18n/LocaleResolverTests.java index b109bc81ad9e..3f55db20cceb 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/i18n/LocaleResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/i18n/LocaleResolverTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2012 the original author or authors. - * + * Copyright 2002-2005 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java index ff5ecdeb49f4..3acfd2f37649 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/CommandControllerTests.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2012 the original author or authors. - * + * Copyright 2002-2005 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -78,7 +78,7 @@ public void test2ArgsNoErrors() throws Exception { assertTrue("command name bound ok", person.getName().equals(name)); assertTrue("command age bound ok", person.getAge() == age); } - + public void test2Args1Mismatch() throws Exception { TestController mc = new TestController(); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/ok.html"); @@ -492,11 +492,11 @@ protected void initBinder(HttpServletRequest request, ServletRequestDataBinder b private static class TestController extends AbstractCommandController { - + private TestController() { super(TestBean.class, "person"); } - + protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) { Map m = new HashMap(); assertTrue("Command not null", command != null); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/ParameterizableViewControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/ParameterizableViewControllerTests.java index 9a8c94a6510d..6afd4b9b7bac 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/ParameterizableViewControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/ParameterizableViewControllerTests.java @@ -39,7 +39,7 @@ public class ParameterizableViewControllerTests { private ParameterizableViewController controller; private MockHttpServletRequest request; - + @Before public void setup() { this.controller = new ParameterizableViewController(); @@ -54,7 +54,7 @@ public void handleRequestWithViewName() throws Exception { assertEquals(viewName, mav.getViewName()); assertTrue(mav.getModel().isEmpty()); } - + @Test public void handleRequestWithoutViewName() throws Exception { ModelAndView mav = this.controller.handleRequest(this.request, new MockHttpServletResponse()); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WebContentInterceptorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WebContentInterceptorTests.java index 095276a6e793..fbbe451da9ab 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WebContentInterceptorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WebContentInterceptorTests.java @@ -19,21 +19,15 @@ import java.util.List; import java.util.Properties; -import junit.framework.TestCase; - -import org.springframework.mock.web.test.MockHttpServletRequest; -import org.springframework.mock.web.test.MockHttpServletResponse; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.web.servlet.support.WebContentGenerator; import org.junit.Before; import org.junit.Test; -import org.junit.Assert; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.*; -import static org.junit.Assert.*; -import static org.junit.Assert.*; -import static org.junit.Assert.*; /** * @author Rick Evans @@ -76,7 +70,7 @@ public void preHandleSetsCacheSecondsOnMatchingRequestWithCustomCacheMapping() t WebContentInterceptor interceptor = new WebContentInterceptor(); interceptor.setCacheSeconds(10); interceptor.setCacheMappings(mappings); - + request.setRequestURI("http://localhost:7070/example/adminhandle.vm"); interceptor.preHandle(request, response, null); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AdminController.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AdminController.java index 41ed4c6e8ef6..9050e2144016 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AdminController.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AdminController.java @@ -24,4 +24,4 @@ @Controller public class AdminController { -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/BuyForm.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/BuyForm.java index 8a7a6c602ab0..2ec6c6dd0dc7 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/BuyForm.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/BuyForm.java @@ -24,4 +24,4 @@ @Controller public class BuyForm { -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/CgLibProxyServletAnnotationTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/CgLibProxyServletAnnotationTests.java index 6735d3d0cf02..f719ec48ad46 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/CgLibProxyServletAnnotationTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/CgLibProxyServletAnnotationTests.java @@ -128,4 +128,4 @@ public void doIt(Writer writer) throws IOException { } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ControllerClassNameHandlerMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ControllerClassNameHandlerMappingTests.java index cbf9da30612c..3a439d8e44a6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ControllerClassNameHandlerMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ControllerClassNameHandlerMappingTests.java @@ -114,4 +114,4 @@ public void testWithRootAsBasePackage() throws Exception { assertEquals(this.wac.getBean("welcome"), chain.getHandler()); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/IndexController.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/IndexController.java index ebbfbdc33fe9..595142a93c54 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/IndexController.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/IndexController.java @@ -34,4 +34,4 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletRespons return new ModelAndView("indexView"); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/MethodNameDispatchingController.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/MethodNameDispatchingController.java index e8f97c1f2203..709d7422d5c6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/MethodNameDispatchingController.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/MethodNameDispatchingController.java @@ -51,4 +51,4 @@ public void mySurpriseHandle(HttpServletResponse response) throws IOException { response.getWriter().write("mySurpriseView"); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java index 236bd3666f3c..a6557004ee1a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java @@ -285,7 +285,7 @@ protected WebApplicationContext createWebApplicationContext(WebApplicationContex } }; servlet.init(new MockServletConfig()); - + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myApp/myPath.do"); request.setContextPath("/myApp"); MockHttpServletResponse response = new MockHttpServletResponse(); @@ -334,7 +334,7 @@ public void methodNotAllowed() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); servlet.service(request, response); assertEquals("Invalid response status", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getStatus()); - String allowHeader = (String) response.getHeader("Allow"); + String allowHeader = response.getHeader("Allow"); assertNotNull("No Allow header", allowHeader); Set allowedMethods = new HashSet(); allowedMethods.addAll(Arrays.asList(StringUtils.delimitedListToStringArray(allowHeader, ", "))); @@ -1705,7 +1705,7 @@ public void requestMappingBaseClass() throws Exception { assertEquals("handle", response.getContentAsString()); } - + @Test public void trailingSlash() throws Exception { initServlet(TrailingSlashController.class); @@ -2824,7 +2824,7 @@ public void handle(@RequestBody A a) throws IOException { @XmlRootElement public static class A { - + } @XmlRootElement @@ -3144,7 +3144,7 @@ public static class TrailingSlashController { public void root(Writer writer) throws IOException { writer.write("root"); } - + @RequestMapping(value = "/{templatePath}/", method = RequestMethod.GET) public void templatePath(Writer writer) throws IOException { writer.write("templatePath"); @@ -3256,10 +3256,10 @@ public void handle2(Writer writer) throws IOException { writer.write("handle2"); } } - + @Controller static class HeadersConditionController { - + @RequestMapping(value = "/", method = RequestMethod.GET) public String home() { return "home"; @@ -3279,5 +3279,5 @@ static class RedirectAttributesController { public void handle(RedirectAttributes redirectAttrs) { } } - + } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java index 9da4b087d344..9bff02242184 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java @@ -68,7 +68,7 @@ public void checkParametersKeyValueMatch() { boolean result = ServletAnnotationMappingUtils.checkParameters(params, request); assertTrue("Invalid request method result", result); } - + @Test public void checkParametersKeyValueNoMatch() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); @@ -77,7 +77,7 @@ public void checkParametersKeyValueNoMatch() { boolean result = ServletAnnotationMappingUtils.checkParameters(params, request); assertFalse("Invalid request method result", result); } - + @Test public void checkParametersNegatedValueMatch() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); @@ -86,7 +86,7 @@ public void checkParametersNegatedValueMatch() { boolean result = ServletAnnotationMappingUtils.checkParameters(params, request); assertTrue("Invalid request method result", result); } - + @Test public void checkParametersNegatedValueNoMatch() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); @@ -143,8 +143,8 @@ public void checkHeadersKeyValueNoMatch() { assertFalse("Invalid request method result", result); } - // SPR-8862 - + // SPR-8862 + @Test public void checkHeadersKeyValueNoMatchWithNegation() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java index 8abb0b2a72c9..b88c10fa9f77 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java @@ -44,7 +44,7 @@ public void test() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); adapter.handle(request, response, controller); } - + public class ColorConverter implements Converter { public Color convert(String source) { if (!source.startsWith("#")) source = "#" + source; return Color.decode(source); } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java index 54fec80ce94d..e7aa5e97bc55 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java @@ -69,7 +69,7 @@ public void list() throws Exception { request.addParameter("nested.list", "Nested1,Nested2"); adapter.handle(request, response, controller); } - + @Test public void listElement() throws Exception { request.setRequestURI("/nested/listElement"); @@ -124,14 +124,14 @@ public void arrayOfLists() throws Exception { @Test public void map() throws Exception { - request.setRequestURI("/nested/map"); + request.setRequestURI("/nested/map"); request.addParameter("nested.map['apple'].foo", "bar"); adapter.handle(request, response, controller); } @Test public void mapOfLists() throws Exception { - request.setRequestURI("/nested/mapOfLists"); + request.setRequestURI("/nested/mapOfLists"); request.addParameter("nested.mapOfLists['apples'][0]", "1"); adapter.handle(request, response, controller); } @@ -173,14 +173,14 @@ public void handlerArrayOfLists(JavaBean bean) { public void handlerMap(JavaBean bean) { assertEquals("bar", bean.nested.map.get("apple").foo); } - + @RequestMapping("/nested/mapOfLists") public void handlerMapOfLists(JavaBean bean) { assertEquals(new Integer(1), bean.nested.mapOfLists.get("apples").get(0)); } } - + public static class JavaBean { private NestedBean nested; @@ -193,7 +193,7 @@ public void setNested(NestedBean nested) { this.nested = nested; } - + } public static class NestedBean { @@ -209,15 +209,15 @@ public static class NestedBean { private Map map; private Map> mapOfLists; - + public NestedBean() { - + } - + public NestedBean(String foo) { this.foo = foo; } - + public String getFoo() { return foo; } @@ -265,7 +265,7 @@ public Map> getMapOfLists() { public void setMapOfLists(Map> mapOfLists) { this.mapOfLists = mapOfLists; } - + } - + } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/WelcomeController.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/WelcomeController.java index 25d532b54b51..5b1febae2945 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/WelcomeController.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/WelcomeController.java @@ -34,4 +34,4 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletRespons return new ModelAndView("welcomeView"); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/HeadersRequestConditionTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/HeadersRequestConditionTests.java index 10586067da9c..0d8642b9c5d8 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/HeadersRequestConditionTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/HeadersRequestConditionTests.java @@ -134,7 +134,7 @@ public void compareTo() { assertTrue("Invalid comparison result: " + result, result > 0); } - + @Test public void combine() { HeadersRequestCondition condition1 = new HeadersRequestCondition("foo=bar"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/ControllerBeanNameHandlerMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/ControllerBeanNameHandlerMappingTests.java index fce0eca69ae8..77c04aaaec62 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/ControllerBeanNameHandlerMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/ControllerBeanNameHandlerMappingTests.java @@ -75,4 +75,4 @@ public void testWithoutControllerSuffix() throws Exception { assertEquals(this.wac.getBean("buy"), chain.getHandler()); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMappingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMappingTests.java index e0764f7e7bce..13bd9e1f474a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMappingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMappingTests.java @@ -451,4 +451,4 @@ protected RequestMappingInfo getMappingForMethod(Method method, Class handler } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java index d9c881dc9ea8..2008769b4736 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java @@ -48,7 +48,7 @@ public class RequestMappingInfoTests { @Test public void createEmpty() { RequestMappingInfo info = new RequestMappingInfo(null, null, null, null, null, null, null); - + assertEquals(0, info.getPatternsCondition().getPatterns().size()); assertEquals(0, info.getMethodsCondition().getMethods().size()); assertEquals(true, info.getConsumesCondition().isEmpty()); @@ -57,7 +57,7 @@ public void createEmpty() { assertNotNull(info.getHeadersCondition()); assertNull(info.getCustomCondition()); } - + @Test public void matchPatternsCondition() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); @@ -66,14 +66,14 @@ public void matchPatternsCondition() { new PatternsRequestCondition("/foo*", "/bar"), null, null, null, null, null, null); RequestMappingInfo expected = new RequestMappingInfo( new PatternsRequestCondition("/foo*"), null, null, null, null, null, null); - + assertEquals(expected, info.getMatchingCondition(request)); info = new RequestMappingInfo( new PatternsRequestCondition("/**", "/foo*", "/foo"), null, null, null, null, null, null); expected = new RequestMappingInfo( new PatternsRequestCondition("/foo", "/foo*", "/**"), null, null, null, null, null, null); - + assertEquals(expected, info.getMatchingCondition(request)); } @@ -84,14 +84,14 @@ public void matchParamsCondition() { RequestMappingInfo info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, + new PatternsRequestCondition("/foo"), null, new ParamsRequestCondition("foo=bar"), null, null, null, null); RequestMappingInfo match = info.getMatchingCondition(request); assertNotNull(match); info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, + new PatternsRequestCondition("/foo"), null, new ParamsRequestCondition("foo!=bar"), null, null, null, null); match = info.getMatchingCondition(request); @@ -105,14 +105,14 @@ public void matchHeadersCondition() { RequestMappingInfo info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, null, + new PatternsRequestCondition("/foo"), null, null, new HeadersRequestCondition("foo=bar"), null, null, null); RequestMappingInfo match = info.getMatchingCondition(request); assertNotNull(match); info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, null, + new PatternsRequestCondition("/foo"), null, null, new HeadersRequestCondition("foo!=bar"), null, null, null); match = info.getMatchingCondition(request); @@ -124,7 +124,7 @@ public void matchConsumesCondition() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); request.setContentType("text/plain"); - RequestMappingInfo info = + RequestMappingInfo info = new RequestMappingInfo( new PatternsRequestCondition("/foo"), null, null, null, new ConsumesRequestCondition("text/plain"), null, null); @@ -145,9 +145,9 @@ public void matchProducesCondition() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo"); request.addHeader("Accept", "text/plain"); - RequestMappingInfo info = + RequestMappingInfo info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, null, null, null, + new PatternsRequestCondition("/foo"), null, null, null, null, new ProducesRequestCondition("text/plain"), null); RequestMappingInfo match = info.getMatchingCondition(request); @@ -168,38 +168,38 @@ public void matchCustomCondition() { RequestMappingInfo info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, null, null, null, null, + new PatternsRequestCondition("/foo"), null, null, null, null, null, new ParamsRequestCondition("foo=bar")); RequestMappingInfo match = info.getMatchingCondition(request); assertNotNull(match); info = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), null, - new ParamsRequestCondition("foo!=bar"), null, null, null, + new PatternsRequestCondition("/foo"), null, + new ParamsRequestCondition("foo!=bar"), null, null, null, new ParamsRequestCondition("foo!=bar")); match = info.getMatchingCondition(request); assertNull(match); - } - + } + @Test public void compareTwoHttpMethodsOneParam() { RequestMappingInfo none = new RequestMappingInfo(null, null, null, null, null, null, null); - RequestMappingInfo oneMethod = - new RequestMappingInfo(null, + RequestMappingInfo oneMethod = + new RequestMappingInfo(null, new RequestMethodsRequestCondition(RequestMethod.GET), null, null, null, null, null); RequestMappingInfo oneMethodOneParam = - new RequestMappingInfo(null, - new RequestMethodsRequestCondition(RequestMethod.GET), + new RequestMappingInfo(null, + new RequestMethodsRequestCondition(RequestMethod.GET), new ParamsRequestCondition("foo"), null, null, null, null); - + Comparator comparator = new Comparator() { public int compare(RequestMappingInfo info, RequestMappingInfo otherInfo) { return info.compareTo(otherInfo, new MockHttpServletRequest()); } }; - + List list = asList(none, oneMethod, oneMethodOneParam); Collections.shuffle(list); Collections.sort(list, comparator); @@ -211,22 +211,22 @@ public int compare(RequestMappingInfo info, RequestMappingInfo otherInfo) { @Test public void equals() { - + RequestMappingInfo info1 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); RequestMappingInfo info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); @@ -234,88 +234,88 @@ public void equals() { assertEquals(info1.hashCode(), info2.hashCode()); info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo", "/NOOOOOO"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo", "/NOOOOOO"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); info2 = new RequestMappingInfo( new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET, RequestMethod.POST), - new ParamsRequestCondition("foo=bar"), + new RequestMethodsRequestCondition(RequestMethod.GET, RequestMethod.POST), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("/NOOOOOO"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("/NOOOOOO"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("/NOOOOOO"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); - + info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/NOOOOOO"), + new ConsumesRequestCondition("text/NOOOOOO"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=customBar")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/NOOOOOO"), new ParamsRequestCondition("customFoo=customBar")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); info2 = new RequestMappingInfo( - new PatternsRequestCondition("/foo"), - new RequestMethodsRequestCondition(RequestMethod.GET), - new ParamsRequestCondition("foo=bar"), + new PatternsRequestCondition("/foo"), + new RequestMethodsRequestCondition(RequestMethod.GET), + new ParamsRequestCondition("foo=bar"), new HeadersRequestCondition("foo=bar"), - new ConsumesRequestCondition("text/plain"), + new ConsumesRequestCondition("text/plain"), new ProducesRequestCondition("text/plain"), new ParamsRequestCondition("customFoo=NOOOOOO")); - + assertFalse(info1.equals(info2)); assertTrue(info1.hashCode() != info2.hashCode()); } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java index b97f1c034aac..d96877391d6e 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java @@ -81,9 +81,7 @@ protected WebApplicationContext createWebApplicationContext(WebApplicationContex } Class mappingType = RequestMappingHandlerMapping.class; - RootBeanDefinition beanDef = new RootBeanDefinition(mappingType); - beanDef.getPropertyValues().add("removeSemicolonContent", "false"); - wac.registerBeanDefinition("handlerMapping", beanDef); + wac.registerBeanDefinition("handlerMapping", new RootBeanDefinition(mappingType)); Class adapterType = RequestMappingHandlerAdapter.class; wac.registerBeanDefinition("handlerAdapter", new RootBeanDefinition(adapterType)); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java index 4c93cac51fce..26125fa093a4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java @@ -174,36 +174,6 @@ public void resolveExceptionResponseWriter() throws Exception { assertEquals("IllegalArgumentException", this.response.getContentAsString()); } - @Test - public void resolveExceptionGlobalHandler() throws Exception { - AnnotationConfigApplicationContext cxt = new AnnotationConfigApplicationContext(MyConfig.class); - this.resolver.setApplicationContext(cxt); - this.resolver.afterPropertiesSet(); - - IllegalAccessException ex = new IllegalAccessException(); - HandlerMethod handlerMethod = new HandlerMethod(new ResponseBodyController(), "handle"); - ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, ex); - - assertNotNull("Exception was not handled", mav); - assertTrue(mav.isEmpty()); - assertEquals("AnotherTestExceptionResolver: IllegalAccessException", this.response.getContentAsString()); - } - - @Test - public void resolveExceptionGlobalHandlerOrdered() throws Exception { - AnnotationConfigApplicationContext cxt = new AnnotationConfigApplicationContext(MyConfig.class); - this.resolver.setApplicationContext(cxt); - this.resolver.afterPropertiesSet(); - - IllegalStateException ex = new IllegalStateException(); - HandlerMethod handlerMethod = new HandlerMethod(new ResponseBodyController(), "handle"); - ModelAndView mav = this.resolver.resolveException(this.request, this.response, handlerMethod, ex); - - assertNotNull("Exception was not handled", mav); - assertTrue(mav.isEmpty()); - assertEquals("TestExceptionResolver: IllegalStateException", this.response.getContentAsString()); - } - private void assertMethodProcessorCount(int resolverCount, int handlerCount) { assertEquals(resolverCount, this.resolver.getArgumentResolvers().getResolvers().size()); @@ -254,38 +224,4 @@ public void handleException() { } } - @ControllerAdvice - @Order(1) - static class TestExceptionResolver { - - @ExceptionHandler - @ResponseBody - public String handleException(IllegalStateException ex) { - return "TestExceptionResolver: " + ClassUtils.getShortName(ex.getClass()); - } - } - - @ControllerAdvice - @Order(2) - static class AnotherTestExceptionResolver { - - @ExceptionHandler({IllegalStateException.class, IllegalAccessException.class}) - @ResponseBody - public String handleException(Exception ex) { - return "AnotherTestExceptionResolver: " + ClassUtils.getShortName(ex.getClass()); - } - } - - @Configuration - static class MyConfig { - - @Bean public TestExceptionResolver testExceptionResolver() { - return new TestExceptionResolver(); - } - - @Bean public AnotherTestExceptionResolver anotherTestExceptionResolver() { - return new AnotherTestExceptionResolver(); - } - } - -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorTests.java index 467fff6dcfac..8a35cf5854b8 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorTests.java @@ -186,4 +186,5 @@ public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, St } } -} \ No newline at end of file + +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java index 4d4ac5692865..b4598c4a3347 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java @@ -41,7 +41,7 @@ /** * Test fixture with {@link ModelAndViewResolverMethodReturnValueHandler}. - * + * * @author Rossen Stoyanchev */ public class ModelAndViewResolverMethodReturnValueHandlerTests { @@ -69,7 +69,7 @@ public void modelAndViewResolver() throws Exception { TestBean testBean = new TestBean("name"); handler.handleReturnValue(testBean, returnType, mavContainer, request); - + assertEquals("viewName", mavContainer.getViewName()); assertSame(testBean, mavContainer.getModel().get("modelAttrName")); assertFalse(mavContainer.isRequestHandled()); @@ -86,12 +86,12 @@ public void modelAndViewResolverUnresolved() throws Exception { public void handleNull() throws Exception { MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1); handler.handleReturnValue(null, returnType, mavContainer, request); - + assertNull(mavContainer.getView()); assertNull(mavContainer.getViewName()); assertTrue(mavContainer.getModel().isEmpty()); } - + @Test(expected=UnsupportedOperationException.class) public void handleSimpleType() throws Exception { MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("intReturnValue"), -1); @@ -102,7 +102,7 @@ public void handleSimpleType() throws Exception { public void handleNonSimpleType() throws Exception{ MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1); handler.handleReturnValue(new TestBean(), returnType, mavContainer, request); - + assertTrue(mavContainer.containsAttribute("testBean")); } @@ -115,11 +115,11 @@ private int intReturnValue() { private TestBean testBeanReturnValue() { return null; } - + private static class TestModelAndViewResolver implements ModelAndViewResolver { - + private Class returnValueType; - + public TestModelAndViewResolver(Class returnValueType) { this.returnValueType = returnValueType; } @@ -135,4 +135,4 @@ public ModelAndView resolveModelAndView(Method method, Class handlerType, Object } } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolverTests.java index f991d2859c80..3a353f9f85bd 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMapMethodArgumentResolverTests.java @@ -105,4 +105,4 @@ public void handle( Map mapWithoutAnnotat) { } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolverTests.java index 8c9cfaec552d..6b23183499b5 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolverTests.java @@ -41,21 +41,21 @@ /** * Test fixture with {@link PathVariableMethodArgumentResolver}. - * + * * @author Rossen Stoyanchev */ public class PathVariableMethodArgumentResolverTests { private PathVariableMethodArgumentResolver resolver; - + private MethodParameter paramNamedString; private MethodParameter paramString; private ModelAndViewContainer mavContainer; - + private ServletWebRequest webRequest; - + private MockHttpServletRequest request; @Before @@ -70,7 +70,7 @@ public void setUp() throws Exception { request = new MockHttpServletRequest(); webRequest = new ServletWebRequest(request, new MockHttpServletResponse()); } - + @Test public void supportsParameter() { assertTrue("Parameter with @PathVariable annotation", resolver.supportsParameter(paramNamedString)); @@ -85,14 +85,14 @@ public void resolveArgument() throws Exception { String result = (String) resolver.resolveArgument(paramNamedString, mavContainer, webRequest, null); assertEquals("PathVariable not resolved correctly", "value", result); - + @SuppressWarnings("unchecked") Map pathVars = (Map) request.getAttribute(View.PATH_VARIABLES); assertNotNull(pathVars); assertEquals(1, pathVars.size()); assertEquals("value", pathVars.get("name")); } - + @SuppressWarnings("unchecked") @Test public void resolveArgumentWithExistingPathVars() throws Exception { @@ -106,21 +106,21 @@ public void resolveArgumentWithExistingPathVars() throws Exception { String result = (String) resolver.resolveArgument(paramNamedString, mavContainer, webRequest, null); assertEquals("PathVariable not resolved correctly", "value", result); - + pathVars = (Map) request.getAttribute(View.PATH_VARIABLES); assertNotNull(pathVars); assertEquals(2, pathVars.size()); assertEquals("value", pathVars.get("name")); assertEquals("oldValue", pathVars.get("oldName")); } - + @Test(expected = ServletRequestBindingException.class) public void handleMissingValue() throws Exception { resolver.resolveArgument(paramNamedString, mavContainer, webRequest, null); fail("Unresolved path variable should lead to exception."); } - + public void handle(@PathVariable(value = "name") String param1, String param2) { } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java index e86b96b3732d..e112420bf102 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java @@ -276,18 +276,6 @@ public void handleRequestPart() throws Exception { assertEquals("content", mav.getModelMap().get("requestPart")); } - @Test - public void handleAndValidateRequestPart() throws Exception { - MockMultipartHttpServletRequest multipartRequest = new MockMultipartHttpServletRequest(); - multipartRequest.addFile(new MockMultipartFile("requestPart", "", "text/plain", "content".getBytes("UTF-8"))); - - HandlerMethod handlerMethod = handlerMethod("handleAndValidateRequestPart", String.class, Errors.class, Model.class); - ModelAndView mav = handlerAdapter.handle(multipartRequest, response, handlerMethod); - - assertNotNull(mav); - assertEquals(1, mav.getModelMap().get("error count")); - } - @Test public void handleAndCompleteSession() throws Exception { HandlerMethod handlerMethod = handlerMethod("handleAndCompleteSession", SessionStatus.class); @@ -382,12 +370,6 @@ public void handleRequestPart(@RequestPart String requestPart, Model model) { model.addAttribute("requestPart", requestPart); } - public void handleAndValidateRequestPart(@RequestPart @Valid String requestPart, - Errors errors, Model model) throws Exception { - - model.addAttribute("error count", errors.getErrorCount()); - } - public void handleAndCompleteSession(SessionStatus sessionStatus) { sessionStatus.setComplete(); } @@ -421,4 +403,4 @@ public String getName() { } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java index 2e4c7fb7fbea..1068b69bad96 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java @@ -190,6 +190,8 @@ private HandlerMethod handlerMethod(Object handler, String methodName, Class. return new InvocableHandlerMethod(handler, method); } + + private void assertMethodProcessorCount(int resolverCount, int initBinderResolverCount, int handlerCount) { assertEquals(resolverCount, this.handlerAdapter.getArgumentResolvers().getResolvers().size()); assertEquals(initBinderResolverCount, this.handlerAdapter.getInitBinderArgumentResolvers().getResolvers().size()); @@ -222,13 +224,4 @@ public String handle(Model model) { } } - @ControllerAdvice - private static class ModelAttributeAdvice { - - @ModelAttribute - public void addAttributes(Model model) { - model.addAttribute("globalAttr", "globalAttrValue"); - } - } - -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java index 7f18922e49ab..813c7819a9fe 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolverTests.java @@ -68,7 +68,7 @@ /** * Test fixture with {@link RequestPartMethodArgumentResolver} and mock {@link HttpMessageConverter}. - * + * * @author Rossen Stoyanchev */ public class RequestPartMethodArgumentResolverTests { @@ -76,7 +76,7 @@ public class RequestPartMethodArgumentResolverTests { private RequestPartMethodArgumentResolver resolver; private HttpMessageConverter messageConverter; - + private MultipartFile multipartFile1; private MultipartFile multipartFile2; @@ -99,10 +99,10 @@ public class RequestPartMethodArgumentResolverTests { @SuppressWarnings("unchecked") @Before public void setUp() throws Exception { - + Method method = getClass().getMethod("handle", SimpleBean.class, SimpleBean.class, SimpleBean.class, MultipartFile.class, List.class, Integer.TYPE, MultipartFile.class, Part.class, MultipartFile.class); - + paramRequestPart = new MethodParameter(method, 0); paramRequestPart.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer()); paramNamedRequestPart = new MethodParameter(method, 1); @@ -122,7 +122,7 @@ public void setUp() throws Exception { resolver = new RequestPartMethodArgumentResolver(Collections.>singletonList(messageConverter)); reset(messageConverter); - + multipartFile1 = new MockMultipartFile("requestPart", "", "text/plain", (byte[]) null); multipartFile2 = new MockMultipartFile("requestPart", "", "text/plain", (byte[]) null); multipartRequest = new MockMultipartHttpServletRequest(); @@ -139,16 +139,16 @@ public void supportsParameter() { assertTrue("Part parameter not supported", resolver.supportsParameter(paramServlet30Part)); assertFalse("non-RequestPart parameter supported", resolver.supportsParameter(paramInt)); assertFalse("@RequestParam args not supported", resolver.supportsParameter(paramRequestParamAnnot)); - } + } - @Test + @Test public void resolveMultipartFile() throws Exception { Object actual = resolver.resolveArgument(paramMultipartFile, null, webRequest, null); assertNotNull(actual); assertSame(multipartFile1, actual); } - @Test + @Test public void resolveMultipartFileList() throws Exception { Object actual = resolver.resolveArgument(paramMultipartFileList, null, webRequest, null); assertNotNull(actual); @@ -193,7 +193,7 @@ public void resolveRequestPart() throws Exception { public void resolveNamedRequestPart() throws Exception { testResolveArgument(new SimpleBean("foo"), paramNamedRequestPart); } - + @Test public void resolveRequestPartNotValid() throws Exception { try { @@ -205,12 +205,12 @@ public void resolveRequestPartNotValid() throws Exception { assertNotNull(e.getBindingResult().getFieldError("name")); } } - + @Test public void resolveRequestPartValid() throws Exception { testResolveArgument(new SimpleBean("foo"), paramNamedRequestPart); } - + @Test public void resolveRequestPartRequired() throws Exception { try { @@ -225,7 +225,7 @@ public void resolveRequestPartRequired() throws Exception { public void resolveRequestPartNotRequired() throws Exception { testResolveArgument(new SimpleBean("foo"), paramValidRequestPart); } - + @Test(expected=MultipartException.class) public void isMultipartRequest() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); @@ -255,9 +255,9 @@ private void testResolveArgument(SimpleBean argValue, MethodParameter parameter) assertEquals("Invalid argument value", argValue, actualValue); assertFalse("The requestHandled flag shouldn't change", mavContainer.isRequestHandled()); - + verify(messageConverter); - } + } private static class SimpleBean { @@ -273,7 +273,7 @@ public String getName() { return name; } } - + private final class ValidatingBinderFactory implements WebDataBinderFactory { public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception { LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); @@ -284,9 +284,9 @@ public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, St } } - public void handle(@RequestPart SimpleBean requestPart, - @RequestPart(value="requestPart", required=false) SimpleBean namedRequestPart, - @Valid @RequestPart("requestPart") SimpleBean validRequestPart, + public void handle(@RequestPart SimpleBean requestPart, + @RequestPart(value="requestPart", required=false) SimpleBean namedRequestPart, + @Valid @RequestPart("requestPart") SimpleBean validRequestPart, @RequestPart("requestPart") MultipartFile multipartFile, @RequestPart("requestPart") List multipartFileList, int i, diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java index 4e99948e4f22..2856f873ce5f 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessorTests.java @@ -287,4 +287,4 @@ public WebDataBinder createBinder(NativeWebRequest webRequest, Object target, St } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java index d0b6e815ecba..21ef1b195920 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/SerlvetModelAttributeMethodProcessorTests.java @@ -40,7 +40,7 @@ /** * Test fixture for {@link ServletModelAttributeMethodProcessor} specific tests. * Also see org.springframework.web.method.annotation.support.ModelAttributeMethodProcessorTests - * + * * @author Rossen Stoyanchev */ public class SerlvetModelAttributeMethodProcessorTests { @@ -48,7 +48,7 @@ public class SerlvetModelAttributeMethodProcessorTests { private ServletModelAttributeMethodProcessor processor; private MethodParameter testBeanModelAttr; - + private MethodParameter testBeanWithoutStringConstructorModelAttr; private ModelAndViewContainer mavContainer; @@ -63,18 +63,18 @@ public class SerlvetModelAttributeMethodProcessorTests { public void setUp() throws Exception { this.processor = new ServletModelAttributeMethodProcessor(false); - Method method = getClass().getDeclaredMethod("modelAttribute", + Method method = getClass().getDeclaredMethod("modelAttribute", TestBean.class, TestBeanWithoutStringConstructor.class); - + this.testBeanModelAttr = new MethodParameter(method, 0); this.testBeanWithoutStringConstructorModelAttr = new MethodParameter(method, 1); - + ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer(); initializer.setConversionService(new DefaultConversionService()); - + this.binderFactory = new ServletRequestDataBinderFactory(null, initializer ); this.mavContainer = new ModelAndViewContainer(); - + this.request = new MockHttpServletRequest(); this.webRequest = new ServletWebRequest(request); } @@ -87,10 +87,10 @@ public void createAttributeUriTemplateVar() throws Exception { // Type conversion from "Patty" to TestBean via TestBean(String) constructor - TestBean testBean = + TestBean testBean = (TestBean) this.processor.resolveArgument( this.testBeanModelAttr, this.mavContainer, this.webRequest, this.binderFactory); - + assertEquals("Patty", testBean.getName()); } @@ -100,10 +100,10 @@ public void createAttributeUriTemplateVarCannotConvert() throws Exception { uriTemplateVars.put("testBean2", "Patty"); request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars); - TestBeanWithoutStringConstructor testBean = + TestBeanWithoutStringConstructor testBean = (TestBeanWithoutStringConstructor) this.processor.resolveArgument( this.testBeanWithoutStringConstructorModelAttr, this.mavContainer, this.webRequest, this.binderFactory); - + assertNotNull(testBean); } @@ -113,10 +113,10 @@ public void createAttributeRequestParameter() throws Exception { // Type conversion from "Patty" to TestBean via TestBean(String) constructor - TestBean testBean = + TestBean testBean = (TestBean) this.processor.resolveArgument( this.testBeanModelAttr, this.mavContainer, this.webRequest, this.binderFactory); - + assertEquals("Patty", testBean.getName()); } @@ -124,17 +124,17 @@ public void createAttributeRequestParameter() throws Exception { public void createAttributeRequestParameterCannotConvert() throws Exception { this.request.addParameter("testBean1", "Patty"); - TestBeanWithoutStringConstructor testBean = + TestBeanWithoutStringConstructor testBean = (TestBeanWithoutStringConstructor) this.processor.resolveArgument( this.testBeanWithoutStringConstructorModelAttr, this.mavContainer, this.webRequest, this.binderFactory); - + assertNotNull(testBean); } - + @SuppressWarnings("unused") - private void modelAttribute(@ModelAttribute("testBean1") TestBean testBean1, - @ModelAttribute("testBean2") TestBeanWithoutStringConstructor testBean2) { + private void modelAttribute(@ModelAttribute("testBean1") TestBean testBean1, + @ModelAttribute("testBean2") TestBeanWithoutStringConstructor testBean2) { } @@ -143,10 +143,10 @@ private static class TestBeanWithoutStringConstructor { public TestBeanWithoutStringConstructor() { } - + public TestBeanWithoutStringConstructor(int i) { } - + } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java index ccc2028efa3d..d1872128cbe6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java @@ -292,7 +292,7 @@ public void methodNotAllowed() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); getServlet().service(request, response); assertEquals("Invalid response status", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getStatus()); - String allowHeader = (String) response.getHeader("Allow"); + String allowHeader = response.getHeader("Allow"); assertNotNull("No Allow header", allowHeader); Set allowedMethods = new HashSet(); allowedMethods.addAll(Arrays.asList(StringUtils.delimitedListToStringArray(allowHeader, ", "))); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolverTests.java index 7590c2ceb605..5bdb2d73805a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletCookieValueMethodArgumentResolverTests.java @@ -33,7 +33,7 @@ /** * Test fixture with {@link ServletCookieValueMethodArgumentResolver}. - * + * * @author Arjen Poutsma * @author Rossen Stoyanchev */ @@ -52,7 +52,7 @@ public class ServletCookieValueMethodArgumentResolverTests { @Before public void setUp() throws Exception { resolver = new ServletCookieValueMethodArgumentResolver(null); - + Method method = getClass().getMethod("params", Cookie.class, String.class); cookieParameter = new MethodParameter(method, 0); cookieStringParameter = new MethodParameter(method, 1); @@ -83,4 +83,4 @@ public void params(@CookieValue("name") Cookie cookie, @CookieValue(value = "name", defaultValue = "bar") String cookieString) { } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletInvocableHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletInvocableHandlerMethodTests.java index 50d30583af15..49f370603219 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletInvocableHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletInvocableHandlerMethodTests.java @@ -195,4 +195,4 @@ public void handleReturnValue(Object returnValue, MethodParameter returnType, } } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolverTests.java index ba68354ee753..a3832805cbca 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletRequestMethodArgumentResolverTests.java @@ -41,7 +41,7 @@ /** * Test fixture with {@link ServletRequestMethodArgumentResolver}. - * + * * @author Arjen Poutsma * @author Rossen Stoyanchev */ @@ -52,7 +52,7 @@ public class ServletRequestMethodArgumentResolverTests { private Method method; private ModelAndViewContainer mavContainer; - + private ServletWebRequest webRequest; private MockHttpServletRequest servletRequest; @@ -69,10 +69,10 @@ public void setUp() throws Exception { @Test public void servletRequest() throws Exception { MethodParameter servletRequestParameter = new MethodParameter(method, 0); - + boolean isSupported = resolver.supportsParameter(servletRequestParameter); Object result = resolver.resolveArgument(servletRequestParameter, mavContainer, webRequest, null); - + assertTrue("ServletRequest not supported", isSupported); assertSame("Invalid result", servletRequest, result); assertFalse("The requestHandled flag shouldn't change", mavContainer.isRequestHandled()); @@ -160,4 +160,4 @@ public void supportedParams(ServletRequest p0, WebRequest p7) { } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolverTests.java index e7b7acb168ea..fbef83c29daa 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletResponseMethodArgumentResolverTests.java @@ -35,7 +35,7 @@ /** * Test fixture with {@link org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver}. - * + * * @author Arjen Poutsma */ public class ServletResponseMethodArgumentResolverTests { @@ -105,4 +105,4 @@ public void writer() throws Exception { public void supportedParams(ServletResponse p0, OutputStream p1, Writer p2) { } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolverTests.java index 5c8054c319b3..4586ec5b4f74 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/UriComponentsBuilderMethodArgumentResolverTests.java @@ -35,7 +35,7 @@ /** * Test fixture with {@link UriComponentsBuilderMethodArgumentResolver}. - * + * * @author Rossen Stoyanchev */ public class UriComponentsBuilderMethodArgumentResolverTests { @@ -45,7 +45,7 @@ public class UriComponentsBuilderMethodArgumentResolverTests { private MethodParameter builderParam; private MethodParameter servletBuilderParam; - + private MethodParameter intParam; private ServletWebRequest webRequest; @@ -62,22 +62,22 @@ public void setUp() throws Exception { this.servletRequest = new MockHttpServletRequest(); this.webRequest = new ServletWebRequest(this.servletRequest); } - + @Test public void supportsParameter() throws Exception { assertTrue(this.resolver.supportsParameter(this.builderParam)); assertTrue(this.resolver.supportsParameter(this.servletBuilderParam)); assertFalse(this.resolver.supportsParameter(this.intParam)); } - + @Test public void resolveArgument() throws Exception { this.servletRequest.setContextPath("/myapp"); this.servletRequest.setServletPath("/main"); this.servletRequest.setPathInfo("/accounts"); - + Object actual = this.resolver.resolveArgument(this.builderParam, new ModelAndViewContainer(), this.webRequest, null); - + assertNotNull(actual); assertEquals(ServletUriComponentsBuilder.class, actual.getClass()); assertEquals("http://localhost/myapp/main", ((ServletUriComponentsBuilder) actual).build().toUriString()); @@ -86,5 +86,5 @@ public void resolveArgument() throws Exception { void handle(UriComponentsBuilder builder, ServletUriComponentsBuilder servletBuilder, int value) { } - -} \ No newline at end of file + +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandlerTests.java index 1f2b04df2928..d1600a8bd555 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandlerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandlerTests.java @@ -36,7 +36,7 @@ /** * Test fixture with {@link ViewMethodReturnValueHandler}. - * + * * @author Rossen Stoyanchev */ public class ViewMethodReturnValueHandlerTests { @@ -53,7 +53,7 @@ public void setUp() { this.mavContainer = new ModelAndViewContainer(); this.webRequest = new ServletWebRequest(new MockHttpServletRequest()); } - + @Test public void supportsReturnType() throws Exception { assertTrue(this.handler.supportsReturnType(createReturnValueParam("view"))); @@ -63,7 +63,7 @@ public void supportsReturnType() throws Exception { public void returnView() throws Exception { InternalResourceView view = new InternalResourceView("testView"); this.handler.handleReturnValue(view, createReturnValueParam("view"), this.mavContainer, this.webRequest); - + assertSame(view, this.mavContainer.getView()); } @@ -74,7 +74,7 @@ public void returnViewRedirect() throws Exception { this.mavContainer.setRedirectModel(redirectModel); MethodParameter param = createReturnValueParam("view"); this.handler.handleReturnValue(redirectView, param, this.mavContainer, this.webRequest); - + assertSame(redirectView, this.mavContainer.getView()); assertSame("Should have switched to the RedirectModel", redirectModel, this.mavContainer.getModel()); } @@ -83,9 +83,9 @@ private MethodParameter createReturnValueParam(String methodName) throws Excepti Method method = getClass().getDeclaredMethod(methodName); return new MethodParameter(method, -1); } - + View view() { return null; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandlerTests.java index 50f41b337b4e..3234682be41a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandlerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandlerTests.java @@ -34,7 +34,7 @@ /** * Test fixture with {@link ViewNameMethodReturnValueHandler}. - * + * * @author Rossen Stoyanchev */ public class ViewNameMethodReturnValueHandlerTests { @@ -51,17 +51,17 @@ public void setUp() { this.mavContainer = new ModelAndViewContainer(); this.webRequest = new ServletWebRequest(new MockHttpServletRequest()); } - + @Test public void supportsReturnType() throws Exception { assertTrue(this.handler.supportsReturnType(createReturnValueParam("viewName"))); } - + @Test public void returnViewName() throws Exception { MethodParameter param = createReturnValueParam("viewName"); this.handler.handleReturnValue("testView", param, this.mavContainer, this.webRequest); - + assertEquals("testView", this.mavContainer.getViewName()); } @@ -80,9 +80,9 @@ private MethodParameter createReturnValueParam(String methodName) throws Excepti Method method = getClass().getDeclaredMethod(methodName); return new MethodParameter(method, -1); } - + String viewName() { return null; } - -} \ No newline at end of file + +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java index 6662b3acb9fe..e229bac169a9 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/support/RedirectAttributesModelMapTests.java @@ -31,7 +31,7 @@ import org.springframework.validation.DataBinder; /** - * + * * Test fixture for {@link RedirectAttributesModelMap} tests. * * @author Rossen Stoyanchev @@ -40,7 +40,7 @@ public class RedirectAttributesModelMapTests { private RedirectAttributesModelMap redirectAttributes; - + private FormattingConversionService conversionService; @Before @@ -48,10 +48,10 @@ public void setup() { this.conversionService = new DefaultFormattingConversionService(); DataBinder dataBinder = new DataBinder(null); dataBinder.setConversionService(conversionService); - + this.redirectAttributes = new RedirectAttributesModelMap(dataBinder); } - + @Test public void addAttributePrimitiveType() { this.redirectAttributes.addAttribute("speed", 65); @@ -62,12 +62,12 @@ public void addAttributePrimitiveType() { public void addAttributeCustomType() { String attrName = "person"; this.redirectAttributes.addAttribute(attrName, new TestBean("Fred")); - + assertEquals("ConversionService should have invoked toString()", "Fred", this.redirectAttributes.get(attrName)); this.conversionService.addConverter(new TestBeanConverter()); this.redirectAttributes.addAttribute(attrName, new TestBean("Fred")); - + assertEquals("Type converter should have been used", "[Fred]", this.redirectAttributes.get(attrName)); } @@ -83,14 +83,14 @@ public void addAttributeToString() { @Test public void addAttributeValue() { this.redirectAttributes.addAttribute(new TestBean("Fred")); - + assertEquals("Fred", this.redirectAttributes.get("testBean")); } @Test public void addAllAttributesList() { this.redirectAttributes.addAllAttributes(Arrays.asList(new TestBean("Fred"), new Integer(5))); - + assertEquals("Fred", this.redirectAttributes.get("testBean")); assertEquals("5", this.redirectAttributes.get("integer")); } @@ -101,7 +101,7 @@ public void addAttributesMap() { map.put("person", new TestBean("Fred")); map.put("age", 33); this.redirectAttributes.addAllAttributes(map); - + assertEquals("Fred", this.redirectAttributes.get("person")); assertEquals("33", this.redirectAttributes.get("age")); } @@ -111,18 +111,18 @@ public void mergeAttributes() { Map map = new HashMap(); map.put("person", new TestBean("Fred")); map.put("age", 33); - + this.redirectAttributes.addAttribute("person", new TestBean("Ralph")); this.redirectAttributes.mergeAttributes(map); - + assertEquals("Ralph", this.redirectAttributes.get("person")); assertEquals("33", this.redirectAttributes.get("age")); } - + @Test public void put() { this.redirectAttributes.put("testBean", new TestBean("Fred")); - + assertEquals("Fred", this.redirectAttributes.get("testBean")); } @@ -132,16 +132,16 @@ public void putAll() { map.put("person", new TestBean("Fred")); map.put("age", 33); this.redirectAttributes.putAll(map); - + assertEquals("Fred", this.redirectAttributes.get("person")); assertEquals("33", this.redirectAttributes.get("age")); } - + public static class TestBeanConverter implements Converter { - + public String convert(TestBean source) { return "[" + source.getName() + "]"; } - } - + } + } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestContextTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestContextTests.java index c568339b0c6e..ecde8326f686 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestContextTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestContextTests.java @@ -67,7 +67,7 @@ public void testGetContextUrlWithMap() throws Exception { map.put("spam", "bucket"); assertEquals("foo/bar?spam=bucket", context.getContextUrl("{foo}?spam={spam}", map)); } - + @Test public void testGetContextUrlWithMapEscaping() throws Exception { request.setContextPath("foo/"); @@ -83,12 +83,12 @@ public void testPathToServlet() throws Exception { request.setContextPath("/app"); request.setServletPath("/servlet"); RequestContext context = new RequestContext(request, response, servletContext, model); - + assertEquals("/app/servlet", context.getPathToServlet()); request.setAttribute(WebUtils.FORWARD_CONTEXT_PATH_ATTRIBUTE, "/origApp"); request.setAttribute(WebUtils.FORWARD_SERVLET_PATH_ATTRIBUTE, "/origServlet"); - + assertEquals("/origApp/origServlet", context.getPathToServlet()); } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestDataValueProcessorWrapper.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestDataValueProcessorWrapper.java index d26f18d1205b..b0a7495e9ae4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestDataValueProcessorWrapper.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/support/RequestDataValueProcessorWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ public class RequestDataValueProcessorWrapper implements RequestDataValueProcessor { private RequestDataValueProcessor processor; - + public void setRequestDataValueProcessor(RequestDataValueProcessor processor) { this.processor = processor; } @@ -46,4 +46,4 @@ public Map getExtraHiddenFields(HttpServletRequest request) { return (this.processor != null) ? this.processor.getExtraHiddenFields(request) : null; } -} \ No newline at end of file +} diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/support/ServletUriComponentsBuilderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/support/ServletUriComponentsBuilderTests.java index 50304a348b2a..d87212008c96 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/support/ServletUriComponentsBuilderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/support/ServletUriComponentsBuilderTests.java @@ -39,7 +39,7 @@ public void setup() { this.request.setServerPort(80); this.request.setContextPath("/mvc-showcase"); } - + @Test public void fromRequest() { request.setRequestURI("/mvc-showcase/data/param"); @@ -61,16 +61,16 @@ public void fromRequestEncodedPath() { public void fromRequestAtypicalHttpPort() { request.setServerPort(8080); String result = ServletUriComponentsBuilder.fromRequest(request).build().toUriString(); - + assertEquals("http://localhost:8080", result); } - + @Test public void fromRequestAtypicalHttpsPort() { request.setScheme("https"); request.setServerPort(9043); String result = ServletUriComponentsBuilder.fromRequest(request).build().toUriString(); - + assertEquals("https://localhost:9043", result); } @@ -88,9 +88,9 @@ public void fromContextPath() { request.setRequestURI("/mvc-showcase/data/param"); request.setQueryString("foo=123"); String result = ServletUriComponentsBuilder.fromContextPath(request).build().toUriString(); - + assertEquals("http://localhost/mvc-showcase", result); - } + } @Test public void fromServletMapping() { @@ -98,9 +98,9 @@ public void fromServletMapping() { request.setServletPath("/app"); request.setQueryString("foo=123"); String result = ServletUriComponentsBuilder.fromServletMapping(request).build().toUriString(); - + assertEquals("http://localhost/mvc-showcase/app", result); - } + } @Test public void fromCurrentRequest() { @@ -116,5 +116,5 @@ public void fromCurrentRequest() { RequestContextHolder.resetRequestAttributes(); } } - + } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java index 6b02ec16278e..9dbbf6416f2e 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java @@ -24,7 +24,6 @@ import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.PropertySource; import org.springframework.format.annotation.NumberFormat; import org.springframework.format.annotation.NumberFormat.Style; import org.springframework.format.support.FormattingConversionServiceFactoryBean; @@ -159,16 +158,16 @@ public void testMapAccess() throws Exception { public static class Bean { - + public String method() { return "foo"; } - + @NumberFormat(style=Style.PERCENT) public BigDecimal getFormattable() { return new BigDecimal(".25"); } - + public String html() { return "

          "; } @@ -176,7 +175,7 @@ public String html() { public String getBean() { return "not the bean object"; } - + public Object getNull() { return null; } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagOutsideDispatcherServletTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagOutsideDispatcherServletTests.java index 66090324b633..d2205f8fcc0f 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagOutsideDispatcherServletTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagOutsideDispatcherServletTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagTests.java index 50f7110a3c51..3d33e75a040e 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/MessageTagTests.java @@ -300,7 +300,7 @@ protected void writeMessage(String msg) { assertTrue("Correct doStartTag return value", tag.doStartTag() == Tag.EVAL_BODY_INCLUDE); assertEquals("Correct message", "test & text", message.toString()); } - + public void testMessageTagWithTextAndExpressionArgumentFormat() throws JspException { PageContext pc = createPageContext(); final StringBuffer message = new StringBuffer(); @@ -354,12 +354,12 @@ public void testMessageWithVarAndScope() throws JspException { MessageTag tag = new MessageTag(); tag.setPageContext(pc); tag.setText("text & text"); - tag.setVar("testvar"); + tag.setVar("testvar"); tag.setScope("page"); tag.doStartTag(); assertEquals("text & text", pc.getAttribute("testvar")); tag.release(); - + tag = new MessageTag(); tag.setPageContext(pc); tag.setCode("test"); @@ -374,7 +374,7 @@ public void testMessageWithVar() throws JspException { MessageTag tag = new MessageTag(); tag.setPageContext(pc); tag.setText("text & text"); - tag.setVar("testvar"); + tag.setVar("testvar"); tag.doStartTag(); assertEquals("text & text", pc.getAttribute("testvar")); tag.release(); @@ -383,11 +383,11 @@ public void testMessageWithVar() throws JspException { tag.setPageContext(pc); tag.setCode("test"); tag.setVar("testvar"); - + tag.doStartTag(); assertEquals("Correct message", "test message", pc.getAttribute("testvar")); } - + public void testNullMessageSource() throws JspException { PageContext pc = createPageContext(); ConfigurableWebApplicationContext ctx = (ConfigurableWebApplicationContext) diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTagTests.java index 66b6aa90d562..943ebcbd12db 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTagTests.java @@ -1,12 +1,12 @@ /* * Copyright 2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ /** * Unit tests for ParamTag - * + * * @author Scott Andrews */ public class ParamTagTests extends AbstractTagTests { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTests.java index 4cd6406a55f7..49d305cc4e50 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ParamTests.java @@ -1,12 +1,12 @@ /* * Copyright 2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ /** * Unit tests for Param - * + * * @author Scott Andrews */ public class ParamTests extends TestCase { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ThemeTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ThemeTagTests.java index e1de2505de0d..be9f385a84c7 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ThemeTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/ThemeTagTests.java @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java index 1faac4d93a43..3937e95dc10c 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java @@ -1,12 +1,12 @@ /* * Copyright 2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,9 +16,7 @@ package org.springframework.web.servlet.tags; -import java.io.UnsupportedEncodingException; import java.lang.reflect.Method; -import java.net.URLDecoder; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -34,7 +32,7 @@ /** * Unit tests for UrlTag - * + * * @author Scott Andrews */ public class UrlTagTests extends AbstractTagTests { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTagTests.java index 53f3303cab02..e101be304be3 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/AbstractHtmlElementTagTests.java @@ -104,7 +104,7 @@ protected RequestDataValueProcessor getMockRequestDataValueProcessor() { RequestDataValueProcessor mockProcessor = createMock(RequestDataValueProcessor.class); ServletRequest request = getPageContext().getRequest(); StaticWebApplicationContext wac = (StaticWebApplicationContext) RequestContextUtils.getWebApplicationContext(request); - wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor); + wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor); return mockProcessor; } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java index 3208aa74f631..431f85d03d2f 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ButtonTagTests.java @@ -37,11 +37,11 @@ protected void onSetUp() { this.tag.setName("My Name"); this.tag.setValue("My Button"); } - + public void testButtonTag() throws Exception { assertEquals(Tag.EVAL_BODY_INCLUDE, this.tag.doStartTag()); assertEquals(Tag.EVAL_PAGE, this.tag.doEndTag()); - + String output = getOutput(); assertTagOpened(output); assertTagClosed(output); @@ -52,10 +52,10 @@ public void testButtonTag() throws Exception { assertContainsAttribute(output, "value", "My Button"); assertAttributeNotPresent(output, "disabled"); } - + public void testDisabled() throws Exception { this.tag.setDisabled("true"); - + this.tag.doStartTag(); this.tag.doEndTag(); @@ -65,7 +65,7 @@ public void testDisabled() throws Exception { assertContainsAttribute(output, "disabled", "disabled"); } - + @Override protected TestBean createTestBean() { return new TestBean(); @@ -78,7 +78,7 @@ protected final void assertTagClosed(String output) { protected final void assertTagOpened(String output) { assertTrue("Tag not opened properly", output.startsWith("