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

exception in beanmapper class DefaultBeanUnproxy: ArrayIndexOutOfBoundsException #53

Closed
ailbertriksen opened this issue Apr 5, 2016 · 3 comments

Comments

@ailbertriksen
Copy link

Stacktrace:

apr 05, 2016 7:45:36 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/api] threw exception [Request processing failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 0] with root cause
java.lang.ArrayIndexOutOfBoundsException: 0
    at io.beanmapper.core.unproxy.DefaultBeanUnproxy.unproxy(DefaultBeanUnproxy.java:21)
    at io.beanmapper.core.unproxy.SkippingBeanUnproxy.unproxy(SkippingBeanUnproxy.java:36)
    at io.beanmapper.BeanMapper.getBeanMatch(BeanMapper.java:176)
    at io.beanmapper.BeanMapper.matchSourceToTarget(BeanMapper.java:166)
    at io.beanmapper.BeanMapper.map(BeanMapper.java:149)
    at io.beanmapper.BeanMapper.map(BeanMapper.java:114)
    at io.beanmapper.BeanMapper.map(BeanMapper.java:90)
    at nl.mad.voliere.buizerd.model.website.WebsiteService.checkNow(WebsiteService.java:269)
    at nl.mad.voliere.buizerd.model.website.WebsiteService$$FastClassBySpringCGLIB$$11439aa7.invoke(<generated>)

code of DefaultBeanUnproxy:

public class DefaultBeanUnproxy implements BeanUnproxy {
    public DefaultBeanUnproxy() {
    }
    public Class<?> unproxy(Class<?> beanClass) {
        String name = beanClass.getName();
==>     return name.contains("$")?beanClass.getInterfaces()[0]:beanClass;
    }
}

name is: nl.mad.voliere.buizerd.checker.WebsiteCheckerExecutor$UrlTestResult
UrlTestResult is an inner class of WebsiteCheckerExecutor. There are no interfaces.

Rickvanderwaal added a commit that referenced this issue Apr 6, 2016
Rickvanderwaal added a commit that referenced this issue Apr 6, 2016
@Rickvanderwaal
Copy link
Contributor

This issue is fixed in the next release of BeanMapper.
For now you can use BeanMapper.addProxySkipClass(UrlTestResult.class)

@ailbertriksen
Copy link
Author

I still got the exception. This is my code:

    @Inject
    private BeanMapper beanMapper;

....
        beanMapper.addProxySkipClass(WebsiteCheckerExecutor.UrlTestResult.class);
        UrlTestResultForm urlTestResultForm = beanMapper.map(urlTestResult, UrlTestResultForm.class);

@Rickvanderwaal Rickvanderwaal reopened this Apr 6, 2016
Rickvanderwaal added a commit that referenced this issue Apr 6, 2016
@Rickvanderwaal
Copy link
Contributor

workaround is not working, this issue including the workaround will be fixed in the next release of BeanMapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants