Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReflectionException when running tests several times #95

Closed
Yky opened this issue Nov 15, 2016 · 7 comments
Closed

ReflectionException when running tests several times #95

Yky opened this issue Nov 15, 2016 · 7 comments
Assignees
Milestone

Comments

@Yky
Copy link

Yky commented Nov 15, 2016

If I run my tests several times without changing code I sometimes get the following Exception:

com.openpojo.reflection.exception.ReflectionException: Field name =[m] matches registered prefix=[m], if stripped, empty string will result
	at com.openpojo.reflection.exception.ReflectionException.getInstance(ReflectionException.java:38)
	at com.openpojo.reflection.utils.AttributeHelper.stripPrefix(AttributeHelper.java:84)
	at com.openpojo.reflection.utils.AttributeHelper.getAttributeName(AttributeHelper.java:77)
	at com.openpojo.reflection.impl.PojoMethodFactory.generateGetMethodNames(PojoMethodFactory.java:122)
	at com.openpojo.reflection.impl.PojoMethodFactory.getFieldGetter(PojoMethodFactory.java:90)
	at com.openpojo.reflection.impl.PojoFieldImpl.<init>(PojoFieldImpl.java:53)
	at com.openpojo.reflection.impl.PojoFieldFactory.getPojoFields(PojoFieldFactory.java:44)
	at com.openpojo.reflection.service.impl.DefaultPojoClassLookupService.getPojoClass(DefaultPojoClassLookupService.java:64)
	at com.openpojo.reflection.impl.PojoClassFactory.getPojoClass(PojoClassFactory.java:42)
	at com.openpojo.random.collection.set.ConcurrentSkipListSetRandomGenerator.getBasicInstance(ConcurrentSkipListSetRandomGenerator.java:52)
	at com.openpojo.random.collection.util.BaseCollectionRandomGenerator.doGenerate(BaseCollectionRandomGenerator.java:33)
	at com.openpojo.random.collection.util.BaseCollectionRandomGenerator.doGenerate(BaseCollectionRandomGenerator.java:30)
	at com.openpojo.random.service.impl.RandomGeneratorAdapter.doGenerate(RandomGeneratorAdapter.java:55)
	at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:99)
	at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:107)
	at com.openpojo.random.map.util.MapHelper.buildMap(MapHelper.java:50)
	at com.openpojo.random.map.util.BaseMapRandomGenerator.doGenerate(BaseMapRandomGenerator.java:38)
	at com.openpojo.random.map.util.BaseMapRandomGenerator.doGenerate(BaseMapRandomGenerator.java:30)
	at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:111)
	at com.openpojo.validation.test.impl.SetterTester.run(SetterTester.java:43)
	at com.openpojo.validation.utils.ValidationHelper.runValidation(ValidationHelper.java:101)
	at com.openpojo.validation.impl.DefaultValidator.validate(DefaultValidator.java:46)
Yky added a commit to Yky/openpojo that referenced this issue Nov 15, 2016
possible fix for issue OpenPojo#95
@Yky
Copy link
Author

Yky commented Nov 16, 2016

Ignore the commit on my fork, I overlooked something.

The cause of the problem seems to be ConcurrentSkipListSet that has an instance variable named "m". This is causing a conflict when checking for a registered field prefix m. I wonder why the field names of a generated class are checked? I would assume only non-openpojo and non-openpojo-generated code should be checked?

@Yky
Copy link
Author

Yky commented May 22, 2017

I still get this error with 0.8.5

@oshoukry
Copy link
Member

Could you please submit a code sample demonstrating the error?

@Yky
Copy link
Author

Yky commented May 30, 2017

Sure.

The DTO to be tested:
https://gist.github.com/Yky/2e22f0e00109edc13dc3740808a35937

The test for the DTO:
https://gist.github.com/Yky/a334568ea379854558ef376aeea4c3bd

Since there is a random element in OpenPojo you might need to run the test several times to get the exception with the ConcurrentSkipListSet.

@Yky
Copy link
Author

Yky commented Mar 7, 2018

@oshoukry Have you been able to reproduce this error with my samples?

@oshoukry
Copy link
Member

oshoukry commented Mar 7, 2018

I am able to generate the error.
Thank you for reporting, update soon.

oshoukry added a commit that referenced this issue Mar 9, 2018
@oshoukry oshoukry added this to the 0.8.10 milestone Mar 9, 2018
@oshoukry
Copy link
Member

oshoukry commented Mar 9, 2018

Fixed in version 0.8.10.

@oshoukry oshoukry closed this as completed Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants