You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Drew Stephens (Jira)" <ji...@apache.org> on 2020/01/05 18:35:00 UTC

[jira] [Commented] (BEANUTILS-477) Warnings from FluentPropertyBeanIntrospector when creating a CombinedConfiguration from a CombinedConfigurationBuilder

    [ https://issues.apache.org/jira/browse/BEANUTILS-477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17008390#comment-17008390 ] 

Drew Stephens commented on BEANUTILS-477:
-----------------------------------------

Same, I still see this with 1.9.4

> Warnings from FluentPropertyBeanIntrospector when creating a CombinedConfiguration from a CombinedConfigurationBuilder
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-477
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-477
>             Project: Commons BeanUtils
>          Issue Type: Bug
>    Affects Versions: 1.9.2
>         Environment: Windows 7 x64, Java 1.7, Apache Commons Configuration 2.0-alpha2
>            Reporter: Richard Tearle
>            Priority: Major
>              Labels: newbie
>             Fix For: 1.9.3
>
>
> When creating a CombinedConfiguration from a CombinedConfigurationBuilder we get a number of warnings from FluentPropertyBeanIntrospector whilst it's trying to get PropertyDescriptors for the following methods: AbstractConfiguration.setProperty and MultiWrapDynaBean.set. 
> Is there a way to suppress these warnings or some other fix, as our testers keep reporting the warnings as errors.
> The following is a simple example of the code that should reproduce this issue:
> {code}
>     @Test
>     public void configurationTestExample() {
>         List<FileLocationStrategy> subs = Arrays.asList(
>                 new ProvidedURLLocationStrategy(),
>                 new FileSystemLocationStrategy(),
>                 new ClasspathLocationStrategy());
>         FileLocationStrategy strategy = new CombinedLocationStrategy(subs);
>         
>         Parameters params = new Parameters();
>         CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder()
>             .configure(
>                     params.fileBased()
>                         .setFile(new File("Configuration.unitTest.xml"))
>                         .setLocationStrategy(strategy)
>                         .setListDelimiterHandler(new DefaultListDelimiterHandler(';'))
>                     );
>         try {
>             CombinedConfiguration config = builder.getConfiguration();
>             config.hashCode();
>         } catch (org.apache.commons.configuration2.ex.ConfigurationException e) {
>             e.printStackTrace();
>         }
>         
>         assertTrue(true);
>     }
> {code}
> and here is the stack trace
> {code}
> 16:16:54,037  WARN xxx:[main] (FluentPropertyBeanIntrospector.java:146) - Error when creating PropertyDescriptor for public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty(java.lang.String,java.lang.Object)! Ignoring this property.
> java.beans.IntrospectionException: bad write method arg count: public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty(java.lang.String,java.lang.Object)
> 	at java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:670)
> 	at java.beans.PropertyDescriptor.setWriteMethod(PropertyDescriptor.java:325)
> 	at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:138)
> 	at org.apache.commons.beanutils.FluentPropertyBeanIntrospector.createFluentPropertyDescritor(FluentPropertyBeanIntrospector.java:177)
> 	at org.apache.commons.beanutils.FluentPropertyBeanIntrospector.introspect(FluentPropertyBeanIntrospector.java:140)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.fetchIntrospectionData(PropertyUtilsBean.java:2234)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.getIntrospectionData(PropertyUtilsBean.java:2215)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:950)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.isWriteable(PropertyUtilsBean.java:1466)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.isPropertyWriteable(BeanHelper.java:521)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.initProperty(BeanHelper.java:357)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.initBeanProperties(BeanHelper.java:273)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.initBean(BeanHelper.java:192)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper$BeanCreationContextImpl.initBean(BeanHelper.java:669)
> 	at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.initBeanInstance(DefaultBeanFactory.java:162)
> 	at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.createBean(DefaultBeanFactory.java:116)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:459)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:479)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:492)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:447)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:417)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:285)
> 	at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.getDefinitionConfiguration(CombinedConfigurationBuilder.java:746)
> 	at org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder.createResultDeclaration(CombinedConfigurationBuilder.java:776)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getResultDeclaration(BasicConfigurationBuilder.java:485)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:447)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:417)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:285)
> 	at com.northgateps.nds.platform.util.configuration.ConfigurationFactoryTest.testSingletonPattern(ConfigurationFactoryTest.java:55)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at junit.framework.TestCase.runTest(TestCase.java:176)
> 	at junit.framework.TestCase.runBare(TestCase.java:141)
> 	at junit.framework.TestResult$1.protect(TestResult.java:122)
> 	at junit.framework.TestResult.runProtected(TestResult.java:142)
> 	at junit.framework.TestResult.run(TestResult.java:125)
> 	at junit.framework.TestCase.run(TestCase.java:129)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:252)
> 	at junit.framework.TestSuite.run(TestSuite.java:247)
> 	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> 16:16:54,150  WARN xxx:[main] (FluentPropertyBeanIntrospector.java:146) - Error when creating PropertyDescriptor for public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty(java.lang.String,java.lang.Object)! Ignoring this property.
> java.beans.IntrospectionException: bad write method arg count: public final void org.apache.commons.configuration2.AbstractConfiguration.setProperty(java.lang.String,java.lang.Object)
> 	at java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:670)
> 	at java.beans.PropertyDescriptor.setWriteMethod(PropertyDescriptor.java:325)
> 	at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:138)
> 	at org.apache.commons.beanutils.FluentPropertyBeanIntrospector.createFluentPropertyDescritor(FluentPropertyBeanIntrospector.java:177)
> 	at org.apache.commons.beanutils.FluentPropertyBeanIntrospector.introspect(FluentPropertyBeanIntrospector.java:140)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.fetchIntrospectionData(PropertyUtilsBean.java:2234)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.getIntrospectionData(PropertyUtilsBean.java:2215)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:950)
> 	at org.apache.commons.beanutils.PropertyUtilsBean.isWriteable(PropertyUtilsBean.java:1466)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.isPropertyWriteable(BeanHelper.java:521)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.initProperty(BeanHelper.java:357)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.initBeanProperties(BeanHelper.java:273)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.initBean(BeanHelper.java:192)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper$BeanCreationContextImpl.initBean(BeanHelper.java:669)
> 	at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.initBeanInstance(DefaultBeanFactory.java:162)
> 	at org.apache.commons.configuration2.beanutils.DefaultBeanFactory.createBean(DefaultBeanFactory.java:116)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:459)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:479)
> 	at org.apache.commons.configuration2.beanutils.BeanHelper.createBean(BeanHelper.java:492)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResultInstance(BasicConfigurationBuilder.java:447)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.createResult(BasicConfigurationBuilder.java:417)
> 	at org.apache.commons.configuration2.builder.BasicConfigurationBuilder.getConfiguration(BasicConfigurationBuilder.java:285)
> 	at com.northgateps.nds.platform.util.configuration.ConfigurationFactoryTest.testSingletonPattern(ConfigurationFactoryTest.java:55)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at junit.framework.TestCase.runTest(TestCase.java:176)
> 	at junit.framework.TestCase.runBare(TestCase.java:141)
> 	at junit.framework.TestResult$1.protect(TestResult.java:122)
> 	at junit.framework.TestResult.runProtected(TestResult.java:142)
> 	at junit.framework.TestResult.run(TestResult.java:125)
> 	at junit.framework.TestCase.run(TestCase.java:129)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:252)
> 	at junit.framework.TestSuite.run(TestSuite.java:247)
> 	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> {code}
> and finally, here is the Configuration.unitTest.xml
> {code:xml}
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <configuration>
> 	<header>
> 		<result throwExceptionOnMissing="true"/>
> 	</header>
> 	<!-- properties for the unit tests -->
> 	<properties fileName="unitTest.properties" throwExceptionOnMissing="true" config-name="properties">
> 		<listDelimiterHandler
>         	config-class="org.apache.commons.configuration2.convert.DefaultListDelimiterHandler">
>         	<config-constrarg config-value=";"/>
>       	</listDelimiterHandler>
> 	</properties>
> </configuration>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)